@@ -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
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
44
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
;;
@@ -82,36 +122,51 @@ if [ $USE_GMP = "gmp" ]; then
82
122
# #
83
123
# ----------------------------------------------------------------------- #
84
124
85
- curl -O https://gmplib.org/download/gmp/gmp-$GMPVER .tar.xz
86
- tar xf gmp-$GMPVER .tar.xz
87
- cd gmp-$GMPVER
125
+ if [ $SKIP_GMP = " yes" ]; then
126
+ echo
127
+ echo --------------------------------------------
128
+ echo " skipping GMP"
129
+ echo --------------------------------------------
130
+ echo
131
+ else
132
+ echo
133
+ echo --------------------------------------------
134
+ echo " building GMP"
135
+ echo --------------------------------------------
136
+ echo
88
137
89
- #
90
- # See https://github.com/aleaxit/gmpy/issues/350
91
- #
92
- # We need to patch GMP for OSX arm64 (Apple M1) hardware. This patch is
93
- # from the GMP repo but was applied after the release of GMP 6.2.1.
94
- # Hopefully when a newer version of GMP is released we will not need to
95
- # apply this patch any more.
96
- #
97
- if [ $PATCH_GMP_ARM64 = " yes" ]; then
98
- echo
99
- echo --------------------------------------------
100
- echo " patching GMP"
101
- echo --------------------------------------------
102
- patch -N -Z -p0 < ../../../bin/patch-arm64.diff
103
- fi
104
-
105
- # Show the output of configfsf.guess
106
- ./configfsf.guess
107
- ./configure --prefix=$PREFIX \
108
- --enable-fat\
109
- --enable-shared=yes\
110
- --enable-static=no\
111
- --host=$HOSTARG
112
- make -j3
113
- make install
114
- cd ..
138
+ curl -O https://gmplib.org/download/gmp/gmp-$GMPVER .tar.xz
139
+ tar xf gmp-$GMPVER .tar.xz
140
+ cd gmp-$GMPVER
141
+
142
+ #
143
+ # See https://github.com/aleaxit/gmpy/issues/350
144
+ #
145
+ # We need to patch GMP for OSX arm64 (Apple M1) hardware. This patch is
146
+ # from the GMP repo but was applied after the release of GMP 6.2.1.
147
+ # Hopefully when a newer version of GMP is released we will not need to
148
+ # apply this patch any more.
149
+ #
150
+ if [ $PATCH_GMP_ARM64 = " yes" ]; then
151
+ echo
152
+ echo --------------------------------------------
153
+ echo " patching GMP"
154
+ echo --------------------------------------------
155
+ patch -N -Z -p0 < ../../../bin/patch-arm64.diff
156
+ fi
157
+
158
+ # Show the output of configfsf.guess
159
+ ./configfsf.guess
160
+ ./configure --prefix=$PREFIX \
161
+ --enable-fat\
162
+ --enable-shared=yes\
163
+ --enable-static=no\
164
+ --host=$HOSTARG
165
+ make -j3
166
+ make install
167
+ cd ..
168
+
169
+ fi
115
170
116
171
FLINTARB_WITHGMP=" --with-gmp=$PREFIX "
117
172
172
227
# #
173
228
# ------------------------------------------------------------------------- #
174
229
175
- curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER .tar.gz
176
- tar xf mpfr-$MPFRVER .tar.gz
177
- cd mpfr-$MPFRVER
178
- ./configure --prefix=$PREFIX \
179
- --with-gmp=$PREFIX \
180
- --enable-shared=yes\
181
- --enable-static=no
182
- make -j3
183
- make install
184
- cd ..
230
+ if [ $SKIP_MPFR = " yes" ]; then
231
+ echo
232
+ echo --------------------------------------------
233
+ echo " skipping MPFR"
234
+ echo --------------------------------------------
235
+ echo
236
+ else
237
+ echo
238
+ echo --------------------------------------------
239
+ echo " building MPFR"
240
+ echo --------------------------------------------
241
+ echo
242
+
243
+ curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER .tar.gz
244
+ tar xf mpfr-$MPFRVER .tar.gz
245
+ cd mpfr-$MPFRVER
246
+ ./configure --prefix=$PREFIX \
247
+ --with-gmp=$PREFIX \
248
+ --enable-shared=yes\
249
+ --enable-static=no
250
+ make -j3
251
+ make install
252
+ cd ..
253
+ fi
185
254
186
255
# ------------------------------------------------------------------------- #
187
256
# #
188
257
# FLINT #
189
258
# #
190
259
# ------------------------------------------------------------------------- #
191
260
261
+ echo
262
+ echo --------------------------------------------
263
+ echo " building Flint"
264
+ echo --------------------------------------------
265
+ echo
266
+
192
267
curl -O -L https://www.flintlib.org/flint-$FLINTVER .tar.gz
193
268
tar xf flint-$FLINTVER .tar.gz
194
269
cd flint-$FLINTVER
270
+ ./bootstrap.sh
195
271
./configure --prefix=$PREFIX \
196
272
$FLINTARB_WITHGMP \
197
273
--with-mpfr=$PREFIX \
@@ -206,24 +282,32 @@ cd ..
206
282
# #
207
283
# ------------------------------------------------------------------------- #
208
284
209
- curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER .tar.gz
210
- mv $ARBVER .tar.gz arb-$ARBVER .tar.gz
211
- tar xf arb-$ARBVER .tar.gz
212
- cd arb-$ARBVER
213
- ./configure --prefix=$PREFIX \
214
- --with-flint=$PREFIX \
215
- $FLINTARB_WITHGMP \
216
- --with-mpfr=$PREFIX \
217
- --disable-static
218
- make -j3
219
- make install
220
- #
221
- # Set PATH so that DLLs are picked up on Windows.
222
- #
223
- PATH=$PATH :$PREFIX /lib:$PREFIX /bin \
224
- ARB_TEST_MULTIPLIER=0.1 \
225
- make check
226
- cd ..
285
+ echo
286
+ echo --------------------------------------------
287
+ echo " building Arb"
288
+ echo --------------------------------------------
289
+ echo
290
+
291
+ if [ $BUILD_ARB = " yes" ]; then
292
+ curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER .tar.gz
293
+ mv $ARBVER .tar.gz arb-$ARBVER .tar.gz
294
+ tar xf arb-$ARBVER .tar.gz
295
+ cd arb-$ARBVER
296
+ ./configure --prefix=$PREFIX \
297
+ --with-flint=$PREFIX \
298
+ $FLINTARB_WITHGMP \
299
+ --with-mpfr=$PREFIX \
300
+ --disable-static
301
+ make -j3
302
+ make install
303
+ #
304
+ # Set PATH so that DLLs are picked up on Windows.
305
+ #
306
+ PATH=$PATH :$PREFIX /lib:$PREFIX /bin \
307
+ ARB_TEST_MULTIPLIER=0.1 \
308
+ make check
309
+ cd ..
310
+ fi
227
311
228
312
# ------------------------------------------------------------------------- #
229
313
# #
@@ -238,14 +322,28 @@ echo Build dependencies for python-flint compiled as shared libraries in:
238
322
echo $PREFIX
239
323
echo
240
324
echo Versions:
241
- if [[ $USE_GMP = " gmp" ]]; then
242
- echo GMP: $GMPVER
325
+
326
+ if [ $SKIP_GMP = " yes" ]; then
327
+ echo GMP: skipped
243
328
else
244
- echo MPIR: $MPIRVER
329
+ if [[ $USE_GMP = " gmp" ]]; then
330
+ echo GMP: $GMPVER
331
+ else
332
+ echo MPIR: $MPIRVER
333
+ fi
245
334
fi
246
- echo MPFR: $MPFRVER
335
+
336
+ if [ $SKIP_MPFR = " yes" ]; then
337
+ echo MPFR: skipped
338
+ else
339
+ echo MPFR: $MPFRVER
340
+ fi
341
+
247
342
echo Flint: $FLINTVER
248
- echo Arb: $ARBVER
343
+
344
+ if [ $BUILD_ARB = " yes" ]; then
345
+ echo Arb: $ARBVER
346
+ fi
249
347
echo
250
348
echo -----------------------------------------------------------------------
251
349
echo
0 commit comments