mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 11:40:45 +00:00
dxvk: migrate to by-name
This commit is contained in:
parent
961e8be9ea
commit
26f624d940
57
pkgs/by-name/dx/dxvk_1/package.nix
Normal file
57
pkgs/by-name/dx/dxvk_1/package.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, glslang
|
||||
, meson
|
||||
, ninja
|
||||
, windows
|
||||
, pkgsBuildHost
|
||||
, enableMoltenVKCompat ? false
|
||||
}:
|
||||
|
||||
let
|
||||
isCross = stdenv.hostPlatform != stdenv.targetPlatform;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "dxvk";
|
||||
version = "1.10.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "doitsujin";
|
||||
repo = "dxvk";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
|
||||
};
|
||||
|
||||
# These patches are required when using DXVK with Wine on Darwin.
|
||||
patches = lib.optionals enableMoltenVKCompat [
|
||||
# Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
|
||||
# Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
|
||||
./darwin-dxvk-compat.patch
|
||||
# Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
|
||||
# See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
|
||||
./darwin-thread-primitives.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ glslang meson ninja ];
|
||||
buildInputs = [ windows.pthreads ];
|
||||
|
||||
mesonFlags =
|
||||
let
|
||||
arch = if stdenv.is32bit then "32" else "64";
|
||||
in
|
||||
[
|
||||
"--buildtype" "release"
|
||||
"--prefix" "${placeholder "out"}"
|
||||
]
|
||||
++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ];
|
||||
|
||||
meta = {
|
||||
description = "A Vulkan-based translation layer for Direct3D 9/10/11";
|
||||
homepage = "https://github.com/doitsujin/dxvk";
|
||||
changelog = "https://github.com/doitsujin/dxvk/releases";
|
||||
maintainers = [ lib.maintainers.reckenrode ];
|
||||
license = lib.licenses.zlib;
|
||||
platforms = lib.platforms.windows;
|
||||
};
|
||||
})
|
77
pkgs/by-name/dx/dxvk_2/package.nix
Normal file
77
pkgs/by-name/dx/dxvk_2/package.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, pkgsBuildHost
|
||||
, glslang
|
||||
, meson
|
||||
, ninja
|
||||
, windows
|
||||
, spirv-headers
|
||||
, vulkan-headers
|
||||
, SDL2
|
||||
, glfw
|
||||
, gitUpdater
|
||||
, sdl2Support ? true
|
||||
, glfwSupport ? false
|
||||
}:
|
||||
|
||||
# SDL2 and GLFW support are mutually exclusive.
|
||||
assert !sdl2Support || !glfwSupport;
|
||||
|
||||
let
|
||||
isCross = stdenv.hostPlatform != stdenv.targetPlatform;
|
||||
isWindows = stdenv.hostPlatform.uname.system == "Windows";
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "dxvk";
|
||||
version = "2.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "doitsujin";
|
||||
repo = "dxvk";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-RU+B0XfphD5HHW/vSzqHLUaGS3E31d5sOLp3lMmrCB8=";
|
||||
fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace "subprojects/libdisplay-info/tool/gen-search-table.py" \
|
||||
--replace "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ glslang meson ninja ];
|
||||
buildInputs = [ spirv-headers vulkan-headers ]
|
||||
++ lib.optionals (!isWindows && sdl2Support) [ SDL2 ]
|
||||
++ lib.optionals (!isWindows && glfwSupport) [ glfw ]
|
||||
++ lib.optionals isWindows [ windows.pthreads ];
|
||||
|
||||
# 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 =
|
||||
let
|
||||
arch = if stdenv.is32bit then "32" else "64";
|
||||
in
|
||||
[
|
||||
"--buildtype" "release"
|
||||
"--prefix" "${placeholder "out"}"
|
||||
]
|
||||
++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ]
|
||||
++ lib.optional glfwSupport "-Ddxvk_native_wsi=glfw";
|
||||
|
||||
doCheck = !isCross;
|
||||
|
||||
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
|
||||
|
||||
meta = {
|
||||
description = "A Vulkan-based translation layer for Direct3D 9/10/11";
|
||||
homepage = "https://github.com/doitsujin/dxvk";
|
||||
changelog = "https://github.com/doitsujin/dxvk/releases";
|
||||
maintainers = [ lib.maintainers.reckenrode ];
|
||||
license = lib.licenses.zlib;
|
||||
platforms = lib.platforms.windows ++ lib.platforms.linux;
|
||||
};
|
||||
})
|
|
@ -1,114 +0,0 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, glslang
|
||||
, meson
|
||||
, ninja
|
||||
, windows
|
||||
, dxvkVersion ? "default"
|
||||
, spirv-headers
|
||||
, vulkan-headers
|
||||
, SDL2
|
||||
, glfw
|
||||
, pkgsBuildHost
|
||||
, gitUpdater
|
||||
, sdl2Support ? true
|
||||
, glfwSupport ? false
|
||||
, enableMoltenVKCompat ? false
|
||||
}:
|
||||
|
||||
# SDL2 and GLFW support are mutually exclusive.
|
||||
assert !sdl2Support || !glfwSupport;
|
||||
|
||||
let
|
||||
# DXVK 2.0+ no longer vendors certain dependencies. This derivation also needs to build on Darwin,
|
||||
# which does not currently support DXVK 2.0, so adapt conditionally for this situation.
|
||||
isDxvk2 = lib.versionAtLeast (srcs.${dxvkVersion}.version) "2.0";
|
||||
|
||||
# DXVK has effectively the same build script regardless of platform.
|
||||
srcs = {
|
||||
"1.10" = rec {
|
||||
version = "1.10.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "doitsujin";
|
||||
repo = "dxvk";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
|
||||
};
|
||||
# These patches are required when using DXVK with Wine on Darwin.
|
||||
patches = lib.optionals enableMoltenVKCompat [
|
||||
# Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
|
||||
# Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
|
||||
./darwin-dxvk-compat.patch
|
||||
# Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
|
||||
# See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
|
||||
./darwin-thread-primitives.patch
|
||||
];
|
||||
};
|
||||
"default" = rec {
|
||||
version = "2.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "doitsujin";
|
||||
repo = "dxvk";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-RU+B0XfphD5HHW/vSzqHLUaGS3E31d5sOLp3lMmrCB8=";
|
||||
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 (finalAttrs: {
|
||||
pname = "dxvk";
|
||||
inherit (srcs.${dxvkVersion}) version src patches;
|
||||
|
||||
nativeBuildInputs = [ glslang meson ninja ];
|
||||
buildInputs = lib.optionals isWindows [ windows.pthreads ]
|
||||
++ lib.optionals isDxvk2 (
|
||||
[ spirv-headers vulkan-headers ]
|
||||
++ lib.optional (!isWindows && sdl2Support) SDL2
|
||||
++ lib.optional (!isWindows && glfwSupport) glfw
|
||||
);
|
||||
|
||||
postPatch = lib.optionalString isDxvk2 ''
|
||||
substituteInPlace "subprojects/libdisplay-info/tool/gen-search-table.py" \
|
||||
--replace "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3"
|
||||
'';
|
||||
|
||||
# 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 =
|
||||
let
|
||||
arch = if stdenv.is32bit then "32" else "64";
|
||||
in
|
||||
[
|
||||
"--buildtype" "release"
|
||||
"--prefix" "${placeholder "out"}"
|
||||
]
|
||||
++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ]
|
||||
++ lib.optional glfwSupport "-Ddxvk_native_wsi=glfw";
|
||||
|
||||
doCheck = isDxvk2 && !isCross;
|
||||
|
||||
passthru = lib.optionalAttrs (lib.versionAtLeast finalAttrs.version "2.0") {
|
||||
updateScript = gitUpdater {
|
||||
rev-prefix = "v";
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "A Vulkan-based translation layer for Direct3D 9/10/11";
|
||||
homepage = "https://github.com/doitsujin/dxvk";
|
||||
changelog = "https://github.com/doitsujin/dxvk/releases";
|
||||
maintainers = [ lib.maintainers.reckenrode ];
|
||||
license = lib.licenses.zlib;
|
||||
platforms = lib.platforms.windows ++ lib.optionals isDxvk2 lib.platforms.linux;
|
||||
};
|
||||
})
|
|
@ -40458,10 +40458,6 @@ with pkgs;
|
|||
|
||||
dump = callPackage ../tools/backup/dump { };
|
||||
|
||||
dxvk = callPackage ../misc/dxvk { };
|
||||
dxvk_1 = callPackage ../misc/dxvk/dxvk.nix { dxvkVersion = "1.10"; };
|
||||
dxvk_2 = callPackage ../misc/dxvk/dxvk.nix { };
|
||||
|
||||
ec2stepshell = callPackage ../tools/security/ec2stepshell { };
|
||||
|
||||
ecdsatool = callPackage ../tools/security/ecdsatool { };
|
||||
|
|
Loading…
Reference in a new issue