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-07-28 02:37:12 +01:00
|
|
|
rev = "3ee5f2f1d3316e228916788b300d786bb574d337";
|
|
|
|
sha256 = "1l5h9d92mzd35pgs0wibqfg7vbl771lwnvdlcsyhf6999khn5dzv";
|
2018-06-27 04:13:06 +01:00
|
|
|
};
|
|
|
|
spirv-tools = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Tools";
|
2020-07-28 02:37:12 +01:00
|
|
|
rev = "b63f0e5ed3e818870968ebf6af73317127fd07b0";
|
|
|
|
sha256 = "1chv30azfp76nha428ivg4ixrij6d8pxj5kn3jam87gmkmgc9zhm";
|
2018-06-27 04:13:06 +01:00
|
|
|
};
|
|
|
|
spirv-headers = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Headers";
|
2020-07-28 02:37:12 +01:00
|
|
|
rev = "979924c8bc839e4cb1b69d03d48398551f369ce7";
|
|
|
|
sha256 = "07vyjlblpm4zhfds612h86lnz0qvrj5qqw5z2zzfa3m9fax7cm85";
|
2018-06-27 04:13:06 +01:00
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "shaderc";
|
2020-07-28 02:37:12 +01:00
|
|
|
version = "2020.2";
|
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";
|
2019-01-19 12:25:00 +00:00
|
|
|
rev = "v${version}";
|
2020-07-28 02:37:12 +01:00
|
|
|
sha256 = "1sxz8872x3rdlrhmbn83r1vniq4j51jnk0ka3447fq68il4myf1w";
|
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;
|
2020-10-11 06:55:05 +01:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|