From 993ea6e7a71b53baf01335324491640b849562ce Mon Sep 17 00:00:00 2001 From: "w.pomp" Date: Thu, 1 Oct 2026 19:52:38 +0200 Subject: [PATCH] - workflow fix --- .github/workflows/publish_pypi.yml | 49 ++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 4a381f2..cf32bb2 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -72,13 +72,14 @@ jobs: - name: Install osxcross run: | export PATH="$HOME/.osxcross/bin:$PATH" - if ! command -v osxcross >/dev/null 2>&1; then + if [ ! -d "$HOME/.osxcross/bin" ]; then wget ${{ secrets.OSXCROSS_LINK }} -O osxcross.tar.gz tar -xzf osxcross.tar.gz -C ~/ mv ~/osxcross ~/.osxcross fi - name: Build wheels + shell: bash run: | export PATH="$HOME/.osxcross/bin:$PATH" echo "HOME=$HOME CARGO_HOME=$CARGO_HOME RUSTUP_HOME=$RUSTUP_HOME" @@ -103,10 +104,52 @@ jobs: rustup target add aarch64-pc-windows-msvc maturin build --release --out dist --target aarch64-pc-windows-msvc --auditwheel repair -m ome-metadata/Cargo.toml + # Use osxcross, not Zig, for macOS SDK linking. + shopt -s nullglob + sdks=("$HOME"/.osxcross/SDK/MacOSX*.sdk) + if [ "${#sdks[@]}" -ne 1 ] || [ ! -d "${sdks[0]}" ]; then + echo "Expected exactly one macOS SDK under $HOME/.osxcross/SDK" >&2 + exit 1 + fi + export SDKROOT="$(realpath "${sdks[0]}")" + echo "Using SDKROOT=$SDKROOT" + + find_osxcross_tool() { + local arch="$1" tool="$2" candidate + local matches=() + for candidate in "$HOME"/.osxcross/bin/"$arch"-apple-darwin*-"$tool"; do + if [ -x "$candidate" ]; then + matches+=("$candidate") + fi + done + if [ "${#matches[@]}" -ne 1 ]; then + echo "Expected exactly one osxcross $tool for $arch; found ${#matches[@]}" >&2 + return 1 + fi + printf '%s\n' "${matches[0]}" + } + + CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="$(find_osxcross_tool x86_64 clang)" + export CC_x86_64_apple_darwin="$CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER" + CXX_x86_64_apple_darwin="$(find_osxcross_tool x86_64 clang++)" + # osxcross distributions may call the ARM64 architecture arm64 or aarch64. + arm_arch=arm64 + arm_compilers=("$HOME"/.osxcross/bin/arm64-apple-darwin*-clang) + if [ "${#arm_compilers[@]}" -eq 0 ]; then + arm_arch=aarch64 + fi + CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER="$(find_osxcross_tool "$arm_arch" clang)" + export CC_aarch64_apple_darwin="$CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER" + CXX_aarch64_apple_darwin="$(find_osxcross_tool "$arm_arch" clang++)" + export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER CXX_x86_64_apple_darwin + export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER CXX_aarch64_apple_darwin + "$CC_x86_64_apple_darwin" --version + "$CC_aarch64_apple_darwin" --version + rustup target add x86_64-apple-darwin - maturin build --release --out dist --target x86_64-apple-darwin --zig --auditwheel repair -m ome-metadata/Cargo.toml + MACOSX_DEPLOYMENT_TARGET=10.13 maturin build --release --out dist --target x86_64-apple-darwin --auditwheel repair -m ome-metadata/Cargo.toml rustup target add aarch64-apple-darwin - maturin build --release --out dist --target aarch64-apple-darwin --zig --auditwheel repair -m ome-metadata/Cargo.toml + MACOSX_DEPLOYMENT_TARGET=11.0 maturin build --release --out dist --target aarch64-apple-darwin --auditwheel repair -m ome-metadata/Cargo.toml - name: Store cache uses: actions/cache/save@v4