aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-12-01 23:33:28 +0100
committerJakub Konka <kubkon@jakubkonka.com>2021-12-02 00:22:09 +0100
commit852841fd1f82bb5ba5ecdf9a85a1f15ef70e6dd0 (patch)
tree68268845bdc0cf075b0755e4213697e6309a9a25 /lib
parent3e2f8233a86bf4a2787eb6d37a54b9c8eae8a985 (diff)
downloadzig-852841fd1f82bb5ba5ecdf9a85a1f15ef70e6dd0.tar.gz
zig-852841fd1f82bb5ba5ecdf9a85a1f15ef70e6dd0.zip
Make Rosetta availability declarative by the user
Like QEMU or Wine, you need to declare you want Rosetta enabled for running tests/build artifacts via `-Denable-rosetta` flag.
Diffstat (limited to 'lib')
-rw-r--r--lib/std/build.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index 6c91303c14..600fb691ae 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -1516,6 +1516,9 @@ pub const LibExeObjStep = struct {
/// Experimental. Uses system Darling installation to run cross compiled macOS build artifacts.
enable_darling: bool = false,
+ /// Darwin. Uses Rosetta to run x86_64 macOS build artifacts on arm64 macOS.
+ enable_rosetta: bool = false,
+
/// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
/// this will be the directory $glibc-build-dir/install/glibcs
/// Given the example of the aarch64 target, this is the directory
@@ -2529,7 +2532,10 @@ pub const LibExeObjStep = struct {
}
}
} else switch (self.target.getExternalExecutor()) {
- .native, .rosetta, .unavailable => {},
+ .native, .unavailable => {},
+ .rosetta => if (self.enable_rosetta) {
+ try zig_args.append("--test-cmd-bin");
+ },
.qemu => |bin_name| if (self.enable_qemu) qemu: {
const need_cross_glibc = self.target.isGnuLibC() and self.is_linking_libc;
const glibc_dir_arg = if (need_cross_glibc)