-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_dependencies
executable file
·112 lines (96 loc) · 2.72 KB
/
build_dependencies
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
# Copyright 2013-2017 Edgar Costa
# See LICENSE file for license details.
# build_dependencies: a simple script to build dependencies of controlled reduction
set -e
echoerr() { echo "$@" 1>&2; }
absolute_path(){
dirlist="$1"
retval=""
for dir in $dirlist; do
case $dir in
/*) dir=$dir;;
*) dir=$PWD/$dir;;
esac
retval=$retval" "$dir
done
echo $retval
}
GMP_VERSION=6.1.2
MPIR_VERSION=3.0.0 # 2.7.2?
MPFR_VERSION=3.1.6
NTL_VERSION=10.5.0
FLINT_VERSION=2.5.2
if [ -z ${PREFIX+word} ]; then
PREFIX=${HOME}/local
fi
PREFIX=$(absolute_path ${PREFIX})
mkdir -p ${PREFIX}
TMP=tmp-controlled-reduction
mkdir -p ${TMP}
TMP=$(absolute_path ${TMP})
cd ${TMP}
#Build GMP
wget https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.bz2 -nv
tar -xf gmp-${GMP_VERSION}.tar.bz2
rm gmp-${GMP_VERSION}.tar.bz2
cd gmp-${GMP_VERSION}/
./configure ABI=$ABI --prefix=${PREFIX}
make -j4
make install
cd ..
rm -rf gmp-${GMP_VERSION}/
echoerr gmp-${GMP_VERSION} installed
#Build mpir
wget http://mpir.org/mpir-${MPIR_VERSION}.tar.bz2 -nv
tar -xf mpir-${MPIR_VERSION}.tar.bz2
rm mpir-${MPIR_VERSION}.tar.bz2
cd mpir-${MPIR_VERSION}/
./configure ABI=$ABI --enable-gmpcompat --prefix=${PREFIX}
make -j4
make install
cd ..
echoerr mpir-${MPIR_VERSION} installed
#Build mpfr
wget https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2 -nv
tar -xf mpfr-${MPFR_VERSION}.tar.bz2
rm mpfr-${MPFR_VERSION}.tar.bz2
cd mpfr-${MPFR_VERSION}/
./configure ABI=$ABI --with-gmp-build=${TMP}/mpir-${MPIR_VERSION}/ --prefix=${PREFIX}
make -j4
make install
cd ..
rm -rf mpir-${MPIR_VERSION}/
rm -rf mpfr-${MPFR_VERSION}/
echoerr mpfr-${MPFR_VERSION} installed
export LD_LIBRARY_PATH=${PREFIX}/lib:${LD_LIBRARY_PATH}
#Build NTL
wget http://www.shoup.net/ntl/ntl-${NTL_VERSION}.tar.gz -nv
tar xf ntl-${NTL_VERSION}.tar.gz
rm ntl-${NTL_VERSION}.tar.gz
cd ntl-${NTL_VERSION}/src/
if [ ${TRAVIS} = true ] ; then
./configure NTL_THREADS=on NTL_THREAD_BOOST=on TUNE=x86 GMP_PREFIX=${PREFIX} PREFIX=${PREFIX}
else
./configure NTL_THREADS=on NTL_THREAD_BOOST=on GMP_PREFIX=${PREFIX} PREFIX=${PREFIX}
fi
make -j4
make install
cd ../../
rm -rf ntl-${NTL_VERSION}/
echoerr ntl-${NTL_VERSION} installed
#Build flint
wget http://flintlib.org/flint-${FLINT_VERSION}.tar.gz -nv
tar -xf flint-${FLINT_VERSION}.tar.gz
rm flint-${FLINT_VERSION}.tar.gz
cd flint-${FLINT_VERSION}/
./configure ABI=$ABI --with-mpir=${PREFIX} --with-mpfr=${PREFIX} --with-gmp=${PREFIX} --prefix=${PREFIX}
make -j4
make install
cd ..
rm -rf flint-${FLINT_VERSION}/
echoerr flint-${FLINT_VERSION} installed
export LIBRARY_PATH=${PREFIX}/lib:${LIBRARY_PATH}
echo "Don't forget to add to your .bashrc"
echo "export LD_LIBRARY_PATH=$\={PREFIX}/lib:\${LD_LIBRARY_PATH}"
set +e