2016-08-31 10:29:40 +00:00
|
|
|
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
|
2017-01-30 01:15:34 +00:00
|
|
|
python3Packages, glslang, spirv-tools, x11, libxcb, libXrandr,
|
2018-02-24 12:06:44 +00:00
|
|
|
libXext, wayland, libGL, makeWrapper }:
|
2016-04-02 19:35:14 +00:00
|
|
|
|
2016-09-18 05:19:40 +00:00
|
|
|
let
|
2018-03-23 04:32:24 +00:00
|
|
|
version = "1.1.70.0";
|
2016-04-02 19:35:14 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "Vulkan-LoaderAndValidationLayers";
|
2016-09-18 05:19:40 +00:00
|
|
|
rev = "sdk-${version}";
|
2018-03-23 04:32:24 +00:00
|
|
|
sha256 = "1a7xwl65bi03l4zbjq54qkxjb8kb4m78qvw8bas5alhf9v6i6yqp";
|
2016-04-02 19:35:14 +00:00
|
|
|
};
|
2016-09-18 05:19:40 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "vulkan-loader-${version}";
|
|
|
|
inherit version src;
|
2016-04-02 19:35:14 +00:00
|
|
|
|
2017-09-05 22:03:42 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper pkgconfig ];
|
2017-09-05 21:26:13 +00:00
|
|
|
buildInputs = [ cmake git python3 python3Packages.lxml
|
2018-03-23 04:32:24 +00:00
|
|
|
glslang x11 libxcb libXrandr libXext wayland
|
2016-04-02 19:35:14 +00:00
|
|
|
];
|
2016-09-18 05:19:40 +00:00
|
|
|
enableParallelBuilding = true;
|
2016-04-02 19:35:14 +00:00
|
|
|
|
2016-08-31 20:57:37 +00:00
|
|
|
cmakeFlags = [
|
2017-01-30 01:15:34 +00:00
|
|
|
"-DBUILD_WSI_MIR_SUPPORT=OFF"
|
2018-02-24 12:06:44 +00:00
|
|
|
"-DFALLBACK_DATA_DIRS=${libGL.driverLink}/share:/usr/local/share:/usr/share"
|
2016-08-31 20:57:37 +00:00
|
|
|
];
|
|
|
|
|
2016-09-25 20:33:09 +00:00
|
|
|
outputs = [ "out" "dev" "demos" ];
|
2018-03-23 04:32:24 +00:00
|
|
|
patches = [ ./rev-file.patch ];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
# Hack so a version header can be generated. Relies on ./rev-file.patch to work.
|
|
|
|
mkdir -p "$sourceRoot/external/glslang/External"
|
|
|
|
echo "${spirv-tools.src.rev}" > "$sourceRoot/external/glslang/External/spirv-tools"
|
|
|
|
'';
|
2016-09-25 20:33:09 +00:00
|
|
|
|
2016-09-24 16:42:18 +00:00
|
|
|
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)
|
2016-09-24 16:42:18 +00:00
|
|
|
}
|
|
|
|
checkRev glslang "${glslang.src.rev}"
|
|
|
|
'';
|
|
|
|
|
2016-04-02 19:35:14 +00:00
|
|
|
installPhase = ''
|
2016-09-25 20:33:09 +00:00
|
|
|
mkdir -p $out/lib $out/bin
|
|
|
|
cp -d loader/libvulkan.so* $out/lib
|
2016-04-02 19:35:14 +00:00
|
|
|
cp demos/vulkaninfo $out/bin
|
2016-10-11 16:50:52 +00:00
|
|
|
mkdir -p $out/lib $out/share/vulkan/explicit_layer.d
|
2016-09-25 20:33:09 +00:00
|
|
|
cp -d layers/*.so $out/lib/
|
2016-10-11 16:50:52 +00: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 20:33:09 +00:00
|
|
|
mkdir -p $dev/include
|
|
|
|
cp -rv ../include $dev/
|
2017-12-13 19:18:11 +00:00
|
|
|
mkdir -p $demos/share/vulkan-demos
|
|
|
|
cp demos/*.spv demos/*.ppm $demos/share/vulkan-demos
|
2016-09-25 20:33:09 +00:00
|
|
|
mkdir -p $demos/bin
|
2017-12-13 19:18:11 +00:00
|
|
|
find demos -type f -executable -not -name vulkaninfo -exec cp -v {} $demos/bin \;
|
2017-03-27 02:28:30 +00:00
|
|
|
for p in cube cubepp; do
|
2017-12-13 19:18:11 +00:00
|
|
|
wrapProgram $demos/bin/$p --run "cd $demos/share/vulkan-demos"
|
2017-03-27 02:28:30 +00:00
|
|
|
done
|
|
|
|
'';
|
2016-04-02 19:35:14 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "LunarG Vulkan loader";
|
2017-01-04 09:56:26 +00:00
|
|
|
homepage = "http://www.lunarg.com";
|
2016-04-02 19:35:14 +00:00
|
|
|
platforms = platforms.linux;
|
2017-01-04 09:56:26 +00:00
|
|
|
license = licenses.asl20;
|
2017-04-01 19:28:59 +00:00
|
|
|
maintainers = [ maintainers.ralith ];
|
2016-04-02 19:35:14 +00:00
|
|
|
};
|
|
|
|
}
|