2016-08-31 13:29:40 +03:00
|
|
|
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
|
2016-08-31 23:57:37 +03:00
|
|
|
python3Packages, glslang, spirv-tools, x11, libxcb, wayland }:
|
2016-04-02 22:35:14 +03:00
|
|
|
|
2016-09-18 08:19:40 +03:00
|
|
|
let
|
|
|
|
version = "1.0.26.0";
|
2016-04-02 22:35:14 +03:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "Vulkan-LoaderAndValidationLayers";
|
2016-09-18 08:19:40 +03:00
|
|
|
rev = "sdk-${version}";
|
|
|
|
sha256 = "157m746hc76xrxd3qq0f44f5dy7pjbz8cx74ykqrlbc7rmpjpk58";
|
2016-04-02 22:35:14 +03:00
|
|
|
};
|
2016-09-18 08:19:40 +03:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "vulkan-loader-${version}";
|
|
|
|
inherit version src;
|
2016-04-02 22:35:14 +03:00
|
|
|
|
2016-10-22 12:35:56 +03:00
|
|
|
prePatch = ''
|
|
|
|
if [ "$(cat '${src}/spirv-tools_revision')" != '${spirv-tools.src.rev}' ] \
|
|
|
|
|| [ "$(cat '${src}/spirv-headers_revision')" != '${spirv-tools.headers.rev}' ] \
|
|
|
|
|| [ "$(cat '${src}/glslang_revision')" != '${glslang.src.rev}' ]
|
|
|
|
then
|
|
|
|
echo "Version mismatch, aborting!"
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2016-08-31 13:29:40 +03:00
|
|
|
buildInputs = [ cmake pkgconfig git python3 python3Packages.lxml
|
2016-08-31 23:57:37 +03:00
|
|
|
glslang spirv-tools x11 libxcb wayland
|
2016-04-02 22:35:14 +03:00
|
|
|
];
|
2016-09-18 08:19:40 +03:00
|
|
|
enableParallelBuilding = true;
|
2016-04-02 22:35:14 +03:00
|
|
|
|
2016-08-31 23:57:37 +03:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_WSI_WAYLAND_SUPPORT=ON" # XLIB/XCB supported by default
|
|
|
|
];
|
|
|
|
|
2016-10-11 19:50:52 +03:00
|
|
|
patches = [ ./use-xdg-paths.patch ];
|
|
|
|
|
2016-09-25 23:33:09 +03:00
|
|
|
outputs = [ "out" "dev" "demos" ];
|
|
|
|
|
2016-09-24 19:42:18 +03:00
|
|
|
preConfigure = ''
|
|
|
|
checkRev() {
|
|
|
|
[ "$2" = $(cat "$1_revision") ] || (echo "ERROR: dependency $1 is revision $2 but should be revision" $(cat "$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 22:35:14 +03:00
|
|
|
installPhase = ''
|
2016-09-25 23:33:09 +03:00
|
|
|
mkdir -p $out/lib $out/bin
|
|
|
|
cp -d loader/libvulkan.so* $out/lib
|
2016-04-02 22:35:14 +03:00
|
|
|
cp demos/vulkaninfo $out/bin
|
2016-10-11 19:50:52 +03:00
|
|
|
mkdir -p $out/lib $out/share/vulkan/explicit_layer.d
|
2016-09-25 23:33:09 +03:00
|
|
|
cp -d layers/*.so $out/lib/
|
2016-10-11 19:50:52 +03:00
|
|
|
cp -d layers/*.json $out/share/vulkan/explicit_layer.d/
|
|
|
|
sed -i "s:\\./lib:$out/lib/lib:g" "$out/share/vulkan/"*/*.json
|
2016-09-25 23:33:09 +03:00
|
|
|
mkdir -p $dev/include
|
|
|
|
cp -rv ../include $dev/
|
|
|
|
mkdir -p $demos/bin
|
|
|
|
cp demos/smoketest demos/tri demos/cube demos/*.spv demos/*.ppm $demos/bin
|
|
|
|
'';
|
2016-04-02 22:35:14 +03:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "LunarG Vulkan loader";
|
2017-01-04 12:56:26 +03:00
|
|
|
homepage = "http://www.lunarg.com";
|
2016-04-02 22:35:14 +03:00
|
|
|
platforms = platforms.linux;
|
2017-01-04 12:56:26 +03:00
|
|
|
license = licenses.asl20;
|
2016-04-02 22:35:14 +03:00
|
|
|
};
|
|
|
|
}
|