-
Notifications
You must be signed in to change notification settings - Fork 558
/
build_tarballs.jl
97 lines (84 loc) · 3.65 KB
/
build_tarballs.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg
# See https://github.com/JuliaLang/Pkg.jl/issues/2942
# Once this Pkg issue is resolved, this must be removed
uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f")
delete!(Pkg.Types.get_last_stdlibs(v"1.6.3"), uuid)
name = "z3"
version = v"4.13.4"
# Collection of sources required to complete build
sources = [
ArchiveSource("https://github.com/Z3Prover/z3/releases/download/z3-$(version)/z3_solver-$(version).0.tar.gz",
"66944689398d19f831f94524e95e99961d998afa27cfef1918a5a441029ea73f"),
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz",
"2408d07df7f324d3beea818585a6d990ba99587c218a3969f924dfcc4de93b62"),
]
macfix = raw"""
# See https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/1185
if [[ "${target}" == x86_64-apple-darwin* ]]; then
# work around macOS SDK issue
# /workspace/srcdir/z3/src/ast/ast.h:: 189error:: 47:'get<unsigned int, int, ast *,
# symbol, zstring *, rational *, double, unsigned int>' is unavailable:
# introduced in macOS 10.14
export MACOSX_DEPLOYMENT_TARGET=10.15
pushd $WORKSPACE/srcdir/MacOSX10.*.sdk
rm -rf /opt/${target}/${target}/sys-root/System
cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/."
cp -ra System "/opt/${target}/${target}/sys-root/."
popd
fi
"""
# Bash recipe for building across all platforms
script = macfix * raw"""
cd $WORKSPACE/srcdir/z3*/core
# Patches Z3 to work around https://github.com/ahumenberger/Z3.jl/issues/28
patch -p0 <<EOD
--- src/util/memory_manager.cpp 2024-03-07 11:10:51
+++ src/util/memory_manager.cpp 2024-06-12 17:45:50
@@ -28,6 +28,7 @@
# define HAS_MALLOC_USABLE_SIZE
# define malloc_usable_size _msize
#endif
+#undef HAS_MALLOC_USABLE_SIZE
// The following two function are automatically generated by the mk_make.py script.
// The script collects ADD_INITIALIZER and ADD_FINALIZER commands in the .h files.
EOD
cmake -B build \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_FIND_ROOT_PATH="${prefix}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DZ3_USE_LIB_GMP=True \
-DZ3_BUILD_JULIA_BINDINGS=True \
-DZ3_ENABLE_EXAMPLE_TARGETS=False \
-DJulia_PREFIX="${prefix}"
cmake --build build --parallel ${nproc}
cmake --install build
install_license LICENSE.txt
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
include("../../L/libjulia/common.jl")
platforms = vcat(libjulia_platforms.(julia_versions)...)
platforms = expand_cxxstring_abis(platforms)
# FreeBSD on ARM 64 is not supported for Julia versions before 1.12.
# GMP isn't found for aarch64-unknown-freebsd-julia_version+1.12.0.
# That's probably a BinaryBuilder problem.
filter!(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms)
# The products that we will ensure are always built
products = [
LibraryProduct("libz3", :libz3),
LibraryProduct("libz3jl", :libz3jl),
ExecutableProduct("z3", :z3)
]
# Dependencies that must be installed before this package can be built
dependencies = [
BuildDependency("libjulia_jll"),
Dependency("GMP_jll"; compat="6.2.1"),
Dependency("libcxxwrap_julia_jll"),
Dependency("CompilerSupportLibraries_jll"; platforms=filter(!Sys.isapple, platforms)),
]
# Use GCC 10 to avoid compile errors on Windows
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
julia_compat="1.6", preferred_gcc_version=v"10")