base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / gl / glslang / package.nix
blobe54d8711e65b74ce4b9fcc9e24c2a16ad2f6d25f
1 { lib, stdenv
2 , fetchFromGitHub
3 , bison
4 , cmake
5 , jq
6 , python3
7 , spirv-headers
8 , spirv-tools
9 }:
10 stdenv.mkDerivation rec {
11   pname = "glslang";
12   version = "15.0.0";
14   src = fetchFromGitHub {
15     owner = "KhronosGroup";
16     repo = "glslang";
17     rev = version;
18     hash = "sha256-QXNecJ6SDeWpRjzHRTdPJHob1H3q2HZmWuL2zBt2Tlw=";
19   };
21   outputs = [ "bin" "out" "dev" ];
23   # These get set at all-packages, keep onto them for child drvs
24   passthru = {
25     spirv-tools = spirv-tools;
26     spirv-headers = spirv-headers;
27   };
29   nativeBuildInputs = [ cmake python3 bison jq ];
31   cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
33   postPatch = ''
34     cp --no-preserve=mode -r "${spirv-tools.src}" External/spirv-tools
35     ln -s "${spirv-headers.src}" External/spirv-tools/external/spirv-headers
36   '';
38   # This is a dirty fix for lib/cmake/SPIRVTargets.cmake:51 which includes this directory
39   postInstall = ''
40     mkdir -p $dev/include/External
41     moveToOutput lib/pkgconfig "''${!outputDev}"
42     moveToOutput lib/cmake "''${!outputDev}"
43   '';
45   # Fix the paths in .pc, even though it's unclear if these .pc are really useful.
46   postFixup = ''
47     substituteInPlace $dev/lib/pkgconfig/*.pc \
48       --replace-fail '=''${prefix}//' '=/' \
49       --replace-fail "includedir=$dev/$dev" "includedir=$dev"
51     # add a symlink for backwards compatibility
52     ln -s $bin/bin/glslang $bin/bin/glslangValidator
53   '';
55   meta = with lib; {
56     inherit (src.meta) homepage;
57     description = "Khronos reference front-end for GLSL and ESSL";
58     license = licenses.asl20;
59     platforms = platforms.unix;
60     maintainers = [ maintainers.ralith ];
61   };