Merge pull request #225985 from K900/mangohud-fix

mangohud: use vendored vulkan-headers to fix build
This commit is contained in:
Kira Bruneau 2023-04-13 09:27:01 -04:00 committed by GitHub
commit 2baa9a713c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,6 @@
, hwdata
, libX11
, mangohud32
, vulkan-headers
, appstream
, glslang
, makeWrapper
@ -22,7 +21,6 @@
, ninja
, pkg-config
, unzip
, vulkan-loader
, libXNVCtrl
, wayland
, glew
@ -69,6 +67,21 @@ let
sha256 = "sha256-PDjyddV5KxKGORECWUMp6YsXc3kks0T5gxKrCZKbdL4=";
};
};
# Derived from subprojects/vulkan-headers.wrap
vulkan-headers = rec {
version = "1.2.158";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Headers";
rev = "v${version}";
hash = "sha256-5uyk2nMwV1MjXoa3hK/WUeGLwpINJJEvY16kc5DEaks=";
};
patch = fetchurl {
url = "https://wrapdb.mesonbuild.com/v2/vulkan-headers_${version}-2/get_patch";
hash = "sha256-hgNYz15z9FjNHoj4w4EW0SOrQh1c4uQSnsOOrt2CDhc=";
};
};
in stdenv.mkDerivation rec {
pname = "mangohud";
version = "0.6.8";
@ -88,8 +101,11 @@ in stdenv.mkDerivation rec {
cd "$sourceRoot/subprojects"
cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version}
cp -R --no-preserve=mode,ownership ${spdlog.src} spdlog-${spdlog.version}
cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version}
)'';
env.NIX_CFLAGS_COMPILE = "-I${vulkan-headers.src}/include";
patches = [
# Hard code dependencies. Can't use makeWrapper since the Vulkan
# layer can be used without the mangohud executable by setting MANGOHUD=1.
@ -126,11 +142,10 @@ in stdenv.mkDerivation rec {
cd subprojects
unzip ${imgui.patch}
unzip ${spdlog.patch}
unzip ${vulkan-headers.patch}
)'';
mesonFlags = [
"-Duse_system_vulkan=enabled"
"-Dvulkan_datadir=${vulkan-headers}/share"
"-Dwith_wayland=enabled"
] ++ lib.optionals gamescopeSupport [
"-Dmangoapp_layer=true"
@ -147,7 +162,6 @@ in stdenv.mkDerivation rec {
ninja
pkg-config
unzip
vulkan-loader
];
buildInputs = [
@ -159,7 +173,6 @@ in stdenv.mkDerivation rec {
glew
glfw
nlohmann_json
vulkan-headers
xorg.libXrandr
];