Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NetBSD support #704

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Add support for excluding files from wheels by `.gitignore` in [#695](https://github.com/PyO3/maturin/pull/695)
* Fix `pip install maturin` on OpenBSD 6.8 in [#697](https://github.com/PyO3/maturin/pull/697)
* Add support for x86, x86_64 and aarch64 on NetBSD in [#704](https://github.com/PyO3/maturin/pull/704)

## [0.12.1] - 2021-11-21

Expand Down
13 changes: 12 additions & 1 deletion src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum Os {
Windows,
Macos,
FreeBsd,
NetBsd,
OpenBsd,
}

Expand All @@ -27,6 +28,7 @@ impl fmt::Display for Os {
Os::Windows => write!(f, "Windows"),
Os::Macos => write!(f, "MacOS"),
Os::FreeBsd => write!(f, "FreeBSD"),
Os::NetBsd => write!(f, "NetBSD"),
Os::OpenBsd => write!(f, "OpenBSD"),
}
}
Expand Down Expand Up @@ -72,6 +74,7 @@ fn get_supported_architectures(os: &Os) -> Vec<Arch> {
],
Os::Windows => vec![Arch::X86, Arch::X86_64, Arch::Aarch64],
Os::Macos => vec![Arch::Aarch64, Arch::X86_64],
Os::NetBsd => vec![Arch::Aarch64, Arch::X86, Arch::X86_64],
Os::FreeBsd => vec![
Arch::Aarch64,
Arch::Powerpc64,
Expand Down Expand Up @@ -115,6 +118,7 @@ impl Target {
target_lexicon::OperatingSystem::Windows => Os::Windows,
target_lexicon::OperatingSystem::MacOSX { .. }
| target_lexicon::OperatingSystem::Darwin => Os::Macos,
target_lexicon::OperatingSystem::Netbsd => Os::NetBsd,
target_lexicon::OperatingSystem::Freebsd => Os::FreeBsd,
target_lexicon::OperatingSystem::Openbsd => Os::OpenBsd,
unsupported => bail!("The operating system {:?} is not supported", unsupported),
Expand Down Expand Up @@ -146,10 +150,16 @@ impl Target {
/// Returns the platform part of the tag for the wheel name
pub fn get_platform_tag(&self, platform_tag: PlatformTag, universal2: bool) -> String {
match (&self.os, &self.arch) {
// FreeBSD
(Os::FreeBsd, Arch::X86_64)
| (Os::FreeBsd, Arch::Aarch64)
| (Os::FreeBsd, Arch::Powerpc64)
| (Os::FreeBsd, Arch::Powerpc64Le)
// NetBSD
| (Os::NetBsd, Arch::X86)
| (Os::NetBsd, Arch::X86_64)
| (Os::NetBsd, Arch::Aarch64)
// OpenBSD
| (Os::OpenBsd, Arch::X86)
| (Os::OpenBsd, Arch::X86_64)
| (Os::OpenBsd, Arch::Aarch64) => {
Expand Down Expand Up @@ -210,6 +220,7 @@ impl Target {
Os::Linux => "linux",
Os::Macos => "darwin",
Os::FreeBsd => "freebsd",
Os::NetBsd => "netbsd",
Os::OpenBsd => "openbsd",
}
}
Expand Down Expand Up @@ -246,7 +257,7 @@ impl Target {
pub fn is_unix(&self) -> bool {
match self.os {
Os::Windows => false,
Os::Linux | Os::Macos | Os::FreeBsd | Os::OpenBsd => true,
Os::Linux | Os::Macos | Os::FreeBsd | Os::NetBsd | Os::OpenBsd => true,
}
}

Expand Down
Loading