2021-01-22 11:25:31 +00:00
|
|
|
{ lib, 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";
|
2021-06-04 14:22:35 +01:00
|
|
|
rev = "18eef33bd7a4bf5ad8c69f99cb72022608cf6e73";
|
|
|
|
sha256 = "sha256-tkWVvYmSpJPaZ8VJOkAWndDWhA0PiHAkR3feBAo+knM=";
|
2018-06-27 04:13:06 +01:00
|
|
|
};
|
|
|
|
spirv-tools = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Tools";
|
2021-06-04 14:22:35 +01:00
|
|
|
rev = "c2d5375fa7cc87c93f692e7200d5d974283d4391";
|
|
|
|
sha256 = "sha256-tMJRljrlH+qb+27rTn+3LuEyMOVpiU0zSCiGNfUTb6g=";
|
2018-06-27 04:13:06 +01:00
|
|
|
};
|
|
|
|
spirv-headers = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Headers";
|
2021-06-04 14:22:35 +01:00
|
|
|
rev = "0c28b6451d77774912e52949c1e57fa726edf113";
|
|
|
|
sha256 = "sha256-KpCMceTV/BRaoJe1qeXhKYQNQqdGaM6Q9nklpJKzHFY=";
|
2018-06-27 04:13:06 +01:00
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "shaderc";
|
2021-06-04 14:22:35 +01:00
|
|
|
version = "2021.0";
|
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}";
|
2021-06-04 14:22:35 +01:00
|
|
|
sha256 = "sha256-RfSMzrGVtdXbr/mjSrHoN447e3vMQfJbesQMvLOARBs=";
|
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
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2016-09-18 06:44:07 +01:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|