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 , hwdata
, libX11 , libX11
, mangohud32 , mangohud32
, vulkan-headers
, appstream , appstream
, glslang , glslang
, makeWrapper , makeWrapper
@ -22,7 +21,6 @@
, ninja , ninja
, pkg-config , pkg-config
, unzip , unzip
, vulkan-loader
, libXNVCtrl , libXNVCtrl
, wayland , wayland
, glew , glew
@ -69,6 +67,21 @@ let
sha256 = "sha256-PDjyddV5KxKGORECWUMp6YsXc3kks0T5gxKrCZKbdL4="; 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 { in stdenv.mkDerivation rec {
pname = "mangohud"; pname = "mangohud";
version = "0.6.8"; version = "0.6.8";
@ -88,8 +101,11 @@ in stdenv.mkDerivation rec {
cd "$sourceRoot/subprojects" cd "$sourceRoot/subprojects"
cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version} 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 ${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 = [ patches = [
# Hard code dependencies. Can't use makeWrapper since the Vulkan # Hard code dependencies. Can't use makeWrapper since the Vulkan
# layer can be used without the mangohud executable by setting MANGOHUD=1. # layer can be used without the mangohud executable by setting MANGOHUD=1.
@ -126,11 +142,10 @@ in stdenv.mkDerivation rec {
cd subprojects cd subprojects
unzip ${imgui.patch} unzip ${imgui.patch}
unzip ${spdlog.patch} unzip ${spdlog.patch}
unzip ${vulkan-headers.patch}
)''; )'';
mesonFlags = [ mesonFlags = [
"-Duse_system_vulkan=enabled"
"-Dvulkan_datadir=${vulkan-headers}/share"
"-Dwith_wayland=enabled" "-Dwith_wayland=enabled"
] ++ lib.optionals gamescopeSupport [ ] ++ lib.optionals gamescopeSupport [
"-Dmangoapp_layer=true" "-Dmangoapp_layer=true"
@ -147,7 +162,6 @@ in stdenv.mkDerivation rec {
ninja ninja
pkg-config pkg-config
unzip unzip
vulkan-loader
]; ];
buildInputs = [ buildInputs = [
@ -159,7 +173,6 @@ in stdenv.mkDerivation rec {
glew glew
glfw glfw
nlohmann_json nlohmann_json
vulkan-headers
xorg.libXrandr xorg.libXrandr
]; ];