nixpkgs/pkgs/development/compilers/shaderc/default.nix

59 lines
1.9 KiB
Nix
Raw Normal View History

2019-06-08 18:56:31 +00:00
{ stdenv, fetchFromGitHub, cmake, python3 }:
2018-06-27 03:13:06 +00:00
# Like many google projects, shaderc doesn't gracefully support separately compiled dependencies, so we can't easily use
# the versions of glslang and spirv-tools used by vulkan-loader. Exact revisions are taken from
# https://github.com/google/shaderc/blob/known-good/known_good.json
2016-09-18 05:44:07 +00:00
2018-06-27 03:13:06 +00:00
# Future work: extract and fetch all revisions automatically based on a revision of shaderc's known-good branch.
let
glslang = fetchFromGitHub {
owner = "KhronosGroup";
repo = "glslang";
2019-06-08 18:56:31 +00:00
rev = "d3692c701b1265955221aa0d6ebc656bc4442b2a";
sha256 = "11cvwbzlpr4zrcmmyd9h0kbfhmhr6r696ydmn0yp1jrixby4bmji";
2018-06-27 03:13:06 +00:00
};
spirv-tools = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
2019-06-08 18:56:31 +00:00
rev = "08cc49ec59c3ff4d6bd4bb4f2097ede35e802158";
sha256 = "1xhgcppx02fp3nr7654mr3qrgy1fxlxdyl87jhmn3k9jf24gmmmz";
2018-06-27 03:13:06 +00:00
};
spirv-headers = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Headers";
2019-06-08 18:56:31 +00:00
rev = "8b911bd2ba37677037b38c9bd286c7c05701bcda";
sha256 = "0qdnj34bkagszyvci6ifpqd7iqvybhmqzvc9lvqnls44qg90aqh2";
2018-06-27 03:13:06 +00:00
};
in stdenv.mkDerivation rec {
pname = "shaderc";
2019-06-08 18:56:31 +00:00
version = "2019.0";
2016-09-18 05:44:07 +00:00
2019-01-19 11:37:05 +00:00
outputs = [ "out" "lib" "bin" "dev" "static" ];
2016-09-18 05:44:07 +00:00
src = fetchFromGitHub {
owner = "google";
repo = "shaderc";
rev = "v${version}";
2019-06-08 18:56:31 +00:00
sha256 = "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2";
2016-09-18 05:44:07 +00:00
};
patchPhase = ''
2018-06-27 03:13:06 +00:00
cp -r --no-preserve=mode ${glslang} third_party/glslang
cp -r --no-preserve=mode ${spirv-tools} third_party/spirv-tools
ln -s ${spirv-headers} third_party/spirv-tools/external/spirv-headers
2016-09-18 05:44:07 +00:00
'';
2019-06-08 18:56:31 +00:00
nativeBuildInputs = [ cmake python3 ];
2019-01-19 11:37:05 +00:00
postInstall = ''
moveToOutput "lib/*.a" $static
'';
2018-06-27 03:13:06 +00:00
cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" ];
2016-09-18 05:44:07 +00:00
meta = with stdenv.lib; {
inherit (src.meta) homepage;
description = "A collection of tools, libraries and tests for shader compilation.";
2019-01-19 11:40:21 +00:00
license = [ licenses.asl20 ];
2016-09-18 05:44:07 +00:00
};
}