Skip to content

Commit

Permalink
Merge pull request #1073 from messense/zig-ar
Browse files Browse the repository at this point in the history
Add `zig ar` support
  • Loading branch information
messense authored Sep 1, 2022
2 parents 75a4587 + bbadd0d commit e6e26e5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Enable `--crate-type cdylib` on Rust 1.64.0 in [#1060](https://github.com/PyO3/maturin/pull/1060)
* Update MSRV to 1.59.0 in [#1071](https://github.com/PyO3/maturin/pull/1071)
* Fix abi3 wheel build when no Python interpreters found in [#1072](https://github.com/PyO3/maturin/pull/1072)
* Add `zig ar` support in [#1073](https://github.com/PyO3/maturin/pull/1073)

## [0.13.2] - 2022-08-14

Expand Down
1 change: 1 addition & 0 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ fn compile_target(
build.target = vec![target_triple.to_string()];
}
} else {
build.enable_zig_ar = true;
let zig_triple = if target.is_linux() && !target.is_musl_target() {
match context.platform_tag.iter().find(|tag| tag.is_manylinux()) {
Some(PlatformTag::Manylinux { x, y }) => {
Expand Down
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,19 @@ fn run() -> Result<()> {
#[cfg(feature = "log")]
pretty_env_logger::init();

// Allow symlink `maturin` to `ar` to invoke `zig ar`
// See https://github.com/messense/cargo-zigbuild/issues/52
let mut args = env::args();
let program_path = PathBuf::from(args.next().expect("no program path"));
let program_name = program_path.file_stem().expect("no program name");
if program_name.eq_ignore_ascii_case("ar") {
let zig = Zig::Ar {
args: args.collect(),
};
zig.execute()?;
return Ok(());
}

let opt = Opt::parse();

match opt {
Expand Down

0 comments on commit e6e26e5

Please sign in to comment.