-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cargo-zigbuild is replaced with a simple zig-cc wrapper. cargo-zigbuild still tries to use i386-linux-musl triple, while in zig 0.11 x86-linux-musl should be used [1]. This also gives us more control over compilation flags used and prevents changes due to cargo-zigbuild upgrades, as its version was not pinned. [1] Merged PR "all: rename i386 to x86 " <ziglang/zig#13101>
- Loading branch information
Showing
3 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
import subprocess | ||
import sys | ||
import os | ||
|
||
|
||
def flag_filter(flag: str) -> bool: | ||
if flag == "-lc": | ||
return False | ||
if flag == "-Wl,-melf_i386": | ||
return False | ||
if "self-contained" in flag and "crt" in flag: | ||
return False | ||
return True | ||
|
||
|
||
def main(): | ||
args = [flag for flag in sys.argv[1:] if flag_filter(flag)] | ||
zig_target = os.environ["ZIG_TARGET"] | ||
zig_cpu = os.environ.get("ZIG_CPU") | ||
if zig_cpu: | ||
zig_cpu_args = ["-mcpu=" + zig_cpu] | ||
args = [x for x in args if not x.startswith("-march")] | ||
else: | ||
zig_cpu_args = [] | ||
|
||
subprocess.run( | ||
["zig", "cc", "-target", zig_target, *zig_cpu_args, *args], check=True | ||
) | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters