78 lines
2.4 KiB
Ruby
78 lines
2.4 KiB
Ruby
class Z3 < Formula
|
|
bottle do
|
|
root_url "https://homebrew.hyprnet/bottles"
|
|
sha256 cellar: :any, arm64_sequoia: "08478660968932e8353796d24fee205a57321a4945d48991e8f82dae723d97a3"
|
|
sha256 cellar: :any, arm64_tahoe: "ee99aab378c77dfd90c002bcceb28164c1c78d9705df789151e781dfa26f0177"
|
|
sha256 cellar: :any, x86_64_linux: "3cbce2db8b73bd7095b0ad82606a338e4ef7c262f0d6e6f182c32141d53f9ac2"
|
|
end
|
|
desc "High-performance theorem prover"
|
|
homepage "https://github.com/Z3Prover/z3"
|
|
url "https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.16.0.tar.gz"
|
|
sha256 "c68c3e5e4810b16126b8cb4c47eee85c1ac3e24a81914c8e371b40de9dd33ac7"
|
|
license "MIT"
|
|
compatibility_version 2
|
|
head "https://github.com/Z3Prover/z3.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/z3[._-]v?(\d+(?:\.\d+)+)/i)
|
|
strategy :github_latest
|
|
end
|
|
|
|
|
|
|
|
depends_on "cmake" => :build
|
|
# Has Python bindings but are supplementary to the main library
|
|
# which does not need Python.
|
|
depends_on "python@3.14" => [:build, :test]
|
|
|
|
# The following macOS conditional should be the inverse of LLVM's Z3 conditional
|
|
on_ventura :or_older do
|
|
fails_with :clang do
|
|
cause "Requires C++20 std::format, https://developer.apple.com/xcode/cpp/#c++20"
|
|
end
|
|
end
|
|
|
|
fails_with :gcc do
|
|
version "12"
|
|
cause "Requires C++20 std::format, https://gcc.gnu.org/gcc-13/changes.html#libstdcxx"
|
|
end
|
|
|
|
def python3
|
|
which("python3.14")
|
|
end
|
|
|
|
def install
|
|
args = %W[
|
|
-DZ3_LINK_TIME_OPTIMIZATION=ON
|
|
-DZ3_INCLUDE_GIT_DESCRIBE=OFF
|
|
-DZ3_INCLUDE_GIT_HASH=OFF
|
|
-DZ3_INSTALL_PYTHON_BINDINGS=ON
|
|
-DZ3_BUILD_EXECUTABLE=ON
|
|
-DZ3_BUILD_TEST_EXECUTABLES=OFF
|
|
-DZ3_BUILD_PYTHON_BINDINGS=ON
|
|
-DZ3_BUILD_DOTNET_BINDINGS=OFF
|
|
-DZ3_BUILD_JAVA_BINDINGS=OFF
|
|
-DZ3_USE_LIB_GMP=OFF
|
|
-DPYTHON_EXECUTABLE=#{python3}
|
|
-DCMAKE_INSTALL_PYTHON_PKG_DIR=#{Language::Python.site_packages(python3)}
|
|
]
|
|
|
|
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
|
|
system "make", "-C", "contrib/qprofdiff"
|
|
bin.install "contrib/qprofdiff/qprofdiff"
|
|
|
|
pkgshare.install "examples"
|
|
end
|
|
|
|
test do
|
|
system ENV.cc, pkgshare/"examples/c/test_capi.c", "-I#{include}",
|
|
"-L#{lib}", "-lz3", "-o", testpath/"test"
|
|
system "./test"
|
|
assert_equal version.to_s, shell_output("#{python3} -c 'import z3; print(z3.get_version_string())'").strip
|
|
end
|
|
end
|