diff options
author | Randy Eckenrode <randy@largeandhighquality.com> | 2023-01-26 23:38:10 -0500 |
---|---|---|
committer | Randy Eckenrode <randy@largeandhighquality.com> | 2023-01-28 14:42:55 -0500 |
commit | 67a2ceab6a9529413304cfe5ffed7c6383d88334 (patch) | |
tree | 68c6d5d880fcfd95feb16dc623a0231bb73504a2 /pkgs/misc | |
parent | 403fe21323e4d33021ef296d0057cdd08f6c3c17 (diff) |
dxvk: add native Linux build
Diffstat (limited to 'pkgs/misc')
-rw-r--r-- | pkgs/misc/dxvk/dxvk.nix | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/pkgs/misc/dxvk/dxvk.nix b/pkgs/misc/dxvk/dxvk.nix index 9e00ecc343a7..e0a104ff354e 100644 --- a/pkgs/misc/dxvk/dxvk.nix +++ b/pkgs/misc/dxvk/dxvk.nix @@ -8,6 +8,7 @@ , dxvkVersion , spirv-headers , vulkan-headers +, SDL2 }: let @@ -41,23 +42,31 @@ let owner = "doitsujin"; repo = "dxvk"; rev = "v${version}"; - hash = "sha256-mboVLdPgZMzmqyeF0jAloEz6xqfIDiY/X98e7l2KZnw="; + hash = "sha256-mSNFvoILsvm+CpWV7uRlb7DkjV7ctClSUdteNcF5EAY="; + fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info }; patches = [ ]; }; }; + + isWindows = stdenv.targetPlatform.uname.system == "Windows"; + isCross = stdenv.hostPlatform != stdenv.targetPlatform; in stdenv.mkDerivation { pname = "dxvk"; inherit (srcs.${dxvkVersion}) version src patches; nativeBuildInputs = [ glslang meson ninja ]; - buildInputs = [ windows.pthreads ] - ++ lib.optionals isDxvk2 [ spirv-headers vulkan-headers ]; + buildInputs = lib.optional isWindows [ windows.pthreads ] + ++ lib.optionals isDxvk2 ( + [ spirv-headers vulkan-headers ] + ++ lib.optional (!isWindows && sdl2Support) SDL2 + ); - preConfigure = lib.optionalString isDxvk2 '' - ln -s ${lib.getDev spirv-headers}/include include/spirv/include - ln -s ${lib.getDev vulkan-headers}/include include/vulkan/include + # Build with the Vulkan SDK in nixpkgs. + preConfigure = '' + rm -rf include/spirv/include include/vulkan/include + mkdir -p include/spirv/include include/vulkan/include ''; mesonFlags = @@ -66,9 +75,11 @@ stdenv.mkDerivation { in [ "--buildtype" "release" - "--cross-file" "build-win${arch}.txt" "--prefix" "${placeholder "out"}" - ]; + ] + ++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ]; + + doCheck = isDxvk2 && !isCross; meta = { description = "A Vulkan-based translation layer for Direct3D 9/10/11"; @@ -76,6 +87,6 @@ stdenv.mkDerivation { changelog = "https://github.com/doitsujin/dxvk/releases"; maintainers = [ lib.maintainers.reckenrode ]; license = lib.licenses.zlib; - platforms = lib.platforms.windows; + platforms = lib.platforms.windows ++ lib.optionals isDxvk2 lib.platforms.linux; }; } |