Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
3-manifolds
GitHub Repository: 3-manifolds/Sage_macOS
Path: blob/main/Sage_framework/build_sage.sh
170 views
1
if ! [ -e repo/sage ]; then
2
echo "The sage distribution is not where we expect to find it."
3
echo "This script must be run from the Sage_framework directory."
4
exit 1
5
fi
6
7
VERSION=`../bin/get_sage_version`
8
SAGE_SYMLINK="/var/tmp/sage-$VERSION-current"
9
10
# By default, a sage build cannot be relocated. This build is
11
# relocatable. This is done by using a symlink in /var/tmp which
12
# points to the current location of the sage root.
13
#
14
# To make this work, we relocate the sage source tree to the location
15
# where the sage symlink will be when sage is actually being run. This
16
# tricks the sage build system into generating appropriate shebangs
17
# for installed scripts and deals with any other random places where
18
# sage may use a hardwired path to the sage root.
19
#
20
# To build a framework that can be used in a macOS app we also need
21
# to edit all loader paths and rpaths, making them relative by using
22
# @loader_path. This is done in a separate pass.
23
24
if [ -L ${SAGE_SYMLINK} ]; then
25
rm ${SAGE_SYMLINK}
26
elif [ -e ${SAGE_SYMLINK} ]; then
27
echo ${SAGE_SYMLINK} is not a symlink !!!
28
exit 1
29
fi
30
mv repo/sage ${SAGE_SYMLINK}
31
pushd ${SAGE_SYMLINK}
32
33
# Make sure that runpath.sh exists, is correct, and is executable.
34
# The sage bash script requires this.
35
mkdir -p local/var/lib/sage
36
echo SAGE_SYMLINK=${SAGE_SYMLINK} > local/var/lib/sage/runpath.sh
37
chmod +x local/var/lib/sage/runpath.sh
38
39
# Set environment variables for the build.
40
if [ $(uname -m) == "arm64" ]; then
41
export CFLAGS="-O2 -mmacosx-version-min=11.0"
42
export CXXFLAGS="$CFLAGS -stdlib=libc++"
43
export LDFLAGS="-Wl,-platform_version,macos,11.0,11.1 -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
44
export MACOSX_DEPLOYMENT_TARGET="11.0"
45
else
46
export GMP_CONFIGURE="--enable-fat"
47
export SAGE_FAT_BINARY="yes"
48
export CFLAGS="-O2 -mmacosx-version-min=10.12 -mno-avx2 -mno-bmi2"
49
export CXXFLAGS="$CFLAGS -stdlib=libc++"
50
if [ `/usr/bin/ld -ld_classic 2> >(grep -c warning)` != "0" ] ; then
51
export LDFLAGS="-ld_classic -Wl,-platform_version,macos,10.12,11.3"
52
else
53
export LDFLAGS="-Wl,-platform_version,macos,10.12,11.3"
54
fi
55
export MACOSX_DEPLOYMENT_TARGET="10.12"
56
fi
57
# Run bootstrap and configure.
58
CONFIG_OPTIONS="--with-system-python3=no \
59
--disable-notebook \
60
--disable-editable \
61
--enable-isl \
62
--enable-4ti2 \
63
--enable-benzene \
64
--enable-gap_packages \
65
--enable-latte_int \
66
--enable-bliss \
67
--enable-buckygen \
68
--enable-cbc \
69
--enable-coxeter3 \
70
--enable-sagemath_coxeter3 \
71
--enable-csdp \
72
--enable-e_antic \
73
--enable-frobby \
74
--enable-gp2c \
75
--enable-igraph \
76
--enable-kenzo \
77
--enable-libnauty \
78
--enable-libsemigroups \
79
--enable-lrslib \
80
--enable-meataxe \
81
--enable-sagemath_meataxe \
82
--enable-mcqd \
83
--enable-mpfrcx \
84
--enable-normaliz \
85
--enable-p_group_cohomology \
86
--enable-pari_elldata \
87
--enable-pari_galpol \
88
--enable-pari_nftables \
89
--enable-plantri \
90
--enable-sagemath-bliss \
91
--enable-sage_numerical_backends_coin \
92
--enable-pynormaliz \
93
--enable-pycosat \
94
--enable-pysingular \
95
--enable-qepcad \
96
--enable-sirocco \
97
--enable-sagemath_sirocco \
98
--enable-symengine \
99
--enable-symengine_py \
100
--enable-tdlib \
101
--enable-tides"
102
103
./bootstrap
104
./configure $CONFIG_OPTIONS > /tmp/configure.out
105
106
# Force xz to be built first. Otherwise it gets built after gmp even
107
# though gmp lists xz as a dependency. This causes gmp and the
108
# many packages that depend on it to get rebuilt in every incremental
109
# build. That is very frustrating.
110
make xz
111
112
# Do the main build with 8 CPUs
113
export MAKE="make -j8"
114
make build
115
116
# Move the repo back where it came from.
117
popd
118
mv /var/tmp/sage-$VERSION-current repo/sage
119
120