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
33 changes: 20 additions & 13 deletions .github/workflows/os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@ jobs:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15-intel, macos-15]
shell: [bash]
msystem: [ucrt64]
menv: [ucrt-x86_64]
include:
- os: windows-2022
shell: 'msys2 {0}'
msystem: ucrt64
menv: ucrt-x86_64
- os: windows-11-arm
shell: 'msys2 {0}'
msystem: clangarm64
menv: clang-aarch64
defaults:
run:
shell: ${{ matrix.shell }}
env:
PYTEST_ADDOPTS: --verbose --hypothesis-profile=default
CFLAGS: -Wall -Wpedantic -Werror -std=c17 -Wconversion
# CFLAGS: -Wall -Wpedantic -Werror -std=c17 -Wconversion
MACOSX_DEPLOYMENT_TARGET: 10.15 # for 3.14
steps:
- uses: actions/checkout@v6
Expand All @@ -28,13 +36,16 @@ jobs:
- uses: msys2/setup-msys2@v2.29.0
with:
install: >-
mingw-w64-ucrt-x86_64-pkg-config
mingw-w64-ucrt-x86_64-gcc
mingw-w64-${{ matrix.menv }}-binutils
mingw-w64-${{ matrix.menv }}-gcc
mingw-w64-${{ matrix.menv }}-pkg-config
mingw-w64-${{ matrix.menv }}-tools
diffutils
m4
make
patch
msystem: ucrt64
autotools
msystem: ${{ matrix.msystem }}
path-type: inherit
if: ${{ startsWith(matrix.os, 'windows') }}
- name: Cache GNU GMP builds
Expand All @@ -43,19 +54,15 @@ jobs:
with:
path: .local
key: ${{ matrix.os }}-${{ hashFiles('scripts/*') }}
- run: bash scripts/cibw_before_all.sh
- run: sh scripts/cibw_before_all.sh
if: steps.cache-gmp.outputs.cache-hit != 'true'
- run: python -m pip install --upgrade pip
- run: |
# XXX: this is for M$ Windows, see msys2/setup-msys2#171
PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:$(pwd)/.local/lib/pkgconfig
pip --verbose wheel . -Csetup-args=-Dbuildtype=debug
export PKG_CONFIG_PATH=$(pwd)/.local/lib/pkgconfig
pip --verbose wheel . -Csetup-args=-Dbuildtype=debug -Csetup-args=--vsenv
# https://mesonbuild.com/meson-python/how-to-guides/shared-libraries
- run: |
# XXX: this is too, see
# https://mesonbuild.com/meson-python/how-to-guides/shared-libraries
PATH="$PATH:$(pwd)/.local/bin"
pip install delvewheel
delvewheel repair *.whl
delvewheel repair *.whl --add-path .local/bin
mv wheelhouse/*.whl .
if: ${{ startsWith(matrix.os, 'windows') }}
- run: |
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ jobs:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15-intel, macos-15,
windows-2022]
msystem: [ucrt64]
menv: [ucrt-x86_64]
include:
- os: windows-11-arm
msystem: clangarm64
menv: clang-aarch64
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -16,12 +22,15 @@ jobs:
name: Setup msys2
with:
install: >-
mingw-w64-ucrt-x86_64-gcc
mingw-w64-${{ matrix.menv }}-binutils
mingw-w64-${{ matrix.menv }}-gcc
mingw-w64-${{ matrix.menv }}-tools
diffutils
m4
make
patch
msystem: ucrt64
autotools
msystem: ${{ matrix.msystem }}
if: ${{ startsWith(matrix.os, 'windows') }}
# Install pkgconfig on Windows from choco rather than from msys and
# avoid using the Strawberry one.
Expand All @@ -30,7 +39,7 @@ jobs:
# We have to set this here rather than in the cibuildwheel config
# This is probably something to do with \ vs / in paths...
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV
if: ${{ startsWith( matrix.os , 'windows' ) }}
if: ${{ startsWith(matrix.os, 'windows') }}
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
- uses: actions/upload-artifact@v5
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ line-length = 79
select = ["E", "F", "I", "PT", "W", "Q", "SIM"]

[tool.cibuildwheel]
build-frontend = {name="build", args=["--verbose"]}
build-frontend = {name="build", args=["--verbose", "-Csetup-args=--vsenv"]}
enable = "pypy cpython-prerelease cpython-freethreading graalpy"
skip = """*-win32 gp311_242* *-manylinux_i686 *-musllinux_* \
*-manylinux_armv7l pp*aarch64* gp3*win*"""
Expand All @@ -86,5 +86,4 @@ repair-wheel-command = """delvewheel repair -w {dest_dir} {wheel} \
--add-path .local/bin"""

[tool.cibuildwheel.windows.environment]
PYTEST_ADDOPTS = "--verbose"
CFLAGS = "-Wall -Wpedantic -Werror -std=c17 -Wconversion"
CFLAGS = ""
56 changes: 45 additions & 11 deletions scripts/cibw_before_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ GMP_DIR=gmp-${GMP_VERSION}
GMP_URL=https://ftp.gnu.org/gnu/gmp/${GMP_DIR}.tar.xz
PREFIX="$(pwd)/.local/"
CFLAGS=
CURL_OPTS="--location --retry 3 --connect-timeout 30"

curl --retry 3 --silent --remote-name ${GMP_URL}
curl ${CURL_OPTS} --remote-name ${GMP_URL}
tar --extract --file ${GMP_DIR}.tar.xz
cd ${GMP_DIR}

Expand All @@ -17,18 +18,26 @@ do
patch --strip 1 < $f
done

CONFIG_ARGS="--enable-shared --disable-static --with-pic --disable-alloca --prefix=$PREFIX"
if [ "$OSTYPE" = "cygwin" ]
then
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

# 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 --enable-fat \
--enable-shared \
--disable-static \
--with-pic \
--disable-alloca \
--prefix=$PREFIX \
--quiet
./configure ${CONFIG_ARGS}

make --silent all install

Expand All @@ -38,15 +47,40 @@ ZZ_VERSION=0.6.1
ZZ_DIR=zz-${ZZ_VERSION}
ZZ_URL=https://github.com/diofant/zz/releases/download/v${ZZ_VERSION}/${ZZ_DIR}.tar.gz

curl --location --retry 3 --silent --remote-name ${ZZ_URL}
curl ${CURL_OPTS} --remote-name ${ZZ_URL}
tar --extract --file ${ZZ_DIR}.tar.gz
cd ${ZZ_DIR}

./configure --quiet \
--enable-shared \
if [ "$OSTYPE" = "cygwin" ] && [ "${RUNNER_ARCH}" = "ARM64" ]
then
autoreconf -if
fi

./configure --enable-shared \
--disable-static \
--with-pic \
--with-gmp=$PREFIX \
--prefix=$PREFIX

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
fi

cd ../..