From 981396ba1903382b1f8677b5ae6085eb10fb57bc Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 12 Jun 2022 14:20:47 +0800 Subject: [PATCH] Add support for Linux armv6l --- Changelog.md | 1 + src/auditwheel/policy.rs | 1 + src/target.rs | 21 +++++++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8f730afa7..2c03f6f29 100644 --- a/Changelog.md +++ b/Changelog.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * 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) * Add `--find-interpreter` option to `build` and `publish` commands to search for python interpreters in [#964](https://github.com/PyO3/maturin/pull/964) +* Add support for Linux armv6l in [#966](https://github.com/PyO3/maturin/pull/966) ## [0.12.19] - 2022-06-05 diff --git a/src/auditwheel/policy.rs b/src/auditwheel/policy.rs index ff2212b0a..3d72b2aa1 100644 --- a/src/auditwheel/policy.rs +++ b/src/auditwheel/policy.rs @@ -97,6 +97,7 @@ impl Policy { if self.name.starts_with("musllinux") && self.lib_whitelist.remove("libc.so") { let new_soname = match target_arch { Arch::Aarch64 => "libc.musl-aarch64.so.1", + Arch::Armv6L => "libc.musl-armhf.so.1", Arch::Armv7L => "libc.musl-armv7.so.1", Arch::Powerpc64Le => "libc.musl-ppc64le.so.1", Arch::Powerpc64 => "", // musllinux doesn't support ppc64 diff --git a/src/target.rs b/src/target.rs index a41821b8c..6e3481fc1 100644 --- a/src/target.rs +++ b/src/target.rs @@ -47,6 +47,7 @@ impl fmt::Display for Os { #[serde(rename_all = "lowercase")] pub enum Arch { Aarch64, + Armv6L, Armv7L, #[serde(alias = "ppc64le")] Powerpc64Le, @@ -62,6 +63,7 @@ impl fmt::Display for Arch { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Arch::Aarch64 => write!(f, "aarch64"), + Arch::Armv6L => write!(f, "armv6l"), Arch::Armv7L => write!(f, "armv7l"), Arch::Powerpc64Le => write!(f, "ppc64le"), Arch::Powerpc64 => write!(f, "ppc64"), @@ -77,6 +79,7 @@ fn get_supported_architectures(os: &Os) -> Vec { match os { Os::Linux => vec![ Arch::Aarch64, + Arch::Armv6L, Arch::Armv7L, Arch::Powerpc64, Arch::Powerpc64Le, @@ -120,6 +123,8 @@ impl Target { /// /// Fails if the target triple isn't supported pub fn from_target_triple(target_triple: Option) -> Result { + use target_lexicon::ArmArchitecture; + let host_triple = get_host_target()?; let (platform, triple) = if let Some(ref target_triple) = target_triple { let platform: Triple = target_triple @@ -150,7 +155,10 @@ impl Target { let arch = match platform.architecture { target_lexicon::Architecture::X86_64 => Arch::X86_64, target_lexicon::Architecture::X86_32(_) => Arch::X86, - target_lexicon::Architecture::Arm(_) => Arch::Armv7L, + target_lexicon::Architecture::Arm(arm_arch) => match arm_arch { + ArmArchitecture::Arm | ArmArchitecture::Armv6 => Arch::Armv6L, + _ => Arch::Armv7L, + }, target_lexicon::Architecture::Aarch64(_) => Arch::Aarch64, target_lexicon::Architecture::Powerpc64 => Arch::Powerpc64, target_lexicon::Architecture::Powerpc64le => Arch::Powerpc64Le, @@ -309,6 +317,7 @@ impl Target { pub fn get_python_arch(&self) -> &str { match self.arch { Arch::Aarch64 => "aarch64", + Arch::Armv6L => "armv6l", Arch::Armv7L => "armv7l", Arch::Powerpc64Le => "powerpc64le", Arch::Powerpc64 => "powerpc64", @@ -340,19 +349,15 @@ impl Target { PlatformTag::manylinux2014() } Arch::X86 | Arch::X86_64 => PlatformTag::manylinux2010(), + Arch::Armv6L => PlatformTag::Linux, } } /// Returns whether the platform is 64 bit or 32 bit pub fn pointer_width(&self) -> usize { match self.arch { - Arch::Aarch64 => 64, - Arch::Armv7L => 32, - Arch::Powerpc64 => 64, - Arch::Powerpc64Le => 64, - Arch::X86 => 32, - Arch::X86_64 => 64, - Arch::S390X => 64, + Arch::Aarch64 | Arch::Powerpc64 | Arch::Powerpc64Le | Arch::X86_64 | Arch::S390X => 64, + Arch::Armv6L | Arch::Armv7L | Arch::X86 => 32, } }