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
14 changes: 2 additions & 12 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,10 @@ build:
- libgmp-dev
- build-essential
- pkg-config
- curl
jobs:
pre_create_environment:
- |
PREFIX=$(pwd)/.local
ZZ_VERSION=0.9.0a4
ZZ_DIR=zz-${ZZ_VERSION}
GITHUB_URL=https://github.com/diofant/zz/releases/download/
ZZ_URL=${GITHUB_URL}v${ZZ_VERSION}/${ZZ_DIR}.tar.gz
wget ${ZZ_URL}
tar xzf ${ZZ_DIR}.tar.gz
cd ${ZZ_DIR}
./configure -q --prefix=$PREFIX
make -s
make -s install
- sh scripts/cibw_before_all.sh --skip-gmp
tools:
python: "3"
python:
Expand Down
134 changes: 88 additions & 46 deletions scripts/cibw_before_all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e -x
set -o errexit

PREFIX=${PREFIX:-"$(pwd)/.local"}
CFLAGS=
Expand All @@ -14,46 +14,100 @@ download () {
sleep_ivl=$((${sleep_ivl}*2))
done
}
genlib () {
# -- generate *.lib files from *.dll on M$ Windows --
cd .local/bin/
dll_file=$1
lib_name=$(basename -s .dll ${dll_file})
name=$(echo ${lib_name}|sed 's/^lib//;s/-[0-9]\+//')

gendef ${dll_file}
dlltool -d ${lib_name}.def -l ${name}.lib

cp ${name}.lib ../lib/
cp ${dll_file} ../lib/
cd ../../
}

GMP_VERSION=6.3.0
GMP_DIR=gmp-${GMP_VERSION}
GMP_URL=https://ftp.gnu.org/gnu/gmp/${GMP_DIR}.tar.xz

download ${GMP_URL}
tar --extract --file ${GMP_DIR}.tar.xz
cd ${GMP_DIR}
SKIP_GMP=no

for f in ../scripts/*.diff
while [ $# -gt 0 ]
do
patch --strip 1 < $f
key="$1"
case $key in
-h|--help)
echo "scripts/cibw_before_all.sh [options]"
echo
echo "Build local installs of python-gmp's dependencies."
echo
echo "Supported options:"
echo " --help - show this help message"
echo " --skip-gmp - skip building GMP"
echo
exit
;;
--skip-gmp)
# If you already have a local install of GMP you can pass --skip-gmp
# to skip building it.
SKIP_GMP=yes
shift
;;
*)
2>&1 echo "unrecognised argument:" $key
exit 1
;;
esac
done

CONFIG_ARGS="--enable-shared --disable-static --with-pic --disable-alloca --prefix=$PREFIX"
if [ "$OSTYPE" = "cygwin" ]
set -o xtrace

if [ $SKIP_GMP = "no" ]
then
if [ "${RUNNER_ARCH}" = "ARM64" ]
GMP_VERSION=6.3.0
GMP_DIR=gmp-${GMP_VERSION}
GMP_URL=https://ftp.gnu.org/gnu/gmp/${GMP_DIR}.tar.xz

download ${GMP_URL}
tar --extract --file ${GMP_DIR}.tar.xz
cd ${GMP_DIR}

for f in ../scripts/*.diff
do
patch --strip 1 < $f
done

CONFIG_ARGS="--enable-shared --disable-static --with-pic --disable-alloca --prefix=$PREFIX"
if [ "$OSTYPE" = "cygwin" ]
then
autoreconf -fi
CONFIG_ARGS="${CONFIG_ARGS} --disable-assembly"
if [ "${RUNNER_ARCH}" = "ARM64" ]
then
autoreconf -fi
CONFIG_ARGS="${CONFIG_ARGS} --disable-assembly"
else
CONFIG_ARGS="${CONFIG_ARGS} --enable-fat"
fi
else
CONFIG_ARGS="${CONFIG_ARGS} --enable-fat"
fi
else
CONFIG_ARGS="${CONFIG_ARGS} --enable-fat"
fi

# config.guess uses microarchitecture and configfsf.guess doesn't
# We replace config.guess with configfsf.guess to avoid microarchitecture
# specific code in common code.
rm config.guess && mv configfsf.guess config.guess && chmod +x config.guess
# config.guess uses microarchitecture and configfsf.guess doesn't
# We replace config.guess with configfsf.guess to avoid microarchitecture
# specific code in common code.
rm config.guess && mv configfsf.guess config.guess && chmod +x config.guess

./configure ${CONFIG_ARGS}
./configure ${CONFIG_ARGS}

make --silent all install
make --silent all install

cd ..
cd ..

ZZ_VERSION=0.9.0a4
if [ "$OSTYPE" = "cygwin" ]
then
genlib libgmp-10.dll
fi
fi

ZZ_VERSION=0.9.0a5
ZZ_DIR=zz-${ZZ_VERSION}
ZZ_URL=https://github.com/diofant/zz/releases/download/v${ZZ_VERSION}/${ZZ_DIR}.tar.gz

Expand All @@ -66,31 +120,19 @@ then
autoreconf -if
fi

./configure --enable-shared \
--disable-static \
--with-pic \
--with-gmp=$PREFIX \
--prefix=$PREFIX
CONFIG_ARGS="--enable-shared --disable-static --with-pic --prefix=$PREFIX"
if [ $SKIP_GMP = "no" ]
then
CONFIG_ARGS="${CONFIG_ARGS} --with-gmp=$PREFIX"
fi

./configure ${CONFIG_ARGS}

make --silent all install

cd ../

# -- generate *.lib files from *.dll on M$ Windows --
if [ "$OSTYPE" = "cygwin" ]
then
cd .local/bin
for dll_file in libgmp-10.dll libzz-0.dll
do
lib_name=$(basename -s .dll ${dll_file})
name=$(echo ${lib_name}|sed 's/^lib//;s/-[0-9]\+//')

gendef ${dll_file}
dlltool -d ${lib_name}.def -l ${name}.lib

cp ${name}.lib ../lib/
cp ${dll_file} ../lib/
done
genlib libzz-0.dll
fi

cd ../..
Loading