Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
3-manifolds
GitHub Repository: 3-manifolds/Sage_macOS
Path: blob/main/Sage_base/sage/gmp/build_gmp.sh
245 views
1
#!/bin/bash
2
VERSION=6.3.0
3
SRC_DIR=gmp-${VERSION}
4
SRC_ARCHIVE=${SRC_DIR}.tar.gz
5
URL=https://ftp.gnu.org/gnu/gmp/${SRC_ARCHIVE}
6
HASH=a81a30b55ce5cc4346615224442a9125bc6e62a2
7
INSTALL_PREFIX=`pwd`/local
8
ARCH=`/usr/bin/arch`
9
10
set -e
11
cd gmp
12
13
if ! [ -e ${SRC_ARCHIVE} ]; then
14
echo "Downloading source archive ${SRC_ARCHIVE}..."
15
curl -L -O ${URL}
16
ACTUAL_HASH=`/usr/bin/shasum ${SRC_ARCHIVE} | cut -f 1 -d' '`
17
if [[ ${ACTUAL_HASH} != ${HASH} ]]; then
18
echo Invalid hash value for ${SRC_ARCHIVE}
19
exit 1
20
fi
21
fi
22
23
if ! [ -d ${SRC_DIR} ]; then
24
tar xfz ${SRC_ARCHIVE}
25
pushd ${SRC_DIR}
26
for patchfile in `ls ../patches`; do
27
patch -p1 < ../patches/$patchfile
28
done
29
popd
30
fi
31
32
cd ${SRC_DIR}
33
if [ -e Makefile ]; then
34
make distclean
35
fi
36
export
37
if [ $ARCH == "arm64" ]; then
38
./configure \
39
--prefix=${INSTALL_PREFIX} \
40
--enable-cxx \
41
CFLAGS="-mmacosx-version-min=11" \
42
LDFLAGS="-Wl,-ld_classic"
43
else
44
./configure \
45
--prefix=${INSTALL_PREFIX} \
46
--enable-cxx \
47
CFLAGS="-mmacosx-version-min=10.13 -mno-avx2 -mno-bmi2" \
48
LDFLAGS="-Wl,-ld_classic"
49
fi
50
echo "Building gmp ..."
51
gmake -j8
52
gmake check
53
gmake install
54
55