Skip to content

Commit

Permalink
Add Linux mipsel architecture support
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Jul 27, 2022
1 parent 53c2a09 commit 1e075ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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)
* Add Linux mipsel architecture support in [#1024](https://github.com/PyO3/maturin/pull/1024)

## [0.13.1] - 2022-07-26

Expand Down
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ def finalize_options(self):
version = tomllib.load(fp)["package"]["version"]

cargo_args = []
if platform.machine() in ("ppc64le", "ppc64", "powerpc", "riscv64") or (
sys.platform == "win32" and platform.machine() == "ARM64"
):
if platform.machine() in (
"ppc64le",
"ppc64",
"powerpc",
"riscv64",
"mips",
"mips64",
) or (sys.platform == "win32" and platform.machine() == "ARM64"):
cargo_args.extend(["--no-default-features", "--features=upload,log,human-panic"])
elif sys.platform.startswith("haiku"):
# mio and ring doesn't build on haiku
Expand Down
16 changes: 13 additions & 3 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub enum Arch {
Wasm32,
Riscv64,
Mips64el,
Mipsel,
}

impl fmt::Display for Arch {
Expand All @@ -78,6 +79,7 @@ impl fmt::Display for Arch {
Arch::Wasm32 => write!(f, "wasm32"),
Arch::Riscv64 => write!(f, "riscv64"),
Arch::Mips64el => write!(f, "mips64el"),
Arch::Mipsel => write!(f, "mipsel"),
}
}
}
Expand All @@ -96,6 +98,7 @@ fn get_supported_architectures(os: &Os) -> Vec<Arch> {
Arch::X86_64,
Arch::Riscv64,
Arch::Mips64el,
Arch::Mipsel,
],
Os::Windows => vec![Arch::X86, Arch::X86_64, Arch::Aarch64],
Os::Macos => vec![Arch::Aarch64, Arch::X86_64],
Expand Down Expand Up @@ -134,7 +137,9 @@ 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, Mips64Architecture, OperatingSystem};
use target_lexicon::{
Architecture, ArmArchitecture, Mips32Architecture, Mips64Architecture, OperatingSystem,
};

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

Expand Down Expand Up @@ -366,7 +372,9 @@ impl Target {
Arch::S390X => "s390x",
Arch::Wasm32 => "wasm32",
Arch::Riscv64 => "riscv64",
// It's kinda surprising that Python doesn't include the `el` suffix
Arch::Mips64el => "mips64",
Arch::Mipsel => "mips",
}
}

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

Expand All @@ -407,7 +417,7 @@ impl Target {
| Arch::S390X
| Arch::Riscv64
| Arch::Mips64el => 64,
Arch::Armv6L | Arch::Armv7L | Arch::X86 | Arch::Wasm32 => 32,
Arch::Armv6L | Arch::Armv7L | Arch::X86 | Arch::Wasm32 | Arch::Mipsel => 32,
}
}

Expand Down

0 comments on commit 1e075ab

Please sign in to comment.