Merge pull request #320374 from al3xtjames/zig-darwin-purity

zig: fix build on Darwin with sandbox enabled
This commit is contained in:
Masum Reza 2024-06-21 10:56:30 +05:30 committed by GitHub
commit 1f7e0b772c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 0 deletions

View File

@ -38,6 +38,16 @@ stdenv.mkDerivation (finalAttrs: {
llvm
]);
# On Darwin, Zig calls std.zig.system.darwin.macos.detect during the build,
# which parses /System/Library/CoreServices/SystemVersion.plist and
# /System/Library/CoreServices/.SystemVersionPlatform.plist to determine the
# OS version. This causes the build to fail during stage 3 with
# OSVersionDetectionFail when the sandbox is enabled.
__impureHostDeps = lib.optionals stdenv.isDarwin [
"/System/Library/CoreServices/.SystemVersionPlatform.plist"
"/System/Library/CoreServices/SystemVersion.plist"
];
outputs = [
"out"
"doc"

View File

@ -38,6 +38,16 @@ stdenv.mkDerivation (finalAttrs: {
llvm
]);
# On Darwin, Zig calls std.zig.system.darwin.macos.detect during the build,
# which parses /System/Library/CoreServices/SystemVersion.plist and
# /System/Library/CoreServices/.SystemVersionPlatform.plist to determine the
# OS version. This causes the build to fail during stage 3 with
# OSVersionDetectionFail when the sandbox is enabled.
__impureHostDeps = lib.optionals stdenv.isDarwin [
"/System/Library/CoreServices/.SystemVersionPlatform.plist"
"/System/Library/CoreServices/SystemVersion.plist"
];
outputs = [
"out"
"doc"

View File

@ -36,6 +36,16 @@ stdenv.mkDerivation (finalAttrs: {
llvm
]);
# On Darwin, Zig calls std.zig.system.darwin.macos.detect during the build,
# which parses /System/Library/CoreServices/SystemVersion.plist and
# /System/Library/CoreServices/.SystemVersionPlatform.plist to determine the
# OS version. This causes the build to fail during stage 3 with
# OSVersionDetectionFail when the sandbox is enabled.
__impureHostDeps = lib.optionals stdenv.isDarwin [
"/System/Library/CoreServices/.SystemVersionPlatform.plist"
"/System/Library/CoreServices/SystemVersion.plist"
];
env.ZIG_GLOBAL_CACHE_DIR = "$TMPDIR/zig-cache";
# Zig's build looks at /usr/bin/env to find dynamic linking info. This doesn't