base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / tools / graphics / directx-shader-compiler / default.nix
blobbd5d00aa50d11284c80929774cb575092a97e02e
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   ninja,
7   python3,
8   git,
9 }:
11 stdenv.mkDerivation (finalAttrs: {
12   pname = "directx-shader-compiler";
13   version = "1.8.2407";
15   # Put headers in dev, there are lot of them which aren't necessary for
16   # using the compiler binary.
17   outputs = [
18     "out"
19     "dev"
20   ];
22   src = fetchFromGitHub {
23     owner = "microsoft";
24     repo = "DirectXShaderCompiler";
25     rev = "v${finalAttrs.version}";
26     hash = "sha256-7quRcuY3SAuGuS4Slz476WxJ7GHMjJmT2Jmb8kdmsI8=";
27     fetchSubmodules = true;
28   };
30   nativeBuildInputs = [
31     cmake
32     git
33     ninja
34     python3
35   ];
37   cmakeFlags = [ "-C../cmake/caches/PredefinedParams.cmake" ];
39   # The default install target installs heaps of LLVM stuff.
40   #
41   # Upstream issue: https://github.com/microsoft/DirectXShaderCompiler/issues/3276
42   #
43   # The following is based on the CI script:
44   # https://github.com/microsoft/DirectXShaderCompiler/blob/master/appveyor.yml#L63-L66
45   installPhase = ''
46     runHook preInstall
47     mkdir -p $out/bin $out/lib $dev/include
48     mv bin/dxc* $out/bin/
49     mv lib/libdxcompiler.so* lib/libdxcompiler.*dylib $out/lib/
50     cp -r $src/include/dxc $dev/include/
51     runHook postInstall
52   '';
54   meta = {
55     description = "Compiler to compile HLSL programs into DXIL and SPIR-V";
56     homepage = "https://github.com/microsoft/DirectXShaderCompiler";
57     platforms = with lib.platforms; linux ++ darwin;
58     license = lib.licenses.ncsa;
59     maintainers = with lib.maintainers; [ Flakebi ];
60   };