diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41a9ccc77..59eb6cd41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,5 +286,9 @@ jobs: # Use PYO3_CROSS_LIB_DIR export PYO3_CROSS_LIB_DIR=/opt/python/${{ matrix.platform.abi }} cargo run --target x86_64-unknown-linux-gnu -- build -i python3.9 --release --out dist --target ${{ matrix.platform.target }} -m test-crates/pyo3-mixed/Cargo.toml + unset PYO3_CROSS_LIB_DIR + + # Test abi3 + cargo run --target x86_64-unknown-linux-gnu -- build -i ${{ matrix.platform.python }} --release --out dist --target ${{ matrix.platform.target }} -m test-crates/pyo3-pure/Cargo.toml ' > build-wheel.sh docker run --rm -v "$PWD":/io -w /io messense/manylinux2014-cross:${{ matrix.platform.arch }} bash build-wheel.sh diff --git a/Changelog.md b/Changelog.md index 60dedecfe..d1e09636d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add support for using bundled python sysconfigs for PyPy when abi3 feature is enabled in [#958](https://github.com/PyO3/maturin/pull/958) * Set `PYO3_PYTHON` env var for PyPy when abi3 is enabled in [#960](https://github.com/PyO3/maturin/pull/960) * Add sysconfigs for x64 Windows PyPy in [#962](https://github.com/PyO3/maturin/pull/962) +* Add support for cross compiling PyPy wheels when abi3 feature is enabled in [#963](https://github.com/PyO3/maturin/pull/963) ## [0.12.19] - 2022-06-05 diff --git a/src/build_options.rs b/src/build_options.rs index 3ab2a6c50..e03864f7b 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -987,6 +987,25 @@ pub fn find_interpreter( platform: None, runnable: false, }]) + } else if target.cross_compiling() { + let mut interps = Vec::with_capacity(interpreters.len()); + let mut pypys = Vec::new(); + for interp in interpreters { + if matches!(interp.interpreter_kind, InterpreterKind::PyPy) { + pypys.push(PathBuf::from(format!( + "pypy{}.{}", + interp.major, interp.minor + ))); + } else { + interps.push(interp); + } + } + // cross compiling to PyPy with abi3 feature enabled, + // we cannot use host pypy so switch to bundled sysconfig instead + if !pypys.is_empty() { + interps.extend(find_interpreter_in_sysconfig(&pypys, target)?) + } + Ok(interps) } else { Ok(interpreters) }