From 8e1290ddcc849824ec97e1d30159d40abe47a683 Mon Sep 17 00:00:00 2001 From: Peter Baumgartner Date: Fri, 9 Aug 2024 10:24:02 -0600 Subject: [PATCH 01/10] v2.0.26 --- uwsgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uwsgi b/uwsgi index 3a28185..578dfca 160000 --- a/uwsgi +++ b/uwsgi @@ -1 +1 @@ -Subproject commit 3a28185f9c23a16ed9495a099ca0fea0e28473ab +Subproject commit 578dfcab74e976227be44fa94980ab3abe4cbbc5 From 46497361f78a97e34227a2036fa8c350ea4e5667 Mon Sep 17 00:00:00 2001 From: Peter Baumgartner Date: Fri, 9 Aug 2024 10:26:44 -0600 Subject: [PATCH 02/10] Update to latest OS's and cibuildwheel --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a0ba90..b4d4e17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, macos-11] + os: [ubuntu-latest, macos-13, macos-14] fail-fast: false steps: @@ -68,7 +68,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.20.0 with: output-dir: dist package-dir: ./${{ needs.build_sdist.outputs.sdist_name }} From 71a1685c34121d80e74ea17194a4f0813e7f094b Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 9 Aug 2024 14:38:46 -0400 Subject: [PATCH 03/10] skip python 3.13 for now uwsgi 2.0.26 does not support python 3.13 yet --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4d4e17..bcc4d78 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,7 +80,7 @@ jobs: # CIBW_ARCHS_MACOS: x86_64 arm64 # tesing on emulated arm64 isn't supported for MacOS # CIBW_TEST_SKIP: "*-macosx_arm64" - CIBW_SKIP: cp36-* pp* + CIBW_SKIP: cp36-* cp313-* pp* CIBW_ENVIRONMENT: APPEND_VERSION="" UWSGI_PROFILE=pyuwsginossl CIBW_TEST_COMMAND: "pyuwsgi --help" CIBW_BEFORE_BUILD_MACOS: "find . -name '*.o' -delete && IS_MACOS=1 ./pre_build.sh" From 028b7c184991820d3cd786fd50d1125898b98321 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 9 Aug 2024 14:51:09 -0400 Subject: [PATCH 04/10] avoid double-running ci for branches within the repository --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bcc4d78..805351b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,11 @@ --- name: Build -on: [push, pull_request] +on: + push: + branches: [main, test-me-*] + tags: '*' + pull_request: jobs: build_sdist: From dd3d56c7b461b96beb1ada6163a1cf6b1be690f5 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 10 Aug 2024 13:55:06 -0400 Subject: [PATCH 05/10] support arm64 on macos --- .github/workflows/build.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 805351b..909d215 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,12 +39,17 @@ jobs: path: pre_build.sh build_wheels: - name: Build wheels for ${{ matrix.os }} + name: Build wheels for ${{ matrix.os }} ${{ matrix.arch }} needs: [build_sdist] runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-13, macos-14] + include: + - {os: ubuntu-latest, arch: aarch64} + - {os: ubuntu-latest, arch: i686} + - {os: ubuntu-latest, arch: x86_64} + - {os: macos-13, arch: x86_64} + - {os: macos-14, arch: arm64} fail-fast: false steps: @@ -66,7 +71,7 @@ jobs: chmod +x pre_build.sh - name: Set up QEMU - if: runner.os == 'Linux' + if: matrix.arch == 'aarch64' uses: docker/setup-qemu-action@v1 with: platforms: all @@ -77,13 +82,7 @@ jobs: output-dir: dist package-dir: ./${{ needs.build_sdist.outputs.sdist_name }} env: - CIBW_ARCHS_LINUX: auto aarch64 - CIBW_ARCHS_MACOS: x86_64 - # cross-compile for arm64 on macos isn't working yet - # https://github.com/lincolnloop/pyuwsgi-wheels/issues/18 - # CIBW_ARCHS_MACOS: x86_64 arm64 - # tesing on emulated arm64 isn't supported for MacOS - # CIBW_TEST_SKIP: "*-macosx_arm64" + CIBW_ARCHS: ${{ matrix.arch }} CIBW_SKIP: cp36-* cp313-* pp* CIBW_ENVIRONMENT: APPEND_VERSION="" UWSGI_PROFILE=pyuwsginossl CIBW_TEST_COMMAND: "pyuwsgi --help" From 67044402c85e3a1b88b2de9a860858cce45ad96c Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 10 Aug 2024 13:55:23 -0400 Subject: [PATCH 06/10] ensure linked shared objects on macos match target version --- pre_build.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pre_build.sh b/pre_build.sh index f69c88c..eb4a826 100755 --- a/pre_build.sh +++ b/pre_build.sh @@ -1,6 +1,18 @@ #!/bin/bash set -eu -o pipefail +if [ -n "${IS_MACOS:-}" ]; then + # make sure the linked binaries are equivalent to our target + python="$(command -v python)" + min_ver="$( + otool -l "$python" | + grep -A2 LC_VERSION_MIN_MACOSX | + tail -1 | + awk '{print $2}' + )" + export MACOSX_DEPLOYMENT_TARGET="$min_ver" +fi + JANSSON_HASH=6e85f42dabe49a7831dbdd6d30dca8a966956b51a9a50ed534b82afc3fa5b2f4 JANSSON_DOWNLOAD_URL=http://www.digip.org/jansson/releases JANSSON_ROOT=jansson-2.11 From 4cb50c4ce6406d2dbd4756c9e2141fd5b564d9d5 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 10 Aug 2024 14:08:06 -0400 Subject: [PATCH 07/10] use `sudo make install` for macos-14 --- pre_build.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pre_build.sh b/pre_build.sh index eb4a826..73e8c99 100755 --- a/pre_build.sh +++ b/pre_build.sh @@ -11,6 +11,9 @@ if [ -n "${IS_MACOS:-}" ]; then awk '{print $2}' )" export MACOSX_DEPLOYMENT_TARGET="$min_ver" + make_install=(sudo make install) +else + make_install=(make install) fi JANSSON_HASH=6e85f42dabe49a7831dbdd6d30dca8a966956b51a9a50ed534b82afc3fa5b2f4 @@ -45,7 +48,7 @@ function build_simple { (cd "$name_version" \ && ./configure --prefix="$BUILD_PREFIX" \ && make -j4 \ - && make install) + && "${make_install[@]}") touch "${name}-stamp" } function fetch_unpack { @@ -114,7 +117,7 @@ function build_jansson { (cd "${JANSSON_ROOT}" \ && ./configure --prefix="$BUILD_PREFIX" \ && make -j4 \ - && make install) + && "${make_install[@]}") touch jansson-stamp } From b90a9ca3f66f94e1f6cf92aaefb0b062f7a17fc7 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 10 Aug 2024 15:07:07 -0400 Subject: [PATCH 08/10] build pcre2 instead of old pcre --- pre_build.sh | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/pre_build.sh b/pre_build.sh index 73e8c99..b93d24e 100755 --- a/pre_build.sh +++ b/pre_build.sh @@ -20,10 +20,13 @@ JANSSON_HASH=6e85f42dabe49a7831dbdd6d30dca8a966956b51a9a50ed534b82afc3fa5b2f4 JANSSON_DOWNLOAD_URL=http://www.digip.org/jansson/releases JANSSON_ROOT=jansson-2.11 +PCRE2_HASH=86b9cb0aa3bcb7994faa88018292bc704cdbb708e785f7c74352ff6ea7d3175b +PCRE2_DOWNLOAD_URL=https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.gz +PCRE2_ROOT=pcre2-10.44 + # From Multibuild BUILD_PREFIX="${BUILD_PREFIX:-/usr/local}" MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}") -PCRE_VERSION="${PCRE_VERSION:-8.38}" function rm_mkdir { # Remove directory if present, then make directory local path=$1 @@ -31,26 +34,6 @@ function rm_mkdir { if [ -d "$path" ]; then rm -rf "$path"; fi mkdir "$path" } -function build_simple { - # Example: build_simple libpng $LIBPNG_VERSION \ - # https://download.sourceforge.net/libpng tar.gz - local name="$1" - local version="$2" - local url="$3" - local ext="${4:-tar.gz}" - echo "building $name@$version from $3" - if [ -e "${name}-stamp" ]; then - return - fi - local name_version="${name}-${version}" - local archive="${name_version}.${ext}" - fetch_unpack "$url/$archive" - (cd "$name_version" \ - && ./configure --prefix="$BUILD_PREFIX" \ - && make -j4 \ - && "${make_install[@]}") - touch "${name}-stamp" -} function fetch_unpack { # Fetch input archive name from input URL # Parameters @@ -89,8 +72,16 @@ function fetch_unpack { # ls -1d * && # rsync --delete -ah * ..) } -function build_pcre { - build_simple pcre "$PCRE_VERSION" https://s3.amazonaws.com/ll-share-public/pcre +function build_pcre2 { + if [ -e pcre2-stamp ]; then return; fi + echo "building pcre2 from $PCRE2_DOWNLOAD_URL" + fetch_unpack "${PCRE2_DOWNLOAD_URL}" + check_sha256sum "${ARCHIVES_SDIR:-archives}/${PCRE2_ROOT}.tar.gz" "$PCRE2_HASH" + (cd "${PCRE2_ROOT}" \ + && ./configure --prefix="$BUILD_PREFIX" \ + && make -j4 \ + && "${make_install[@]}") + touch pcre2-stamp } function check_sha256sum { @@ -122,7 +113,7 @@ function build_jansson { } function pre_build { - build_pcre + build_pcre2 #build_zlib build_jansson } From e91922626014d83b3b91a932ab09cc116a0df437 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 10 Aug 2024 15:17:48 -0400 Subject: [PATCH 09/10] skip cp38-macosx_arm64 python 3.8 does not build cleanly for arm64 on macos --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 909d215..060b097 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,7 +83,7 @@ jobs: package-dir: ./${{ needs.build_sdist.outputs.sdist_name }} env: CIBW_ARCHS: ${{ matrix.arch }} - CIBW_SKIP: cp36-* cp313-* pp* + CIBW_SKIP: cp36-* cp38-macosx_arm64 cp313-* pp* CIBW_ENVIRONMENT: APPEND_VERSION="" UWSGI_PROFILE=pyuwsginossl CIBW_TEST_COMMAND: "pyuwsgi --help" CIBW_BEFORE_BUILD_MACOS: "find . -name '*.o' -delete && IS_MACOS=1 ./pre_build.sh" From e5c8a6ea10caff6719c64e25ddb465b93d145f56 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 10 Aug 2024 15:34:57 -0400 Subject: [PATCH 10/10] avoid homebrew's copy of pcre2 --- .github/workflows/build.yml | 4 ++++ Makefile | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 060b097..49008f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,6 +76,10 @@ jobs: with: platforms: all + - name: avoid homebrew pcre2 + if: matrix.os == 'macos-14' + run: brew unlink pcre2 + - name: Build wheels uses: pypa/cibuildwheel@v2.20.0 with: diff --git a/Makefile b/Makefile index b89da44..d0c09cf 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ SHELL := bash # Figure out what version we're building UPSTREAM_VERSION := $(shell cd uwsgi; python setup.pyuwsgi.py --version) # super fragile way of extracting `APPEND_VERSION` from workflow 🤮 -APPEND_VERSION := $(shell yq e '.jobs.build_wheels.steps[4].env.CIBW_ENVIRONMENT' .github/workflows/build.yml | cut -d' ' -f1 | cut -d= -f2) +APPEND_VERSION := $(shell yq e '.jobs.build_wheels.steps[5].env.CIBW_ENVIRONMENT' .github/workflows/build.yml | cut -d' ' -f1 | cut -d= -f2) VERSION := $(UPSTREAM_VERSION)$(APPEND_VERSION) HASH := $(shell cd uwsgi; git rev-parse HEAD)