@@ -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,60 @@ 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
+ # This patch is no longer needed for GMP 6.3.0.
159
+ #
160
+ if [ $PATCH_GMP_ARM64 = " yes" ]; then
161
+ echo
162
+ echo --------------------------------------------
163
+ echo " patching GMP"
164
+ echo --------------------------------------------
165
+ patch -N -Z -p0 < ../../../bin/patch-arm64.diff
166
+ fi
99
167
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
168
+ # Show the output of configfsf.guess
169
+ chmod +x configfsf.guess
170
+ ./configfsf.guess
113
171
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= $HOST_ARG
122
- make -j3
123
- make install
124
- cd ..
172
+ ./configure --prefix= $PREFIX \
173
+ --enable-fat\
174
+ --enable-shared=yes\
175
+ --enable-static=no \
176
+ --host= $HOST_ARG
177
+ make -j3
178
+ make install
179
+
180
+ cd ..
181
+
182
+ fi
125
183
126
184
FLINTARB_WITHGMP=" --with-gmp=$PREFIX "
127
185
182
240
# #
183
241
# ------------------------------------------------------------------------- #
184
242
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 ..
243
+ if [ $SKIP_MPFR = " yes" ]; then
244
+ echo
245
+ echo --------------------------------------------
246
+ echo " skipping MPFR"
247
+ echo --------------------------------------------
248
+ echo
249
+ else
250
+ echo
251
+ echo --------------------------------------------
252
+ echo " building MPFR"
253
+ echo --------------------------------------------
254
+ echo
255
+
256
+ curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER .tar.gz
257
+ tar xf mpfr-$MPFRVER .tar.gz
258
+ cd mpfr-$MPFRVER
259
+ ./configure --prefix=$PREFIX \
260
+ --with-gmp=$PREFIX \
261
+ --enable-shared=yes\
262
+ --enable-static=no
263
+ make -j3
264
+ make install
265
+ cd ..
266
+ fi
195
267
196
268
# ------------------------------------------------------------------------- #
197
269
# #
198
270
# FLINT #
199
271
# #
200
272
# ------------------------------------------------------------------------- #
201
273
274
+ echo
275
+ echo --------------------------------------------
276
+ echo " building Flint"
277
+ echo --------------------------------------------
278
+ echo
279
+
202
280
curl -O -L https://www.flintlib.org/flint-$FLINTVER .tar.gz
203
281
tar xf flint-$FLINTVER .tar.gz
204
282
cd flint-$FLINTVER
283
+ ./bootstrap.sh
205
284
./configure --prefix=$PREFIX \
206
285
$FLINTARB_WITHGMP \
207
286
--with-mpfr=$PREFIX \
@@ -216,25 +295,34 @@ cd ..
216
295
# #
217
296
# ------------------------------------------------------------------------- #
218
297
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
- # Skip Arb tests now because they are slow.
236
- # make check
237
- cd ..
298
+ if [ $BUILD_ARB = " yes" ]; then
299
+
300
+ echo
301
+ echo --------------------------------------------
302
+ echo " building Arb"
303
+ echo --------------------------------------------
304
+ echo
305
+
306
+ curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER .tar.gz
307
+ mv $ARBVER .tar.gz arb-$ARBVER .tar.gz
308
+ tar xf arb-$ARBVER .tar.gz
309
+ cd arb-$ARBVER
310
+ ./configure --prefix=$PREFIX \
311
+ --with-flint=$PREFIX \
312
+ $FLINTARB_WITHGMP \
313
+ --with-mpfr=$PREFIX \
314
+ --disable-static
315
+ make -j3
316
+ make install
317
+ #
318
+ # Set PATH so that DLLs are picked up on Windows.
319
+ #
320
+ PATH=$PATH :$PREFIX /lib:$PREFIX /bin \
321
+ ARB_TEST_MULTIPLIER=0.1 \
322
+ # Skip Arb tests now because they are slow.
323
+ # make check
324
+ cd ..
325
+ fi
238
326
239
327
# ------------------------------------------------------------------------- #
240
328
# #
@@ -249,14 +337,28 @@ echo Build dependencies for python-flint compiled as shared libraries in:
249
337
echo $PREFIX
250
338
echo
251
339
echo Versions:
252
- if [[ $USE_GMP = " gmp" ]]; then
253
- echo GMP: $GMPVER
340
+
341
+ if [ $SKIP_GMP = " yes" ]; then
342
+ echo GMP: skipped
254
343
else
255
- echo MPIR: $MPIRVER
344
+ if [[ $USE_GMP = " gmp" ]]; then
345
+ echo GMP: $GMPVER
346
+ else
347
+ echo MPIR: $MPIRVER
348
+ fi
256
349
fi
257
- echo MPFR: $MPFRVER
350
+
351
+ if [ $SKIP_MPFR = " yes" ]; then
352
+ echo MPFR: skipped
353
+ else
354
+ echo MPFR: $MPFRVER
355
+ fi
356
+
258
357
echo Flint: $FLINTVER
259
- echo Arb: $ARBVER
358
+
359
+ if [ $BUILD_ARB = " yes" ]; then
360
+ echo Arb: $ARBVER
361
+ fi
260
362
echo
261
363
echo -----------------------------------------------------------------------
262
364
echo
0 commit comments