lol
1{ lib, stdenv
2, fetchFromGitHub
3, bison
4, cmake
5, jq
6, python3
7, spirv-headers
8, spirv-tools
9}:
10stdenv.mkDerivation rec {
11 pname = "glslang";
12 version = "1.3.231.0";
13
14 src = fetchFromGitHub {
15 owner = "KhronosGroup";
16 repo = "glslang";
17 rev = "sdk-${version}";
18 hash = "sha256-huPrQr+lPi7QCF8CufAavHEKGDDimGrcskiojhH9QYk=";
19 };
20
21 # These get set at all-packages, keep onto them for child drvs
22 passthru = {
23 spirv-tools = spirv-tools;
24 spirv-headers = spirv-headers;
25 };
26
27 nativeBuildInputs = [ cmake python3 bison jq ];
28
29 postPatch = ''
30 cp --no-preserve=mode -r "${spirv-tools.src}" External/spirv-tools
31 ln -s "${spirv-headers.src}" External/spirv-tools/external/spirv-headers
32 '';
33
34 # This is a dirty fix for lib/cmake/SPIRVTargets.cmake:51 which includes this directory
35 postInstall = ''
36 mkdir $out/include/External
37 '';
38
39 # Fix the paths in .pc, even though it's unclear if these .pc are really useful.
40 postFixup = ''
41 substituteInPlace "$out"/lib/pkgconfig/SPIRV-Tools{,-shared}.pc \
42 --replace '=''${prefix}//' '=/'
43 '';
44
45 meta = with lib; {
46 inherit (src.meta) homepage;
47 description = "Khronos reference front-end for GLSL and ESSL";
48 license = licenses.asl20;
49 platforms = platforms.unix;
50 maintainers = [ maintainers.ralith ];
51 };
52}