mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +00:00
63 lines
1.2 KiB
Nix
63 lines
1.2 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, llvmPackages
|
|
, libxml2
|
|
, zlib
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "zig";
|
|
version = "0.9.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ziglang";
|
|
repo = pname;
|
|
rev = version;
|
|
hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k=";
|
|
};
|
|
|
|
# Fix index out of bounds reading RPATH (cherry-picked from 0.10-dev)
|
|
patches = [ ./rpath.patch ];
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
llvmPackages.llvm.dev
|
|
];
|
|
|
|
buildInputs = [
|
|
libxml2
|
|
zlib
|
|
] ++ (with llvmPackages; [
|
|
libclang
|
|
lld
|
|
llvm
|
|
]);
|
|
|
|
preBuild = ''
|
|
export HOME=$TMPDIR;
|
|
'';
|
|
|
|
cmakeFlags = [
|
|
# file RPATH_CHANGE could not write new RPATH
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
|
];
|
|
|
|
doCheck = true;
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig
|
|
runHook postCheck
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://ziglang.org/";
|
|
description =
|
|
"General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ aiotter andrewrk AndersonTorres ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|