Skip to content

Commit edf6dae

Browse files
committed
Bump flint to 3.0.0-alpha1
1 parent 027dd1f commit edf6dae

File tree

4 files changed

+199
-97
lines changed

4 files changed

+199
-97
lines changed

bin/build_dependencies_unix.sh

Lines changed: 169 additions & 70 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
4471
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
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
;;
@@ -86,42 +126,58 @@ if [ $USE_GMP = "gmp" ]; then
86126
# #
87127
# ----------------------------------------------------------------------- #
88128

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
93135
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
96149

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
99168

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 ..
113179

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
125181

126182
FLINTARB_WITHGMP="--with-gmp=$PREFIX"
127183

@@ -182,26 +238,47 @@ fi
182238
# #
183239
# ------------------------------------------------------------------------- #
184240

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
195265

196266
# ------------------------------------------------------------------------- #
197267
# #
198268
# FLINT #
199269
# #
200270
# ------------------------------------------------------------------------- #
201271

272+
echo
273+
echo --------------------------------------------
274+
echo " building Flint"
275+
echo --------------------------------------------
276+
echo
277+
202278
curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz
203279
tar xf flint-$FLINTVER.tar.gz
204280
cd flint-$FLINTVER
281+
./bootstrap.sh
205282
./configure --prefix=$PREFIX\
206283
$FLINTARB_WITHGMP\
207284
--with-mpfr=$PREFIX\
@@ -216,24 +293,32 @@ cd ..
216293
# #
217294
# ------------------------------------------------------------------------- #
218295

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
237322

238323
# ------------------------------------------------------------------------- #
239324
# #
@@ -248,14 +333,28 @@ echo Build dependencies for python-flint compiled as shared libraries in:
248333
echo $PREFIX
249334
echo
250335
echo Versions:
251-
if [[ $USE_GMP = "gmp" ]]; then
252-
echo GMP: $GMPVER
336+
337+
if [ $SKIP_GMP = "yes" ]; then
338+
echo GMP: skipped
253339
else
254-
echo MPIR: $MPIRVER
340+
if [[ $USE_GMP = "gmp" ]]; then
341+
echo GMP: $GMPVER
342+
else
343+
echo MPIR: $MPIRVER
344+
fi
255345
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+
257353
echo Flint: $FLINTVER
258-
echo Arb: $ARBVER
354+
355+
if [ $BUILD_ARB = "yes" ]; then
356+
echo Arb: $ARBVER
357+
fi
259358
echo
260359
echo -----------------------------------------------------------------------
261360
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.3.0
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)