Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 0 additions & 66 deletions bin/build_dependencies.sh

This file was deleted.

203 changes: 203 additions & 0 deletions bin/build_dependencies_unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
#!/usr/bin/env bash
#
# Build local installs of python-flint's dependencies. This should be run
# before attempting to build python-flint itself.

set -o errexit

# ------------------------------------------------------------------------- #
# #
# Supported options: #
# #
# --gmp gmp - build based on GMP (default) #
# --gmp mpir - build based on MPIR (instead of GMP) #
# #
# ------------------------------------------------------------------------- #

USE_GMP=gmp

while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
echo "bin/download_dependencies.sh [--gmp gmp|mpir] [--host HOST]"
exit
;;
--gmp)
# e.g. --gmp gmp or --gmp mpir
USE_GMP="$2"
if [[ "$USE_GMP" != "gmp" && "$USE_GMP" != "mpir" ]]; then
echo "--gmp option should be gmp or mpir"
exit 1
fi
shift
shift
;;
--host)
# e.g. --host x86_64-unknown-linux-gnu
# or --host x86_64-apple-darwin
HOST_ARG="$2"
shift
shift
;;
esac
done

# ------------------------------------------------------------------------- #
# #
# The build_variables.sh script sets variables specifying the versions to #
# use for all dependencies and also the PREFIX variable. #
# #
# ------------------------------------------------------------------------- #

source bin/build_variables.sh

cd $PREFIX
mkdir -p src
cd src

# ------------------------------------------------------------------------- #
# #
# Now build all dependencies. #
# #
# ------------------------------------------------------------------------- #

if [ $USE_GMP = "gmp" ]; then

# ----------------------------------------------------------------------- #
# #
# GMP #
# #
# ----------------------------------------------------------------------- #

curl -O https://gmplib.org/download/gmp/gmp-$GMPVER.tar.xz
tar xf gmp-$GMPVER.tar.xz
cd gmp-$GMPVER
./configure --prefix=$PREFIX\
--enable-fat\
--enable-shared=yes\
--enable-static=no\
--host=$HOSTARG
make -j3
make install
cd ..

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

else

# ----------------------------------------------------------------------- #
# #
# YASM (needed to build MPIR) #
# #
# ----------------------------------------------------------------------- #

curl -O http://www.tortall.net/projects/yasm/releases/yasm-$YASMVER.tar.gz
tar xf yasm-$YASMVER.tar.gz
cd yasm-$YASMVER
./configure --prefix=$PREFIX
make -j3
make install
cd ..

# ----------------------------------------------------------------------- #
# #
# MPIR #
# #
# ----------------------------------------------------------------------- #

curl -O http://mpir.org/mpir-$MPIRVER.tar.bz2
tar xf mpir-$MPIRVER.tar.bz2
cd mpir-$MPIRVER
./configure --prefix=$PREFIX\
--with-yasm=$PREFIX/bin/yasm\
--enable-fat\
--enable-shared=yes\
--enable-static=no\
--enable-gmpcompat
make -j3
make install
cd ..

FLINTARB_WITHGMP="--with-mpir=$PREFIX"

fi

# ------------------------------------------------------------------------- #
# #
# MPFR #
# #
# ------------------------------------------------------------------------- #

curl -O https://www.mpfr.org/mpfr-current/mpfr-$MPFRVER.tar.gz
tar xf mpfr-$MPFRVER.tar.gz
cd mpfr-$MPFRVER
./configure --prefix=$PREFIX\
--with-gmp=$PREFIX\
--enable-shared=yes\
--enable-static=no
make -j3
make install
cd ..

# ------------------------------------------------------------------------- #
# #
# FLINT #
# #
# ------------------------------------------------------------------------- #

curl -O https://www.flintlib.org/flint-$FLINTVER.tar.gz
tar xf flint-$FLINTVER.tar.gz
cd flint-$FLINTVER
./configure --prefix=$PREFIX\
$FLINTARB_WITHGMP\
--with-mpfr=$PREFIX\
--disable-static
make -j3
make install
cd ..

# ------------------------------------------------------------------------- #
# #
# ARB #
# #
# ------------------------------------------------------------------------- #

curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER.tar.gz
mv $ARBVER.tar.gz arb-$ARBVER.tar.gz
tar xf arb-$ARBVER.tar.gz
cd arb-$ARBVER
./configure --prefix=$PREFIX\
--with-flint=$PREFIX\
$FLINTARB_WITHGMP\
--with-mpfr=$PREFIX\
--disable-static
make -j3
make install
cd ..

# ------------------------------------------------------------------------- #
# #
# Done! #
# #
# ------------------------------------------------------------------------- #

echo
echo -----------------------------------------------------------------------
echo
echo Build dependencies for python-flint compiled as shared libraries in:
echo $PREFIX
echo
echo Versions:
if [[ $USE_GMP = "gmp" ]]; then
echo GMP: $GMPVER
else
echo MPIR: $MPIRVER
fi
echo MPFR: $MPFRVER
echo Flint: $FLINTVER
echo Arb: $ARBVER
echo
echo -----------------------------------------------------------------------
echo
2 changes: 2 additions & 0 deletions bin/build_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ PREFIX=$(pwd)/.local
mkdir -p $PREFIX

GMPVER=6.2.1
YASMVER=1.3.1
MPIRVER=3.0.0
MPFRVER=4.1.0
FLINTVER=2.7.1
ARBVER=2.19.0
4 changes: 2 additions & 2 deletions bin/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
#
# Compile a python-flint wheel using the dependencies built by
# build_dependencies.sh (which should be run first).
# build_dependencies_unix.sh (which should be run first).

set -o errexit

PYTHONFLINTVER=0.3.0

source bin/build_variables.sh

python -m venv $PREFIX/venv
python3 -m venv $PREFIX/venv
source $PREFIX/venv/bin/activate
pip install -U pip wheel delocate
pip install numpy cython==0.27.3
Expand Down
4 changes: 3 additions & 1 deletion bin/cibw_before_build_linux.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

yum install -y xz
bin/build_dependencies.sh
bin/build_dependencies_unix.sh\
--gmp gmp\
--host x86_64-unknown-linux-gnu
4 changes: 3 additions & 1 deletion bin/cibw_before_build_macosx.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

bin/build_dependencies.sh
bin/build_dependencies_unix.sh\
--gmp gmp\
--host x86_64-apple-darwin