maturin: add support for ppc*-musl, ppcle*

This commit is contained in:
q66 2021-02-05 18:56:36 +01:00
parent 7e15e137fa
commit ae9fa6c628
3 changed files with 210 additions and 2 deletions

View file

@ -0,0 +1,83 @@
From 88434b211f9e4219fe7b6d9adc737351091324cd Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Fri, 5 Feb 2021 18:32:38 +0100
Subject: [PATCH] add support for tier 3 ppc targets
---
setup.py | 2 +-
src/target.rs | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git setup.py setup.py
index 228267f..8fa1c1e 100644
--- setup.py
+++ setup.py
@@ -62,7 +62,7 @@ class PostInstallCommand(install):
cargo_args = [cargo, "rustc", "--bin", "maturin", "--message-format=json"]
- if platform.machine() in ("ppc64le", "ppc64"):
+ if platform.machine() in ("ppc64le", "ppc64", "ppcle", "ppc"):
cargo_args.extend(
["--no-default-features", "--features=auditwheel,log,human-panic"]
)
diff --git src/target.rs src/target.rs
index d13cc34..66cc823 100644
--- src/target.rs
+++ src/target.rs
@@ -58,6 +58,8 @@ enum Arch {
ARMV7L,
POWERPC64LE,
POWERPC64,
+ POWERPCLE,
+ POWERPC,
X86,
X86_64,
}
@@ -69,6 +71,8 @@ impl fmt::Display for Arch {
Arch::ARMV7L => write!(f, "armv7l"),
Arch::POWERPC64LE => write!(f, "ppc64le"),
Arch::POWERPC64 => write!(f, "ppc64"),
+ Arch::POWERPCLE => write!(f, "ppcle"),
+ Arch::POWERPC => write!(f, "ppc"),
Arch::X86 => write!(f, "i686"),
Arch::X86_64 => write!(f, "x86_64"),
}
@@ -109,6 +113,16 @@ impl Target {
platforms::target::Arch::X86 => Arch::X86,
platforms::target::Arch::ARM => Arch::ARMV7L,
platforms::target::Arch::AARCH64 => Arch::AARCH64,
+ platforms::target::Arch::POWERPC
+ if platform.target_triple.starts_with("powerpc-") =>
+ {
+ Arch::POWERPC
+ }
+ platforms::target::Arch::POWERPC
+ if platform.target_triple.starts_with("powerpcle-") =>
+ {
+ Arch::POWERPCLE
+ }
platforms::target::Arch::POWERPC64
if platform.target_triple.starts_with("powerpc64-") =>
{
@@ -147,6 +161,8 @@ impl Target {
match self.arch {
Arch::AARCH64 => 64,
Arch::ARMV7L => 32,
+ Arch::POWERPC => 32,
+ Arch::POWERPCLE => 32,
Arch::POWERPC64 => 64,
Arch::POWERPC64LE => 64,
Arch::X86 => 32,
@@ -210,6 +226,8 @@ impl Target {
(OS::FreeBSD, _) => "", // according imp.get_suffixes(), there are no such
(OS::Linux, Arch::AARCH64) => "aarch64-linux-gnu", // aka armv8-linux-gnueabihf
(OS::Linux, Arch::ARMV7L) => "arm-linux-gnueabihf",
+ (OS::Linux, Arch::POWERPC) => "powerpc-linux-gnu",
+ (OS::Linux, Arch::POWERPCLE) => "powerpcle-linux-gnu",
(OS::Linux, Arch::POWERPC64) => "powerpc64-linux-gnu",
(OS::Linux, Arch::POWERPC64LE) => "powerpc64le-linux-gnu",
(OS::Linux, Arch::X86) => "i386-linux-gnu", // not i686
--
2.30.0

View file

@ -0,0 +1,116 @@
From 27a70f351da0289119f39964a3c661ae05a24856 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Fri, 5 Feb 2021 18:46:51 +0100
Subject: [PATCH] add ppc*-musl and ppcle support into platform crate
---
platforms/README.md | 10 ++++++++
platforms/src/platform.rs | 5 ++++
platforms/src/platform/tier3.rs | 45 +++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+)
diff --git platforms/README.md platforms/README.md
index a8a7fba..5038fed 100644
--- platforms/README.md
+++ platforms/README.md
@@ -117,6 +117,11 @@ accompanied by a minor version bump.
| [mips-unknown-linux-uclibc] | mips | linux | uclibc |
| [mipsel-unknown-linux-uclibc] | mips | linux | uclibc |
| [msp430-none-elf] | msp430 | unknown | "" |
+| [powerpc-unknown-linux-musl] | powerpc | linux | musl |
+| [powerpcle-unknown-linux-gnu] | powerpc | linux | gnu |
+| [powerpcle-unknown-linux-musl] | powerpc | linux | musl |
+| [powerpc64-unknown-linux-musl] | powerpc64 | linux | musl |
+| [powerpc64le-unknown-linux-musl] | powerpc64 | linux | musl |
| [sparc64-unknown-netbsd] | sparc64 | netbsd | "" |
| [thumbv6m-none-eabi] | thumbv6 | unknown | "" |
| [thumbv7em-none-eabi] | thumbv7 | unknown | "" |
@@ -206,8 +211,13 @@ additional terms or conditions.
[mipsel-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.MIPSEL_UNKNOWN_LINUX_GNU.html
[mipsel-unknown-linux-musl]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.MIPSEL_UNKNOWN_LINUX_MUSL.html
[powerpc-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.POWERPC_UNKNOWN_LINUX_GNU.html
+[powerpc-unknown-linux-musl]: https://docs.rs/platforms/latest/platforms/platform/tier3/constant.POWERPC_UNKNOWN_LINUX_MUSL.html
+[powerpcle-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier3/constant.POWERPCLE_UNKNOWN_LINUX_GNU.html
+[powerpcle-unknown-linux-musl]: https://docs.rs/platforms/latest/platforms/platform/tier3/constant.POWERPCLE_UNKNOWN_LINUX_MUSL.html
[powerpc64-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.POWERPC64_UNKNOWN_LINUX_GNU.html
+[powerpc64-unknown-linux-musl]: https://docs.rs/platforms/latest/platforms/platform/tier3/constant.POWERPC64_UNKNOWN_LINUX_MUSL.html
[powerpc64le-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.POWERPC64LE_UNKNOWN_LINUX_GNU.html
+[powerpc64le-unknown-linux-musl]: https://docs.rs/platforms/latest/platforms/platform/tier3/constant.POWERPC64LE_UNKNOWN_LINUX_MUSL.html
[s390x-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.S390X_UNKNOWN_LINUX_GNU.html
[sparc64-unknown-linux-gnu]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.SPARC64_UNKNOWN_LINUX_GNU.html
[sparcv9-sun-solaris]: https://docs.rs/platforms/latest/platforms/platform/tier2/constant.SPARCV9_SUN_SOLARIS.html
diff --git platforms/src/platform.rs platforms/src/platform.rs
index 8b1f049..30c0516 100644
--- platforms/src/platform.rs
+++ platforms/src/platform.rs
@@ -142,6 +142,11 @@ impl Platform {
tier3::MIPS_UNKNOWN_LINUX_UCLIBC,
tier3::MIPSEL_UNKNOWN_LINUX_UCLIBC,
tier3::MSP430_NONE_ELF,
+ tier3::POWERPC_UNKNOWN_LINUX_MUSL,
+ tier3::POWERPCLE_UNKNOWN_LINUX_GNU,
+ tier3::POWERPCLE_UNKNOWN_LINUX_MUSL,
+ tier3::POWERPC64_UNKNOWN_LINUX_MUSL,
+ tier3::POWERPC64LE_UNKNOWN_LINUX_MUSL,
tier3::SPARC64_UNKNOWN_NETBSD,
tier3::THUMBV6M_NONE_EABI,
tier3::THUMBV7EM_NONE_EABI,
diff --git platforms/src/platform/tier3.rs platforms/src/platform/tier3.rs
index 519db6a..32ba2f7 100644
--- platforms/src/platform/tier3.rs
+++ platforms/src/platform/tier3.rs
@@ -56,6 +56,51 @@ pub const MSP430_NONE_ELF: Platform = Platform {
tier: Tier::Three,
};
+/// `powerpc-unknown-linux-musl`: PowerPC Linux with MUSL
+pub const POWERPC_UNKNOWN_LINUX_MUSL: Platform = Platform {
+ target_triple: "powerpc-unknown-linux-musl",
+ target_arch: Arch::POWERPC,
+ target_os: OS::Linux,
+ target_env: Some(Env::Musl),
+ tier: Tier::Three,
+};
+
+/// `powerpcle-unknown-linux-gnu`: PowerPCLE Linux
+pub const POWERPCLE_UNKNOWN_LINUX_GNU: Platform = Platform {
+ target_triple: "powerpcle-unknown-linux-gnu",
+ target_arch: Arch::POWERPC,
+ target_os: OS::Linux,
+ target_env: Some(Env::GNU),
+ tier: Tier::Three,
+};
+
+/// `powerpcle-unknown-linux-musl`: PowerPCLE Linux with MUSL
+pub const POWERPCLE_UNKNOWN_LINUX_MUSL: Platform = Platform {
+ target_triple: "powerpcle-unknown-linux-musl",
+ target_arch: Arch::POWERPC,
+ target_os: OS::Linux,
+ target_env: Some(Env::Musl),
+ tier: Tier::Three,
+};
+
+/// `powerpc64-unknown-linux-musl`: PPC64 Linux with MUSL
+pub const POWERPC64_UNKNOWN_LINUX_MUSL: Platform = Platform {
+ target_triple: "powerpc64-unknown-linux-musl",
+ target_arch: Arch::POWERPC64,
+ target_os: OS::Linux,
+ target_env: Some(Env::Musl),
+ tier: Tier::Three,
+};
+
+/// `powerpc64le-unknown-linux-musl`: PPC64LE Linux with MUSL
+pub const POWERPC64LE_UNKNOWN_LINUX_MUSL: Platform = Platform {
+ target_triple: "powerpc64le-unknown-linux-musl",
+ target_arch: Arch::POWERPC64,
+ target_os: OS::Linux,
+ target_env: Some(Env::Musl),
+ tier: Tier::Three,
+};
+
/// `sparc64-unknown-netbsd`: NetBSD/sparc64
pub const SPARC64_UNKNOWN_NETBSD: Platform = Platform {
target_triple: "sparc64-unknown-netbsd",
--
2.30.0

View file

@ -13,8 +13,17 @@ short_desc="Build and publish crates as python packages"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="Apache-2.0, MIT"
homepage="https://github.com/PyO3/maturin"
distfiles="${homepage}/archive/v${version}.tar.gz"
checksum=22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
# bump platforms version if it changes in Cargo.lock
distfiles="${homepage}/archive/v${version}.tar.gz
https://github.com/RustSec/platforms-crate/archive/v1.1.0.tar.gz"
checksum="22e8082a743e1dc11f5909b596f9053deb7dc1a56336003677381ba02cf67da8
2524984c2ef547bb54515828e4afad0e781a439d74cf0197cf168ec6c818594c"
post_extract() {
mv ../platforms-crate* platforms
echo "[patch.crates-io]" >> Cargo.toml
echo "platforms = { path = './platforms' }" >> Cargo.toml
}
post_patch() {
# setup.py is broken, just use it for the pure python part