Skip to content

Commit

Permalink
Merge pull request #727 from messense/dragonfly
Browse files Browse the repository at this point in the history
Add support for x86_64 DragonFly BSD
  • Loading branch information
messense authored Dec 3, 2021
2 parents 06b7f94 + 5968661 commit 59975be
Show file tree
Hide file tree
Showing 3 changed files with 732 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add a `maturin init` command as a companion to `maturin new` in [#719](https://github.com/PyO3/maturin/pull/719)
* Don't package non-path-dep crates in sdist for workspaces in [#720](https://github.com/PyO3/maturin/pull/720)
* Build release packages with `password-storage` feature in [#725](https://github.com/PyO3/maturin/pull/725)
* Add support for x86_64 DargonFly BSD in [#727](https://github.com/PyO3/maturin/pull/727)

## [0.12.3] - 2021-11-29

Expand Down
23 changes: 22 additions & 1 deletion src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum Os {
FreeBsd,
NetBsd,
OpenBsd,
Dragonfly,
Illumos,
}

Expand All @@ -32,6 +33,7 @@ impl fmt::Display for Os {
Os::FreeBsd => write!(f, "FreeBSD"),
Os::NetBsd => write!(f, "NetBSD"),
Os::OpenBsd => write!(f, "OpenBSD"),
Os::Dragonfly => write!(f, "DragonFly"),
Os::Illumos => write!(f, "Illumos"),
}
}
Expand Down Expand Up @@ -85,6 +87,7 @@ fn get_supported_architectures(os: &Os) -> Vec<Arch> {
Arch::X86_64,
],
Os::OpenBsd => vec![Arch::X86, Arch::X86_64, Arch::Aarch64],
Os::Dragonfly => vec![Arch::X86_64],
Os::Illumos => vec![Arch::X86_64],
}
}
Expand Down Expand Up @@ -126,6 +129,7 @@ impl Target {
target_lexicon::OperatingSystem::Netbsd => Os::NetBsd,
target_lexicon::OperatingSystem::Freebsd => Os::FreeBsd,
target_lexicon::OperatingSystem::Openbsd => Os::OpenBsd,
target_lexicon::OperatingSystem::Dragonfly => Os::Dragonfly,
target_lexicon::OperatingSystem::Illumos => Os::Illumos,
unsupported => bail!("The operating system {:?} is not supported", unsupported),
};
Expand Down Expand Up @@ -191,6 +195,16 @@ impl Target {
arch
)
}
(Os::Dragonfly, Arch::X86_64) => {
let info = PlatformInfo::new()?;
let release = info.release().replace(".", "_").replace("-", "_");
format!(
"{}_{}_{}",
self.os.to_string().to_ascii_lowercase(),
release.to_ascii_lowercase(),
"x86_64"
)
}
(Os::Illumos, Arch::X86_64) => {
let info = PlatformInfo::new()?;
let mut release = info.release().replace(".", "_").replace("-", "_");
Expand Down Expand Up @@ -273,6 +287,7 @@ impl Target {
Os::FreeBsd => "freebsd",
Os::NetBsd => "netbsd",
Os::OpenBsd => "openbsd",
Os::Dragonfly => "dragonfly",
Os::Illumos => "sunos",
}
}
Expand Down Expand Up @@ -309,7 +324,13 @@ impl Target {
pub fn is_unix(&self) -> bool {
match self.os {
Os::Windows => false,
Os::Linux | Os::Macos | Os::FreeBsd | Os::NetBsd | Os::OpenBsd | Os::Illumos => true,
Os::Linux
| Os::Macos
| Os::FreeBsd
| Os::NetBsd
| Os::OpenBsd
| Os::Dragonfly
| Os::Illumos => true,
}
}

Expand Down
Loading

0 comments on commit 59975be

Please sign in to comment.