Skip to content

Commit cd3c157

Browse files
committed
Bump flint to 3.0.0-alpha1
1 parent 69b4737 commit cd3c157

File tree

4 files changed

+195
-94
lines changed

4 files changed

+195
-94
lines changed

bin/build_dependencies_unix.sh

Lines changed: 165 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,46 @@ set -o errexit
1616
# #
1717
# ------------------------------------------------------------------------- #
1818

19+
SKIP_GMP=no
20+
SKIP_MPFR=no
21+
1922
USE_GMP=gmp
2023
PATCH_GMP_ARM64=no
24+
BUILD_ARB=no
2125

2226
while [[ $# -gt 0 ]]
2327
do
2428
key="$1"
2529
case $key in
2630
-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
2847
exit
2948
;;
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+
;;
3056
--gmp)
3157
# e.g. --gmp gmp or --gmp mpir
58+
# The mpir build no longer works because the download fails.
3259
USE_GMP="$2"
3360
if [[ "$USE_GMP" != "gmp" && "$USE_GMP" != "mpir" ]]; then
3461
echo "--gmp option should be gmp or mpir"
@@ -37,14 +64,27 @@ do
3764
shift
3865
shift
3966
;;
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
4477
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
4583
shift
4684
;;
4785
--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
4888
PATCH_GMP_ARM64=yes
4989
shift
5090
;;
@@ -82,36 +122,51 @@ if [ $USE_GMP = "gmp" ]; then
82122
# #
83123
# ----------------------------------------------------------------------- #
84124

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
88137

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
115170

116171
FLINTARB_WITHGMP="--with-gmp=$PREFIX"
117172

@@ -172,26 +227,47 @@ fi
172227
# #
173228
# ------------------------------------------------------------------------- #
174229

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
185254

186255
# ------------------------------------------------------------------------- #
187256
# #
188257
# FLINT #
189258
# #
190259
# ------------------------------------------------------------------------- #
191260

261+
echo
262+
echo --------------------------------------------
263+
echo " building Flint"
264+
echo --------------------------------------------
265+
echo
266+
192267
curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz
193268
tar xf flint-$FLINTVER.tar.gz
194269
cd flint-$FLINTVER
270+
./bootstrap.sh
195271
./configure --prefix=$PREFIX\
196272
$FLINTARB_WITHGMP\
197273
--with-mpfr=$PREFIX\
@@ -206,24 +282,32 @@ cd ..
206282
# #
207283
# ------------------------------------------------------------------------- #
208284

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
227311

228312
# ------------------------------------------------------------------------- #
229313
# #
@@ -238,14 +322,28 @@ echo Build dependencies for python-flint compiled as shared libraries in:
238322
echo $PREFIX
239323
echo
240324
echo Versions:
241-
if [[ $USE_GMP = "gmp" ]]; then
242-
echo GMP: $GMPVER
325+
326+
if [ $SKIP_GMP = "yes" ]; then
327+
echo GMP: skipped
243328
else
244-
echo MPIR: $MPIRVER
329+
if [[ $USE_GMP = "gmp" ]]; then
330+
echo GMP: $GMPVER
331+
else
332+
echo MPIR: $MPIRVER
333+
fi
245334
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+
247342
echo Flint: $FLINTVER
248-
echo Arb: $ARBVER
343+
344+
if [ $BUILD_ARB = "yes" ]; then
345+
echo Arb: $ARBVER
346+
fi
249347
echo
250348
echo -----------------------------------------------------------------------
251349
echo

bin/build_variables.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
PREFIX=$(pwd)/.local
1414
mkdir -p $PREFIX
1515

16+
ARBVER=2.23.0 # Not needed with flint >= 3.0.0 (Arb is included in flint)
17+
18+
YASMVER=1.3.0 # Only needed for MPIR
19+
MPIRVER=3.0.0 # MPIR build no longer works (not clear where to download from)
20+
21+
# These are the actual dependencies used (at least by default):
1622
GMPVER=6.2.1
17-
YASMVER=1.3.0
18-
MPIRVER=3.0.0
1923
MPFRVER=4.1.0
20-
FLINTVER=2.9.0
21-
ARBVER=2.23.0
24+
FLINTVER=3.0.0-alpha1

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# This is used in CI to build wheels with mingw64
1717
#
1818
if os.getenv('PYTHON_FLINT_MINGW64'):
19-
libraries = ["arb", "flint", "mpfr", "gmp"]
19+
libraries = ["flint", "mpfr", "gmp"]
2020
includedir = os.path.join(os.path.dirname(__file__), '.local', 'include')
2121
librarydir1 = os.path.join(os.path.dirname(__file__), '.local', 'bin')
2222
librarydir2 = os.path.join(os.path.dirname(__file__), '.local', 'lib')
@@ -29,12 +29,12 @@
2929
elif os.getenv('PYTHON_FLINT_MINGW64_TMP'):
3030
# This would be used to build under Windows against these libraries if
3131
# they have been installed somewhere other than .local
32-
libraries = ["arb", "flint", "mpfr", "gmp"]
32+
libraries = ["flint", "mpfr", "gmp"]
3333
else:
3434
# For the MSVC toolchain link with mpir instead of gmp
35-
libraries = ["arb", "flint", "mpir", "mpfr", "pthreads"]
35+
libraries = ["flint", "mpir", "mpfr", "pthreads"]
3636
else:
37-
libraries = ["arb", "flint"]
37+
libraries = ["flint"]
3838
(opt,) = get_config_vars('OPT')
3939
os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes')
4040

0 commit comments

Comments
 (0)