diff options
Diffstat (limited to 'pkgs/development/compilers/zig/0.11')
-rw-r--r-- | pkgs/development/compilers/zig/0.11/default.nix | 103 | ||||
-rw-r--r-- | pkgs/development/compilers/zig/0.11/hook.nix | 47 | ||||
-rw-r--r-- | pkgs/development/compilers/zig/0.11/setup-hook.sh | 70 |
3 files changed, 0 insertions, 220 deletions
diff --git a/pkgs/development/compilers/zig/0.11/default.nix b/pkgs/development/compilers/zig/0.11/default.nix deleted file mode 100644 index 0f19f455cbb0..000000000000 --- a/pkgs/development/compilers/zig/0.11/default.nix +++ /dev/null @@ -1,103 +0,0 @@ -{ - lib, - callPackage, - cmake, - coreutils, - fetchFromGitHub, - libxml2, - llvmPackages, - stdenv, - testers, - zlib, -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "zig"; - version = "0.11.0"; - - src = fetchFromGitHub { - owner = "ziglang"; - repo = "zig"; - rev = finalAttrs.version; - hash = "sha256-iuU1fzkbJxI+0N1PiLQM013Pd1bzrgqkbIyTxo5gB2I="; - }; - - nativeBuildInputs = [ - cmake - (lib.getDev llvmPackages.llvm) - ]; - - buildInputs = - [ - libxml2 - zlib - ] - ++ (with llvmPackages; [ - libclang - lld - llvm - ]); - - outputs = [ - "out" - "doc" - ]; - - cmakeFlags = [ - # file RPATH_CHANGE could not write new RPATH - (lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) - # ensure determinism in the compiler build - (lib.cmakeFeature "ZIG_TARGET_MCPU" "baseline") - # always link against static build of LLVM - (lib.cmakeBool "ZIG_STATIC_LLVM" true) - ]; - - env.ZIG_GLOBAL_CACHE_DIR = "$TMPDIR/zig-cache"; - - doInstallCheck = true; - - strictDeps = true; - - # 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 = '' - substituteInPlace lib/std/zig/system/NativeTargetInfo.zig \ - --replace "/usr/bin/env" "${lib.getExe' coreutils "env"}" - ''; - - postBuild = '' - stage3/bin/zig run ../tools/docgen.zig -- ../doc/langref.html.in langref.html --zig $PWD/stage3/bin/zig - ''; - - postInstall = '' - install -Dm444 -t $doc/share/doc/zig-$version/html langref.html - ''; - - installCheckPhase = '' - runHook preInstallCheck - - $out/bin/zig test --cache-dir "$TMPDIR/zig-test-cache" -I $src/test $src/test/behavior.zig - - runHook postInstallCheck - ''; - - passthru = { - hook = callPackage ./hook.nix { zig = finalAttrs.finalPackage; }; - tests = { - version = testers.testVersion { - package = finalAttrs.finalPackage; - command = "zig version"; - }; - }; - }; - - meta = { - description = "General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software"; - homepage = "https://ziglang.org/"; - changelog = "https://ziglang.org/download/${finalAttrs.version}/release-notes.html"; - license = lib.licenses.mit; - mainProgram = "zig"; - maintainers = with lib.maintainers; [ andrewrk ] ++ lib.teams.zig.members; - platforms = lib.platforms.unix; - }; -}) diff --git a/pkgs/development/compilers/zig/0.11/hook.nix b/pkgs/development/compilers/zig/0.11/hook.nix deleted file mode 100644 index fb0e1aa564d1..000000000000 --- a/pkgs/development/compilers/zig/0.11/hook.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - lib, - makeSetupHook, - zig, -}: - -makeSetupHook { - name = "zig-hook"; - - propagatedBuildInputs = [ zig ]; - - substitutions = { - # This zig_default_flags below is meant to avoid CPU feature impurity in - # Nixpkgs. However, this flagset is "unstable": it is specifically meant to - # be controlled by the upstream development team - being up to that team - # exposing or not that flags to the outside (especially the package manager - # teams). - - # Because of this hurdle, @andrewrk from Zig Software Foundation proposed - # some solutions for this issue. Hopefully they will be implemented in - # future releases of Zig. When this happens, this flagset should be - # revisited accordingly. - - # Below are some useful links describing the discovery process of this 'bug' - # in Nixpkgs: - - # https://github.com/NixOS/nixpkgs/issues/169461 - # https://github.com/NixOS/nixpkgs/issues/185644 - # https://github.com/NixOS/nixpkgs/pull/197046 - # https://github.com/NixOS/nixpkgs/pull/241741#issuecomment-1624227485 - # https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653 - - zig_default_flags = [ - "-Dcpu=baseline" - "-Doptimize=ReleaseSafe" - ]; - }; - - passthru = { - inherit zig; - }; - - meta = { - description = "Setup hook for using the Zig compiler in Nixpkgs"; - inherit (zig.meta) maintainers platforms broken; - }; -} ./setup-hook.sh diff --git a/pkgs/development/compilers/zig/0.11/setup-hook.sh b/pkgs/development/compilers/zig/0.11/setup-hook.sh deleted file mode 100644 index 689ebec8a307..000000000000 --- a/pkgs/development/compilers/zig/0.11/setup-hook.sh +++ /dev/null @@ -1,70 +0,0 @@ -# shellcheck shell=bash disable=SC2154,SC2086 - -readonly zigDefaultFlagsArray=(@zig_default_flags@) - -function zigSetGlobalCacheDir { - ZIG_GLOBAL_CACHE_DIR=$(mktemp -d) - export ZIG_GLOBAL_CACHE_DIR -} - -function zigBuildPhase { - runHook preBuild - - local flagsArray=( - "${zigDefaultFlagsArray[@]}" - $zigBuildFlags "${zigBuildFlagsArray[@]}" - ) - - echoCmd 'zig build flags' "${flagsArray[@]}" - zig build "${flagsArray[@]}" - - runHook postBuild -} - -function zigCheckPhase { - runHook preCheck - - local flagsArray=( - "${zigDefaultFlagsArray[@]}" - $zigCheckFlags "${zigCheckFlagsArray[@]}" - ) - - echoCmd 'zig check flags' "${flagsArray[@]}" - zig build test "${flagsArray[@]}" - - runHook postCheck -} - -function zigInstallPhase { - runHook preInstall - - local flagsArray=( - "${zigDefaultFlagsArray[@]}" - $zigBuildFlags "${zigBuildFlagsArray[@]}" - $zigInstallFlags "${zigInstallFlagsArray[@]}" - ) - - if [ -z "${dontAddPrefix-}" ]; then - # Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/` - flagsArray+=("${prefixKey:---prefix}" "$prefix") - fi - - echoCmd 'zig install flags' "${flagsArray[@]}" - zig build install "${flagsArray[@]}" - - runHook postInstall -} - -addEnvHooks "$targetOffset" zigSetGlobalCacheDir - -if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then - buildPhase=zigBuildPhase -fi - -if [ -z "${dontUseZigCheck-}" ] && [ -z "${checkPhase-}" ]; then - checkPhase=zigCheckPhase -fi - -if [ -z "${dontUseZigInstall-}" ] && [ -z "${installPhase-}" ]; then - installPhase=zigInstallPhase -fi |