Skip to content

Commit

Permalink
Add support for Linux armv6l
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Jun 12, 2022
1 parent cbf5b46 commit 981396b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/auditwheel/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl fmt::Display for Os {
#[serde(rename_all = "lowercase")]
pub enum Arch {
Aarch64,
Armv6L,
Armv7L,
#[serde(alias = "ppc64le")]
Powerpc64Le,
Expand All @@ -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"),
Expand All @@ -77,6 +79,7 @@ fn get_supported_architectures(os: &Os) -> Vec<Arch> {
match os {
Os::Linux => vec![
Arch::Aarch64,
Arch::Armv6L,
Arch::Armv7L,
Arch::Powerpc64,
Arch::Powerpc64Le,
Expand Down Expand Up @@ -120,6 +123,8 @@ impl Target {
///
/// Fails if the target triple isn't supported
pub fn from_target_triple(target_triple: Option<String>) -> Result<Self> {
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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
}
}

Expand Down

0 comments on commit 981396b

Please sign in to comment.