-
Notifications
You must be signed in to change notification settings - Fork 567
/
Copy pathbuild_tarballs.jl
82 lines (72 loc) · 2.55 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
# 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
name = "SEAL"
version = v"3.5.6"
# Collection of sources required to complete build
sources = [
ArchiveSource("https://github.com/microsoft/SEAL/archive/v$(version).tar.gz",
"13674a39a48c0d1c6ff544521cf10ee539ce1af75c02bfbe093f7621869e3406"),
DirectorySource("./bundled")
]
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/SEAL-*
# Apply patches that fix some cross-compilation issues
for f in ${WORKSPACE}/srcdir/patches/*.patch; do
atomic_patch -p1 ${f}
done
# The last three '-DSEAL_USE__*' flags are required to circumvent
# cross-compilation issues
if [[ "${target}" == *-darwin* ]]; then
# C++17 is disabled on MacOS due to the environment being too old.
cmake . \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_clang.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=ON \
-DSEAL_BUILD_SEAL_C=ON \
-DSEAL_USE___BUILTIN_CLZLL=OFF \
-DSEAL_USE__ADDCARRY_U64=OFF \
-DSEAL_USE__SUBBORROW_U64=OFF \
-DSEAL_USE_CXX17=OFF
else
cmake . \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_clang.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=ON \
-DSEAL_BUILD_SEAL_C=ON \
-DSEAL_USE___BUILTIN_CLZLL=OFF \
-DSEAL_USE__ADDCARRY_U64=OFF \
-DSEAL_USE__SUBBORROW_U64=OFF
fi
make -j${nproc}
make install
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Linux(:x86_64, libc=:musl),
MacOS(:x86_64),
Linux(:x86_64, libc=:glibc),
Linux(:aarch64, libc=:glibc),
FreeBSD(:x86_64),
Linux(:powerpc64le, libc=:glibc),
Linux(:aarch64, libc=:musl)
]
# Fix incompatibilities across the GCC 4/5 version boundary due to std::string,
# as suggested by the wizard
platforms = expand_cxxstring_abis(platforms)
# The products that we will ensure are always built
products = [
LibraryProduct("libsealc", :libsealc),
LibraryProduct("libseal", :libseal)
]
# Dependencies that must be installed before this package can be built
dependencies = Dependency[
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version = v"7.1.0")