nixpkgs/pkgs/tools/graphics/directx-shader-compiler/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

51 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, python3, git }:
stdenv.mkDerivation rec {
pname = "directx-shader-compiler";
version = "1.5.2010";
# Put headers in dev, there are lot of them which aren't necessary for
# using the compiler binary.
outputs = [ "out" "dev" ];
src = fetchFromGitHub {
owner = "microsoft";
repo = "DirectXShaderCompiler";
rev = "v${version}";
sha256 = "0ccfy1bfp0cm0pq63ri4yl1sr3fdn1a526bsnakg4bl6z4fwrnnj";
# We rely on the side effect of leaving the .git directory here for the
# version-grabbing functionality of the build system.
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake git python3 ];
configurePhase = ''
# Requires some additional flags to cmake from a file in the repo
additionalCMakeFlags=$(< utils/cmake-predefined-config-params)
cmakeFlags="$additionalCMakeFlags''${cmakeFlags:+ $cmakeFlags}"
cmakeConfigurePhase
'';
# The default install target installs heaps of LLVM stuff.
#
# Upstream issue: https://github.com/microsoft/DirectXShaderCompiler/issues/3276
#
# The following is based on the CI script:
# https://github.com/microsoft/DirectXShaderCompiler/blob/master/appveyor.yml#L63-L66
installPhase = ''
mkdir -p $out/bin $out/lib $dev/include
mv bin/dxc* $out/bin/
mv lib/libdxcompiler.so* lib/libdxcompiler.*dylib $out/lib/
cp -r $src/include/dxc $dev/include/
'';
meta = with lib; {
description = "A compiler to compile HLSL programs into DXIL and SPIR-V";
homepage = "https://github.com/microsoft/DirectXShaderCompiler";
platforms = with platforms; linux ++ darwin;
license = licenses.ncsa;
maintainers = with maintainers; [ expipiplus1 ];
};
}