Skip to content

Commit

Permalink
Merge pull request #25 from lincolnloop/2.0.26
Browse files Browse the repository at this point in the history
v2.0.26
  • Loading branch information
ipmb authored Aug 12, 2024
2 parents ba2bf16 + e5c8a6e commit a3e95f2
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 40 deletions.
33 changes: 20 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
name: Build

on: [push, pull_request]
on:
push:
branches: [main, test-me-*]
tags: '*'
pull_request:

jobs:
build_sdist:
Expand Down Expand Up @@ -35,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-20.04, macos-11]
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:
Expand All @@ -62,25 +71,23 @@ 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

- name: avoid homebrew pcre2
if: matrix.os == 'macos-14'
run: brew unlink pcre2

- 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 }}
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_SKIP: cp36-* pp*
CIBW_ARCHS: ${{ matrix.arch }}
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"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
56 changes: 31 additions & 25 deletions pre_build.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
#!/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"
make_install=(sudo make install)
else
make_install=(make install)
fi

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
if [ -z "$path" ]; then echo "Need not-empty path"; exit 1; fi
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
Expand Down Expand Up @@ -74,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 {
Expand All @@ -102,12 +108,12 @@ function build_jansson {
(cd "${JANSSON_ROOT}" \
&& ./configure --prefix="$BUILD_PREFIX" \
&& make -j4 \
&& make install)
&& "${make_install[@]}")
touch jansson-stamp
}

function pre_build {
build_pcre
build_pcre2
#build_zlib
build_jansson
}
Expand Down

0 comments on commit a3e95f2

Please sign in to comment.