@@ -16,19 +16,46 @@ set -o errexit
16
16
# #
17
17
# ------------------------------------------------------------------------- #
18
18
19
+ SKIP_GMP=no
20
+ SKIP_MPFR=no
21
+
19
22
USE_GMP=gmp
20
23
PATCH_GMP_ARM64=no
24
+ BUILD_ARB=no
21
25
22
26
while [[ $# -gt 0 ]]
23
27
do
24
28
key=" $1 "
25
29
case $key in
26
30
-h|--help)
27
- echo " bin/download_dependencies.sh [--gmp gmp|mpir] [--host HOST]"
31
+ echo " bin/download_dependencies.sh [options]"
32
+ echo
33
+ echo " Build local installs of python-flint's dependencies."
34
+ echo
35
+ echo " Supported options:"
36
+ echo " --help - show this help message"
37
+ echo " --host <HOST> - set the host (target) for GMP build"
38
+ echo " --skip-gmp - skip building GMP"
39
+ echo " --skip-mpfr - skip building MPFR"
40
+ echo
41
+ echo " Legacy options:"
42
+ echo " --gmp gmp - build based on GMP (default)"
43
+ echo " --gmp mpir - build based on MPIR (no longer works)"
44
+ echo " --patch-gmp-arm64 - apply patch to GMP 6.2.1 for OSX arm64"
45
+ echo " --arb - build Arb (only needed for flint < 3.0.0)"
46
+ echo
28
47
exit
29
48
;;
49
+ --host)
50
+ # e.g. --host x86_64-unknown-linux-gnu
51
+ # or --host x86_64-apple-darwin
52
+ HOST_ARG=" $2 "
53
+ shift
54
+ shift
55
+ ;;
30
56
--gmp)
31
57
# e.g. --gmp gmp or --gmp mpir
58
+ # The mpir build no longer works because the download fails.
32
59
USE_GMP=" $2 "
33
60
if [[ " $USE_GMP " != " gmp" && " $USE_GMP " != " mpir" ]]; then
34
61
echo " --gmp option should be gmp or mpir"
37
64
shift
38
65
shift
39
66
;;
40
- --host )
41
- # e.g. --host x86_64-unknown-linux-gnu
42
- # or --host x86_64-apple-darwin
43
- HOST_ARG= " $2 "
67
+ --arb )
68
+ # With flint >= 3.0.0 Arb is included so we do not need to build it
69
+ # separately. Pass --arb if building for older versions of flint.
70
+ BUILD_ARB=yes
44
71
shift
72
+ ;;
73
+ --skip-gmp)
74
+ # If you already have a local install of GMP you can pass --skip-gmp
75
+ # to skip building it.
76
+ SKIP_GMP=yes
77
+ shift
78
+ ;;
79
+ --skip-mpfr)
80
+ # If you already have a local install of MPFR you can pass --skip-mpfr
81
+ # to skip building it.
82
+ SKIP_MPFR=yes
45
83
shift
46
84
;;
47
85
--patch-gmp-arm64)
86
+ # Needed only for GMP 6.2.1 on OSX arm64 (Apple M1) hardware
87
+ # As of GMP 6.3.0 this patch is no longer needed
48
88
PATCH_GMP_ARM64=yes
49
89
shift
50
90
;;
@@ -86,42 +126,58 @@ if [ $USE_GMP = "gmp" ]; then
86
126
# #
87
127
# ----------------------------------------------------------------------- #
88
128
89
- if [ $USE_GMP_GITHUB_MIRROR = " yes" ]; then
90
- # Needed in GitHub Actions because it is blocked from gmplib.org
91
- git clone https://github.com/oscarbenjamin/gmp_mirror.git
92
- cp gmp_mirror/gmp-$GMPVER .tar.xz .
129
+ if [ $SKIP_GMP = " yes" ]; then
130
+ echo
131
+ echo --------------------------------------------
132
+ echo " skipping GMP"
133
+ echo --------------------------------------------
134
+ echo
93
135
else
94
- curl -O https://gmplib.org/download/gmp/gmp-$GMPVER .tar.xz
95
- fi
136
+ echo
137
+ echo --------------------------------------------
138
+ echo " building GMP"
139
+ echo --------------------------------------------
140
+ echo
141
+
142
+ if [ $USE_GMP_GITHUB_MIRROR = " yes" ]; then
143
+ # Needed in GitHub Actions because it is blocked from gmplib.org
144
+ git clone https://github.com/oscarbenjamin/gmp_mirror.git
145
+ cp gmp_mirror/gmp-$GMPVER .tar.xz .
146
+ else
147
+ curl -O https://gmplib.org/download/gmp/gmp-$GMPVER .tar.xz
148
+ fi
96
149
97
- tar xf gmp-$GMPVER .tar.xz
98
- cd gmp-$GMPVER
150
+ tar xf gmp-$GMPVER .tar.xz
151
+ cd gmp-$GMPVER
152
+
153
+ #
154
+ # See https://github.com/aleaxit/gmpy/issues/350
155
+ #
156
+ # We need to patch GMP for OSX arm64 (Apple M1) hardware. This patch is
157
+ # from the GMP repo but was applied after the release of GMP 6.2.1.
158
+ # Hopefully when a newer version of GMP is released we will not need to
159
+ # apply this patch any more.
160
+ #
161
+ if [ $PATCH_GMP_ARM64 = " yes" ]; then
162
+ echo
163
+ echo --------------------------------------------
164
+ echo " patching GMP"
165
+ echo --------------------------------------------
166
+ patch -N -Z -p0 < ../../../bin/patch-arm64.diff
167
+ fi
99
168
100
- #
101
- # See https://github.com/aleaxit/gmpy/issues/350
102
- #
103
- # We need to patch GMP for OSX arm64 (Apple M1) hardware for GMP 6.2.1.
104
- # Now with GMP 6.3.0 this should not be needed any more.
105
- #
106
- if [ $PATCH_GMP_ARM64 = " yes" ]; then
107
- echo
108
- echo --------------------------------------------
109
- echo " patching GMP"
110
- echo --------------------------------------------
111
- patch -N -Z -p0 < ../../../bin/patch-arm64.diff
112
- fi
169
+ # Show the output of configfsf.guess
170
+ ./configfsf.guess
171
+ ./configure --prefix=$PREFIX \
172
+ --enable-fat\
173
+ --enable-shared=yes\
174
+ --enable-static=no\
175
+ --host=$HOSTARG
176
+ make -j3
177
+ make install
178
+ cd ..
113
179
114
- # Show the output of configfsf.guess
115
- chmod +x configfsf.guess
116
- ./configfsf.guess
117
- ./configure --prefix=$PREFIX \
118
- --enable-fat\
119
- --enable-shared=yes\
120
- --enable-static=no\
121
- --host=$HOSTARG
122
- make -j3
123
- make install
124
- cd ..
180
+ fi
125
181
126
182
FLINTARB_WITHGMP=" --with-gmp=$PREFIX "
127
183
182
238
# #
183
239
# ------------------------------------------------------------------------- #
184
240
185
- curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER .tar.gz
186
- tar xf mpfr-$MPFRVER .tar.gz
187
- cd mpfr-$MPFRVER
188
- ./configure --prefix=$PREFIX \
189
- --with-gmp=$PREFIX \
190
- --enable-shared=yes\
191
- --enable-static=no
192
- make -j3
193
- make install
194
- cd ..
241
+ if [ $SKIP_MPFR = " yes" ]; then
242
+ echo
243
+ echo --------------------------------------------
244
+ echo " skipping MPFR"
245
+ echo --------------------------------------------
246
+ echo
247
+ else
248
+ echo
249
+ echo --------------------------------------------
250
+ echo " building MPFR"
251
+ echo --------------------------------------------
252
+ echo
253
+
254
+ curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER .tar.gz
255
+ tar xf mpfr-$MPFRVER .tar.gz
256
+ cd mpfr-$MPFRVER
257
+ ./configure --prefix=$PREFIX \
258
+ --with-gmp=$PREFIX \
259
+ --enable-shared=yes\
260
+ --enable-static=no
261
+ make -j3
262
+ make install
263
+ cd ..
264
+ fi
195
265
196
266
# ------------------------------------------------------------------------- #
197
267
# #
198
268
# FLINT #
199
269
# #
200
270
# ------------------------------------------------------------------------- #
201
271
272
+ echo
273
+ echo --------------------------------------------
274
+ echo " building Flint"
275
+ echo --------------------------------------------
276
+ echo
277
+
202
278
curl -O -L https://www.flintlib.org/flint-$FLINTVER .tar.gz
203
279
tar xf flint-$FLINTVER .tar.gz
204
280
cd flint-$FLINTVER
281
+ ./bootstrap.sh
205
282
./configure --prefix=$PREFIX \
206
283
$FLINTARB_WITHGMP \
207
284
--with-mpfr=$PREFIX \
@@ -216,24 +293,32 @@ cd ..
216
293
# #
217
294
# ------------------------------------------------------------------------- #
218
295
219
- curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER .tar.gz
220
- mv $ARBVER .tar.gz arb-$ARBVER .tar.gz
221
- tar xf arb-$ARBVER .tar.gz
222
- cd arb-$ARBVER
223
- ./configure --prefix=$PREFIX \
224
- --with-flint=$PREFIX \
225
- $FLINTARB_WITHGMP \
226
- --with-mpfr=$PREFIX \
227
- --disable-static
228
- make -j3
229
- make install
230
- #
231
- # Set PATH so that DLLs are picked up on Windows.
232
- #
233
- PATH=$PATH :$PREFIX /lib:$PREFIX /bin \
234
- ARB_TEST_MULTIPLIER=0.1 \
235
- make check
236
- cd ..
296
+ echo
297
+ echo --------------------------------------------
298
+ echo " building Arb"
299
+ echo --------------------------------------------
300
+ echo
301
+
302
+ if [ $BUILD_ARB = " yes" ]; then
303
+ curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER .tar.gz
304
+ mv $ARBVER .tar.gz arb-$ARBVER .tar.gz
305
+ tar xf arb-$ARBVER .tar.gz
306
+ cd arb-$ARBVER
307
+ ./configure --prefix=$PREFIX \
308
+ --with-flint=$PREFIX \
309
+ $FLINTARB_WITHGMP \
310
+ --with-mpfr=$PREFIX \
311
+ --disable-static
312
+ make -j3
313
+ make install
314
+ #
315
+ # Set PATH so that DLLs are picked up on Windows.
316
+ #
317
+ PATH=$PATH :$PREFIX /lib:$PREFIX /bin \
318
+ ARB_TEST_MULTIPLIER=0.1 \
319
+ make check
320
+ cd ..
321
+ fi
237
322
238
323
# ------------------------------------------------------------------------- #
239
324
# #
@@ -248,14 +333,28 @@ echo Build dependencies for python-flint compiled as shared libraries in:
248
333
echo $PREFIX
249
334
echo
250
335
echo Versions:
251
- if [[ $USE_GMP = " gmp" ]]; then
252
- echo GMP: $GMPVER
336
+
337
+ if [ $SKIP_GMP = " yes" ]; then
338
+ echo GMP: skipped
253
339
else
254
- echo MPIR: $MPIRVER
340
+ if [[ $USE_GMP = " gmp" ]]; then
341
+ echo GMP: $GMPVER
342
+ else
343
+ echo MPIR: $MPIRVER
344
+ fi
255
345
fi
256
- echo MPFR: $MPFRVER
346
+
347
+ if [ $SKIP_MPFR = " yes" ]; then
348
+ echo MPFR: skipped
349
+ else
350
+ echo MPFR: $MPFRVER
351
+ fi
352
+
257
353
echo Flint: $FLINTVER
258
- echo Arb: $ARBVER
354
+
355
+ if [ $BUILD_ARB = " yes" ]; then
356
+ echo Arb: $ARBVER
357
+ fi
259
358
echo
260
359
echo -----------------------------------------------------------------------
261
360
echo
0 commit comments