nixpkgs/pkgs/development/libraries/vulkan-loader/default.nix

67 lines
2.1 KiB
Nix
Raw Normal View History

{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
2017-01-30 01:15:34 +00:00
python3Packages, glslang, spirv-tools, x11, libxcb, libXrandr,
2017-03-27 03:28:30 +01:00
libXext, wayland, mesa_noglu, makeWrapper }:
2016-04-02 20:35:14 +01:00
let
2017-04-01 20:28:59 +01:00
version = "1.0.42.2";
2016-04-02 20:35:14 +01:00
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-LoaderAndValidationLayers";
rev = "sdk-${version}";
2017-04-01 20:28:59 +01:00
sha256 = "0na1ax2cgv6w29213mby56mndfsj3iizj3n5pbpy4s4p7ij9kdgn";
2016-04-02 20:35:14 +01:00
};
in
stdenv.mkDerivation rec {
name = "vulkan-loader-${version}";
inherit version src;
2016-04-02 20:35:14 +01:00
nativeBuildInputs = [ makeWrapper pkgconfig ];
buildInputs = [ cmake git python3 python3Packages.lxml
2017-01-30 01:15:34 +00:00
glslang spirv-tools x11 libxcb libXrandr libXext wayland
2016-04-02 20:35:14 +01:00
];
enableParallelBuilding = true;
2016-04-02 20:35:14 +01:00
2016-08-31 21:57:37 +01:00
cmakeFlags = [
2017-01-30 01:15:34 +00:00
"-DBUILD_WSI_MIR_SUPPORT=OFF"
"-DFALLBACK_DATA_DIRS=${mesa_noglu.driverLink}/share:/usr/local/share:/usr/share"
2016-08-31 21:57:37 +01:00
];
outputs = [ "out" "dev" "demos" ];
preConfigure = ''
checkRev() {
2017-01-30 01:15:34 +00:00
[ "$2" = $(cat "external_revisions/$1_revision") ] || (echo "ERROR: dependency $1 is revision $2 but should be revision" $(cat "external_revisions/$1_revision") && exit 1)
}
checkRev spirv-tools "${spirv-tools.src.rev}"
checkRev spirv-headers "${spirv-tools.headers.rev}"
checkRev glslang "${glslang.src.rev}"
'';
2016-04-02 20:35:14 +01:00
installPhase = ''
mkdir -p $out/lib $out/bin
cp -d loader/libvulkan.so* $out/lib
2016-04-02 20:35:14 +01:00
cp demos/vulkaninfo $out/bin
mkdir -p $out/lib $out/share/vulkan/explicit_layer.d
cp -d layers/*.so $out/lib/
cp -d layers/*.json $out/share/vulkan/explicit_layer.d/
sed -i "s:\\./lib:$out/lib/lib:g" "$out/share/vulkan/"*/*.json
mkdir -p $dev/include
cp -rv ../include $dev/
mkdir -p $demos/bin
2017-01-30 01:15:34 +00:00
cp demos/*.spv demos/*.ppm $demos/bin
find demos -type f -executable -not -name vulkaninfo -exec cp {} $demos/bin \;
2017-03-27 03:28:30 +01:00
for p in cube cubepp; do
wrapProgram $demos/bin/$p --run "cd $demos/bin"
done
'';
2016-04-02 20:35:14 +01:00
meta = with stdenv.lib; {
description = "LunarG Vulkan loader";
homepage = "http://www.lunarg.com";
2016-04-02 20:35:14 +01:00
platforms = platforms.linux;
license = licenses.asl20;
2017-04-01 20:28:59 +01:00
maintainers = [ maintainers.ralith ];
2016-04-02 20:35:14 +01:00
};
}