1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
{
lib,
stdenv,
fetchFromGitHub,
pkgsBuildHost,
glslang,
meson,
ninja,
pkg-config,
windows,
spirv-headers,
vulkan-headers,
SDL2,
glfw,
gitUpdater,
sdl2Support ? (!stdenv.hostPlatform.isWindows),
glfwSupport ? (!stdenv.hostPlatform.isWindows),
}:
assert stdenv.hostPlatform.isWindows -> !glfwSupport && !sdl2Support;
let
inherit (stdenv) hostPlatform;
libPrefix = lib.optionalString (!hostPlatform.isWindows) "lib";
soVersion =
version:
if hostPlatform.isDarwin then
".${version}${hostPlatform.extensions.sharedLibrary}"
else if hostPlatform.isWindows then
hostPlatform.extensions.sharedLibrary
else
"${hostPlatform.extensions.sharedLibrary}.${version}";
libglfw = "${libPrefix}glfw${soVersion "3"}";
libSDL2 = "${libPrefix}SDL2${lib.optionalString (!hostPlatform.isWindows) "-2.0"}${soVersion "0"}";
in
stdenv.mkDerivation (finalAttrs: {
pname = "dxvk";
version = "2.6.1";
src = fetchFromGitHub {
owner = "doitsujin";
repo = "dxvk";
rev = "v${finalAttrs.version}";
hash = "sha256-edu9JQAKu8yUZLh+37RB1s1A3+s8xeUYQ5Oibdes9ZI=";
fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info
};
postPatch =
''
substituteInPlace meson.build \
--replace-fail "dependency('glfw'" "dependency('glfw3'"
substituteInPlace subprojects/libdisplay-info/tool/gen-search-table.py \
--replace-fail "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3"
''
+ lib.optionalString glfwSupport ''
substituteInPlace src/wsi/glfw/wsi_platform_glfw.cpp \
--replace-fail '${libglfw}' '${lib.getLib glfw}/lib/${libglfw}'
''
+ lib.optionalString sdl2Support ''
substituteInPlace src/wsi/sdl2/wsi_platform_sdl2.cpp \
--replace-fail '${libSDL2}' '${lib.getLib SDL2}/lib/${libSDL2}'
'';
strictDeps = true;
nativeBuildInputs = [
glslang
meson
ninja
] ++ lib.optionals (glfwSupport || sdl2Support) [ pkg-config ];
buildInputs =
[
spirv-headers
vulkan-headers
]
++ lib.optionals sdl2Support [ SDL2 ]
++ lib.optionals glfwSupport [ glfw ]
++ lib.optionals hostPlatform.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
'';
mesonBuildType = "release";
doCheck = true;
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
__structuredAttrs = true;
meta = {
description = "Vulkan-based translation layer for Direct3D 8/9/10/11";
homepage = "https://github.com/doitsujin/dxvk";
changelog = "https://github.com/doitsujin/dxvk/releases";
maintainers = [ lib.maintainers.reckenrode ];
license = lib.licenses.zlib;
badPlatforms = lib.platforms.darwin;
platforms = lib.platforms.windows ++ lib.platforms.unix;
pkgConfigModules = [
"dxvk-d3d10core"
"dxvk-d3d11"
"dxvk-d3d8"
"dxvk-d3d9"
"dxvk-dxgi"
];
};
})
|