Skip to content

Commit

Permalink
wheels: don't build cp312 and fix macos wheels
Browse files Browse the repository at this point in the history
Python 3.12 does not work.
For macOS, don't copy libs to /usr/local
And other minor cleanups.
  • Loading branch information
jdavid committed Sep 6, 2023
1 parent 2a366da commit 2fb8dcc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ jobs:
if: runner.os == 'macOS'
run: |
export OPENSSL_PREFIX=`brew --prefix openssl@1.1`
export LIBSSH2_PREFIX=`brew --prefix libssh2`
export LIBGIT2_VERSION=1.7.1
/bin/sh build.sh test
LIBSSH2_VERSION=1.11.0 LIBGIT2_VERSION=1.7.1 /bin/sh build.sh test
aarch64:
runs-on: ubuntu-22.04
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_ALL: sh build.sh
CIBW_ENVIRONMENT: LIBGIT2_VERSION=1.7.1 LIBSSH2_VERSION=1.11.0 OPENSSL_VERSION=3.0.9 LIBGIT2=/project/ci
CIBW_ENVIRONMENT_MACOS: LIBGIT2_VERSION=1.7.1 LIBSSH2_VERSION=1.11.0 OPENSSL_VERSION=3.0.9 DYLD_LIBRARY_PATH=/usr/local/lib
CIBW_SKIP: "*-musllinux* *pypy*"
CIBW_ENVIRONMENT: LIBGIT2_VERSION=1.7.1 LIBSSH2_VERSION=1.11.0 OPENSSL_VERSION=3.1.2 LIBGIT2=/project/ci
CIBW_ENVIRONMENT_MACOS: LIBGIT2_VERSION=1.7.1 LIBSSH2_VERSION=1.11.0 OPENSSL_VERSION=3.1.2 LIBGIT2=/Users/runner/work/pygit2/pygit2/ci
CIBW_SKIP: "*musl* pp3* cp312*"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "LD_LIBRARY_PATH=/project/ci/lib64 auditwheel repair -w {dest_dir} {wheel}"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "DYLD_LIBRARY_PATH=/Users/runner/work/pygit2/pygit2/ci/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
CIBW_ARCHS_MACOS: universal2
CIBW_ARCHS_LINUX: x86_64 aarch64

- uses: actions/upload-artifact@v3
Expand Down
27 changes: 9 additions & 18 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@
#
# AUDITWHEEL_PLAT - Linux platform for auditwheel repair
# LIBSSH2_OPENSSL - Where to find openssl
# LIBSSH2_PREFIX - Where to find libssh2
# LIBSSH2_VERSION=<Version> - Build the given version of libssh2
# LIBGIT2_VERSION=<Version> - Build the given version of libgit2
# OPENSSL_VERSION=<Version> - Build the given version of OpenSSL
# (only needed for Mac universal on CI)
#
# Either use LIBSSH2_PREFIX, or LIBSSH2_VERSION, or none (if libssh2 is already
# in the path, or if you don't want to use it).
#
# Examples.
#
# Build inplace, libgit2 must be available in the path:
Expand All @@ -35,11 +31,6 @@
#
# LIBSSH2_VERSION=1.11.0 LIBGIT2_VERSION=1.7.1 sh build.sh
#
# Tell where libssh2 is installed, build libgit2 1.7.1, then build pygit2
# inplace:
#
# LIBSSH2_PREFIX=/usr/local LIBGIT2_VERSION=1.7.1 sh build.sh
#
# Build inplace and run the tests:
#
# sh build.sh test
Expand Down Expand Up @@ -170,7 +161,6 @@ if [ -n "$LIBSSH2_VERSION" ]; then
fi
cmake --build . --target install
cd ..
LIBSSH2_PREFIX=$PREFIX
USE_SSH=ON
else
USE_SSH=OFF
Expand All @@ -185,18 +175,19 @@ if [ -n "$LIBGIT2_VERSION" ]; then
mkdir build -p
cd build
if [ "$KERNEL" = "Darwin" ] && [ "$CIBUILDWHEEL" = "1" ]; then
CMAKE_PREFIX_PATH=$OPENSSL_PREFIX:$LIBSSH2_PREFIX cmake .. \
CMAKE_PREFIX_PATH=$OPENSSL_PREFIX:$PREFIX cmake .. \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DOPENSSL_CRYPTO_LIBRARY="../openssl-universal/$LIBCRYPTO" \
-DOPENSSL_SSL_LIBRARY="../openssl-universal/$LIBSSL" \
-DOPENSSL_INCLUDE_DIR="../openssl-x86/include" \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DUSE_SSH=$USE_SSH
else
export CFLAGS=-I$PREFIX/include
CMAKE_PREFIX_PATH=$OPENSSL_PREFIX:$LIBSSH2_PREFIX cmake .. \
CMAKE_PREFIX_PATH=$OPENSSL_PREFIX:$PREFIX cmake .. \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
Expand All @@ -211,12 +202,12 @@ fi

if [ "$CIBUILDWHEEL" = "1" ]; then
if [ "$KERNEL" = "Darwin" ]; then
# Copy libraries where delocate-wheel can find them.
# In Linux we use LD_LIBRARY_PATH to avoid this, maybe
# DYLD_LIBRARY_PATH would work for macOS.
cp -r $OPENSSL_PREFIX/*.dylib /usr/local/lib
cp -r $LIBSSH2_PREFIX/lib/*.dylib /usr/local/lib
cp -r $FILENAME/build/*.dylib /usr/local/lib
cp $OPENSSL_PREFIX/*.dylib $PREFIX/lib/
cp $OPENSSL_PREFIX/*.dylib $PREFIX/lib/
echo "PREFIX " $PREFIX
echo "OPENSSL_PREFIX" $OPENSSL_PREFIX
ls -l /Users/runner/work/pygit2/pygit2/ci/
ls -l $PREFIX/lib
fi
# we're done building dependencies, cibuildwheel action will take over
exit 0
Expand Down

0 comments on commit 2fb8dcc

Please sign in to comment.