diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index cf32bb2..083b053 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -54,8 +54,7 @@ jobs: - name: Install sccache and maturin run: | python -m pip install --upgrade pip - python -m pip install --upgrade maturin "ziglang==0.14.1" - python -m ziglang version + python -m pip install --upgrade maturin ziglang if ! command -v sccache >/dev/null 2>&1; then cargo install sccache || pip install sccache fi @@ -90,6 +89,11 @@ jobs: rm -rf dist maturin sdist --out dist -m ome-metadata/Cargo.toml + 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 + rustup target add aarch64-apple-darwin + maturin build --release --out dist --target aarch64-apple-darwin --zig --auditwheel repair -m ome-metadata/Cargo.toml + rustup target add x86_64-unknown-linux-gnu maturin build --release --out dist --target x86_64-unknown-linux-gnu --zig --auditwheel repair -m ome-metadata/Cargo.toml rustup target add aarch64-unknown-linux-gnu @@ -104,53 +108,6 @@ 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 - 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 - 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 with: