Skip to content
Draft
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
25 changes: 25 additions & 0 deletions .github/workflows/buildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ jobs:
with:
path: wheelhouse/*.whl

windows_wheels:
name: Build wheels for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]

steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-cc patch m4 lzip curl tar make diffutils unzip
- uses: actions/checkout@v3
- name: Checkout ARB repo
uses: actions/checkout@v3
with:
repository: fredrik-johansson/arb
path: arb
- name: Build Dependencies
shell: msys2 {0}
run: bin/cibw_before_build_windows.sh

test_wheels:
needs: build_wheels
name: Test ${{ matrix.python-version }} wheel on ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion bin/build_dependencies_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if [ $USE_GMP = "gmp" ]; then
--enable-fat\
--enable-shared=yes\
--enable-static=no\
--host=$HOSTARG
--host=$HOST_ARG
make -j3
make install
cd ..
Expand Down
214 changes: 214 additions & 0 deletions bin/build_dependencies_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
#!/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] [--with-pic]"
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
;;
--pic)
WITH_PIC="--with-pic"
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
# Show the output of configfsf.guess
./configfsf.guess
./configure --prefix=$PREFIX\
--enable-fat\
--enable-shared=yes\
--enable-static=no\
--host=$HOST_ARG\
$WITH_PIC
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://ftp.gnu.org/gnu/mpfr/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\
--host=$HOST_ARG\
$WITH_PIC
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 $GITHUB_WORKSPACE/arb
./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

6 changes: 6 additions & 0 deletions bin/cibw_before_build_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

bin/build_dependencies_windows.sh\
--gmp gmp\
--host x86_64-pc-mingw64\
--pic
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from distutils.sysconfig import get_config_vars

if sys.platform == 'win32':
libraries = ["arb", "flint", "mpir", "mpfr", "pthreads"]
libraries = ["arb", "flint", "gmp", "mpfr"]
else:
libraries = ["arb", "flint"]
(opt,) = get_config_vars('OPT')
Expand Down