zig_0_12: init

This commit is contained in:
Tristan Ross 2024-04-19 14:07:20 -07:00
parent 19332fff69
commit 3b5257d01b
No known key found for this signature in database
GPG Key ID: B09C422035669AF8
3 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, llvmPackages
, libxml2
, zlib
, coreutils
, callPackage
}@args:
import ./generic.nix args {
version = "0.12.0";
hash = "sha256-RNZiUZtaKXoab5kFrDij6YCAospeVvlLWheTc3FGMks=";
outputs = [ "out" "doc" ];
cmakeFlags = [
# file RPATH_CHANGE could not write new RPATH
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
# always link against static build of LLVM
(lib.cmakeBool "ZIG_STATIC_LLVM" true)
# ensure determinism in the compiler build
(lib.cmakeFeature "ZIG_TARGET_MCPU" "baseline")
];
postBuild = ''
stage3/bin/zig run ../tools/docgen.zig -- ../doc/langref.html.in langref.html --zig $PWD/stage3/bin/zig
'';
postInstall = ''
install -Dm444 langref.html -t $doc/share/doc/zig-$version/html
'';
}

View File

@ -40,7 +40,10 @@ stdenv.mkDerivation (finalAttrs: {
# Zig's build looks at /usr/bin/env to find dynamic linking info. This doesn't
# work in Nix's sandbox. Use env from our coreutils instead.
postPatch = ''
postPatch = if lib.versionAtLeast args.version "0.12" then ''
substituteInPlace lib/std/zig/system.zig \
--replace "/usr/bin/env" "${coreutils}/bin/env"
'' else ''
substituteInPlace lib/std/zig/system/NativeTargetInfo.zig \
--replace "/usr/bin/env" "${coreutils}/bin/env"
'';

View File

@ -25239,6 +25239,10 @@ with pkgs;
zig_0_11 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.11.nix {
llvmPackages = llvmPackages_16;
};
# requires a newer Apple SDK
zig_0_12 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.12.nix {
llvmPackages = llvmPackages_17;
};
zig = zig_0_11;
zig-shell-completions = callPackage ../development/compilers/zig/shell-completions.nix { };