3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/shaderc/default.nix

59 lines
1.9 KiB
Nix
Raw Normal View History

2019-06-08 19:56:31 +01:00
{ stdenv, fetchFromGitHub, cmake, python3 }:
2018-06-27 04:13:06 +01: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 06:44:07 +01:00
2018-06-27 04:13:06 +01: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";
2020-01-29 07:06:46 +00:00
rev = "3ed344dd784ecbbc5855e613786f3a1238823e56";
sha256 = "00s2arfvw78d9k9fmangqlkvkmkpqzrin3g91vfab4wr8srb09dx";
2018-06-27 04:13:06 +01:00
};
spirv-tools = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
2020-01-29 07:06:46 +00:00
rev = "323a81fc5e30e43a04e5e22af4cba98ca2a161e6";
sha256 = "1kwyh95l02w3v1ra55c836wayzw8d0m14ab7wf0ynhhyp3k2p9hv";
2018-06-27 04:13:06 +01:00
};
spirv-headers = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Headers";
2020-01-29 07:06:46 +00:00
rev = "204cd131c42b90d129073719f2766293ce35c081";
sha256 = "1gp0mlbfccqnalaix97jxsa5i337xyzyr55wgssapy56p0q04wv2";
2018-06-27 04:13:06 +01:00
};
in stdenv.mkDerivation rec {
pname = "shaderc";
2020-01-29 07:06:46 +00:00
version = "2019.1";
2016-09-18 06:44:07 +01:00
2019-01-19 11:37:05 +00:00
outputs = [ "out" "lib" "bin" "dev" "static" ];
2016-09-18 06:44:07 +01:00
src = fetchFromGitHub {
owner = "google";
repo = "shaderc";
rev = "v${version}";
2020-01-29 07:06:46 +00:00
sha256 = "0x514rpignnb4vvl7wmijfakqc59986knjw3dh1zx0ah42xa7x37";
2016-09-18 06:44:07 +01:00
};
patchPhase = ''
2018-06-27 04:13:06 +01: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 06:44:07 +01:00
'';
2019-06-08 19:56:31 +01:00
nativeBuildInputs = [ cmake python3 ];
2019-01-19 11:37:05 +00:00
postInstall = ''
moveToOutput "lib/*.a" $static
'';
2018-06-27 04:13:06 +01:00
cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" ];
2016-09-18 06:44:07 +01: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 06:44:07 +01:00
};
}