Skip to content

Commit

Permalink
Merge pull request #1023 from messense/mips64el
Browse files Browse the repository at this point in the history
Add Linux mips64el architecture support
  • Loading branch information
messense authored Jul 27, 2022
2 parents 36f7bed + 5687964 commit 53c2a09
Show file tree
Hide file tree
Showing 4 changed files with 754 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* Add Linux mips64el architecture support in [#1023](https://github.com/PyO3/maturin/pull/1023)

## [0.13.1] - 2022-07-26

* Add 64-bit RISC-V support by felixonmars in [#1001](https://github.com/PyO3/maturin/pull/1001)
Expand Down
5 changes: 3 additions & 2 deletions src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,9 @@ impl BuildContext {
.ok_or_else(|| anyhow!(error_msg,))?;

if let Some(extension_name) = extension_name {
warn_missing_py_init(&artifact, extension_name)
.context("Failed to parse the native library")?;
// globin has an issue parsing MIPS64 ELF, see https://github.com/m4b/goblin/issues/274
// But don't fail the build just because we can't emit a warning
let _ = warn_missing_py_init(&artifact, extension_name);
}

if self.editable || self.skip_auditwheel {
Expand Down
12 changes: 9 additions & 3 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub enum Arch {
S390X,
Wasm32,
Riscv64,
Mips64el,
}

impl fmt::Display for Arch {
Expand All @@ -76,6 +77,7 @@ impl fmt::Display for Arch {
Arch::S390X => write!(f, "s390x"),
Arch::Wasm32 => write!(f, "wasm32"),
Arch::Riscv64 => write!(f, "riscv64"),
Arch::Mips64el => write!(f, "mips64el"),
}
}
}
Expand All @@ -93,6 +95,7 @@ fn get_supported_architectures(os: &Os) -> Vec<Arch> {
Arch::X86,
Arch::X86_64,
Arch::Riscv64,
Arch::Mips64el,
],
Os::Windows => vec![Arch::X86, Arch::X86_64, Arch::Aarch64],
Os::Macos => vec![Arch::Aarch64, Arch::X86_64],
Expand Down Expand Up @@ -131,7 +134,7 @@ impl Target {
///
/// Fails if the target triple isn't supported
pub fn from_target_triple(target_triple: Option<String>) -> Result<Self> {
use target_lexicon::{Architecture, ArmArchitecture, OperatingSystem};
use target_lexicon::{Architecture, ArmArchitecture, Mips64Architecture, OperatingSystem};

let host_triple = get_host_target()?;
let (platform, triple) = if let Some(ref target_triple) = target_triple {
Expand Down Expand Up @@ -173,6 +176,7 @@ impl Target {
Architecture::S390x => Arch::S390X,
Architecture::Wasm32 => Arch::Wasm32,
Architecture::Riscv64(_) => Arch::Riscv64,
Architecture::Mips64(Mips64Architecture::Mips64el) => Arch::Mips64el,
unsupported => bail!("The architecture {} is not supported", unsupported),
};

Expand Down Expand Up @@ -362,6 +366,7 @@ impl Target {
Arch::S390X => "s390x",
Arch::Wasm32 => "wasm32",
Arch::Riscv64 => "riscv64",
Arch::Mips64el => "mips64",
}
}

Expand All @@ -388,7 +393,7 @@ impl Target {
PlatformTag::manylinux2014()
}
Arch::X86 | Arch::X86_64 => PlatformTag::manylinux2010(),
Arch::Armv6L | Arch::Wasm32 | Arch::Riscv64 => PlatformTag::Linux,
Arch::Armv6L | Arch::Wasm32 | Arch::Riscv64 | Arch::Mips64el => PlatformTag::Linux,
}
}

Expand All @@ -400,7 +405,8 @@ impl Target {
| Arch::Powerpc64Le
| Arch::X86_64
| Arch::S390X
| Arch::Riscv64 => 64,
| Arch::Riscv64
| Arch::Mips64el => 64,
Arch::Armv6L | Arch::Armv7L | Arch::X86 | Arch::Wasm32 => 32,
}
}
Expand Down
Loading

0 comments on commit 53c2a09

Please sign in to comment.