Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/dxvk/
Date: Fri, 13 May 2022 02:48:50
Message-Id: 1652408969.b458663e8d42a6932d1be1664324fcd707e28b04.ionen@gentoo
1 commit: b458663e8d42a6932d1be1664324fcd707e28b04
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 7 04:39:10 2022 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Fri May 13 02:29:29 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b458663e
7
8 app-emulation/dxvk: new package, add 1.10.1 + live
9
10 Many want to build this, but crossdev requirement made it unsuitable
11 for ::gentoo. Now, mingw64-toolchain is there to remedy this and so
12 let's add it. crossdev can still be used if USE=crossdev-mingw
13
14 Note that unlike most overlays, this intentionally does not modify
15 config.cpp and then installs dxvk.conf as a documentation example.
16 Use the intended ${PWD}/dxvk.conf or DXVK_CONFIG_FILE env var.
17 Paths are also different (using lib64 is not necessary and
18 requires workarounds), so may need to update WINEPREFIX symlinks.
19
20 Closes: https://bugs.gentoo.org/664310
21 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
22
23 app-emulation/dxvk/Manifest | 1 +
24 app-emulation/dxvk/dxvk-1.10.1.ebuild | 120 ++++++++++++++++++++++++++++++++++
25 app-emulation/dxvk/dxvk-9999.ebuild | 120 ++++++++++++++++++++++++++++++++++
26 app-emulation/dxvk/metadata.xml | 21 ++++++
27 4 files changed, 262 insertions(+)
28
29 diff --git a/app-emulation/dxvk/Manifest b/app-emulation/dxvk/Manifest
30 new file mode 100644
31 index 000000000000..c26971ce4b08
32 --- /dev/null
33 +++ b/app-emulation/dxvk/Manifest
34 @@ -0,0 +1 @@
35 +DIST dxvk-1.10.1.tar.gz 1188138 BLAKE2B e4c5c5052de3f0976581317b9e6de148735198d2545e961ed4540be8660fbba0bcd30f81a1b55f032a1e00e226993d1ab3e4017b104f2829bf37d2ee4fc4420a SHA512 8fd34d9f14a7013cdc1957f63bf60feb19748fddc1cd6ec40cf271005f636de62965efb42ddf2598dad3e37a4f59a870bf769387b2534db93451d1ea6aa65410
36
37 diff --git a/app-emulation/dxvk/dxvk-1.10.1.ebuild b/app-emulation/dxvk/dxvk-1.10.1.ebuild
38 new file mode 100644
39 index 000000000000..d48b3cc7cc2a
40 --- /dev/null
41 +++ b/app-emulation/dxvk/dxvk-1.10.1.ebuild
42 @@ -0,0 +1,120 @@
43 +# Copyright 2022 Gentoo Authors
44 +# Distributed under the terms of the GNU General Public License v2
45 +
46 +EAPI=8
47 +
48 +MULTILIB_COMPAT=( abi_x86_{32,64} )
49 +inherit flag-o-matic meson-multilib
50 +
51 +if [[ ${PV} == 9999 ]]; then
52 + inherit git-r3
53 + EGIT_REPO_URI="https://github.com/doitsujin/dxvk.git"
54 +else
55 + SRC_URI="https://github.com/doitsujin/dxvk/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
56 + KEYWORDS="-* ~amd64 ~x86"
57 +fi
58 +
59 +DESCRIPTION="Vulkan-based implementation of D3D9, D3D10 and D3D11 for Linux / Wine"
60 +HOMEPAGE="https://github.com/doitsujin/dxvk/"
61 +
62 +LICENSE="ZLIB"
63 +SLOT="0"
64 +IUSE="+abi_x86_32 crossdev-mingw +d3d9 +d3d10 +d3d11 debug +dxgi"
65 +REQUIRED_USE="
66 + || ( d3d9 d3d10 d3d11 dxgi )
67 + d3d10? ( d3d11 )
68 + dxgi? ( d3d11 )"
69 +
70 +BDEPEND="
71 + dev-util/glslang
72 + !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
73 +
74 +pkg_pretend() {
75 + [[ ${MERGE_TYPE} == binary ]] && return
76 +
77 + if use crossdev-mingw; then
78 + local tool=-w64-mingw32-g++
79 + for tool in $(usev abi_x86_64 x86_64${tool}) $(usev abi_x86_32 i686${tool}); do
80 + if ! type -P ${tool} >/dev/null; then
81 + eerror "With USE=crossdev-mingw, it is necessary to setup the mingw toolchain."
82 + eerror "For instructions, please see: https://wiki.gentoo.org/wiki/Mingw"
83 + use abi_x86_32 && use abi_x86_64 &&
84 + eerror "Also, with USE=abi_x86_32, will need both i686 and x86_64 toolchains."
85 + die "USE=crossdev-mingw is set but ${tool} was not found"
86 + elif [[ ! $(LC_ALL=C ${tool} -v 2>&1) =~ "Thread model: posix" ]]; then
87 + eerror "${PN} requires GCC to be built with --enable-threads=posix"
88 + eerror "Please see: https://wiki.gentoo.org/wiki/Mingw#POSIX_threads_for_Windows"
89 + die "USE=crossdev-mingw is set but ${tool} does not use POSIX threads"
90 + fi
91 + done
92 + fi
93 +}
94 +
95 +src_prepare() {
96 + default
97 +
98 + sed -i "/^basedir=/s|=.*|=${EPREFIX}/usr/lib/${PN}|" setup_dxvk.sh || die
99 +}
100 +
101 +src_configure() {
102 + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
103 +
104 + # AVX has a history of causing issues with this package, disable for safety
105 + # https://github.com/Tk-Glitch/PKGBUILDS/issues/515
106 + append-flags -mno-avx
107 +
108 + if [[ ${CHOST} != *-mingw* ]]; then
109 + unset AR CC CXX RC STRIP # likely unusable unless CHOST is mingw
110 +
111 + CHOST_amd64=x86_64-w64-mingw32
112 + CHOST_x86=i686-w64-mingw32
113 + CHOST=$(usex x86 ${CHOST_x86} ${CHOST_amd64})
114 +
115 + strip-unsupported-flags
116 + fi
117 +
118 + multilib-minimal_src_configure
119 +}
120 +
121 +multilib_src_configure() {
122 + # multilib's ${CHOST_amd64}-gcc -m32 is unusable with crossdev,
123 + # unset again so meson eclass will set ${CHOST}-gcc + others
124 + use crossdev-mingw && unset AR CC CXX RC STRIP
125 +
126 + local emesonargs=(
127 + --prefix="${EPREFIX}"/usr/lib/${PN}
128 + --{bin,lib}dir=x$((${ABI#x}==86?32:64))
129 + $(meson_use {,enable_}d3d9)
130 + $(meson_use {,enable_}d3d10)
131 + $(meson_use {,enable_}d3d11)
132 + $(meson_use {,enable_}dxgi)
133 + $(usev !debug --strip) # portage won't strip .dll, so allow it here
134 + -Denable_tests=false # needs wine/vulkan and is intended for manual use
135 + )
136 +
137 + meson_src_configure
138 +}
139 +
140 +multilib_src_install_all() {
141 + dobin setup_dxvk.sh
142 + dodoc README.md dxvk.conf
143 +
144 + find "${ED}" -type f -name '*.a' -delete || die
145 +}
146 +
147 +pkg_postinst() {
148 + if [[ ! ${REPLACING_VERSIONS} ]]; then
149 + elog "To enable ${PN} on a wine prefix, you can run the following command:"
150 + elog
151 + elog " WINEPREFIX=/path/to/prefix setup_dxvk.sh install --symlink"
152 + elog
153 + elog "See ${EROOT}/usr/share/doc/${PF}/README.md* for details."
154 + fi
155 +
156 + # don't try to keep wine-*[vulkan] in RDEPEND, but still give a warning
157 + local wine
158 + for wine in app-emulation/wine-{vanilla,staging}; do
159 + has_version ${wine} && ! has_version ${wine}[vulkan] &&
160 + ewarn "${wine} was not built with USE=vulkan, ${PN} will not be usable with it"
161 + done
162 +}
163
164 diff --git a/app-emulation/dxvk/dxvk-9999.ebuild b/app-emulation/dxvk/dxvk-9999.ebuild
165 new file mode 100644
166 index 000000000000..d48b3cc7cc2a
167 --- /dev/null
168 +++ b/app-emulation/dxvk/dxvk-9999.ebuild
169 @@ -0,0 +1,120 @@
170 +# Copyright 2022 Gentoo Authors
171 +# Distributed under the terms of the GNU General Public License v2
172 +
173 +EAPI=8
174 +
175 +MULTILIB_COMPAT=( abi_x86_{32,64} )
176 +inherit flag-o-matic meson-multilib
177 +
178 +if [[ ${PV} == 9999 ]]; then
179 + inherit git-r3
180 + EGIT_REPO_URI="https://github.com/doitsujin/dxvk.git"
181 +else
182 + SRC_URI="https://github.com/doitsujin/dxvk/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
183 + KEYWORDS="-* ~amd64 ~x86"
184 +fi
185 +
186 +DESCRIPTION="Vulkan-based implementation of D3D9, D3D10 and D3D11 for Linux / Wine"
187 +HOMEPAGE="https://github.com/doitsujin/dxvk/"
188 +
189 +LICENSE="ZLIB"
190 +SLOT="0"
191 +IUSE="+abi_x86_32 crossdev-mingw +d3d9 +d3d10 +d3d11 debug +dxgi"
192 +REQUIRED_USE="
193 + || ( d3d9 d3d10 d3d11 dxgi )
194 + d3d10? ( d3d11 )
195 + dxgi? ( d3d11 )"
196 +
197 +BDEPEND="
198 + dev-util/glslang
199 + !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
200 +
201 +pkg_pretend() {
202 + [[ ${MERGE_TYPE} == binary ]] && return
203 +
204 + if use crossdev-mingw; then
205 + local tool=-w64-mingw32-g++
206 + for tool in $(usev abi_x86_64 x86_64${tool}) $(usev abi_x86_32 i686${tool}); do
207 + if ! type -P ${tool} >/dev/null; then
208 + eerror "With USE=crossdev-mingw, it is necessary to setup the mingw toolchain."
209 + eerror "For instructions, please see: https://wiki.gentoo.org/wiki/Mingw"
210 + use abi_x86_32 && use abi_x86_64 &&
211 + eerror "Also, with USE=abi_x86_32, will need both i686 and x86_64 toolchains."
212 + die "USE=crossdev-mingw is set but ${tool} was not found"
213 + elif [[ ! $(LC_ALL=C ${tool} -v 2>&1) =~ "Thread model: posix" ]]; then
214 + eerror "${PN} requires GCC to be built with --enable-threads=posix"
215 + eerror "Please see: https://wiki.gentoo.org/wiki/Mingw#POSIX_threads_for_Windows"
216 + die "USE=crossdev-mingw is set but ${tool} does not use POSIX threads"
217 + fi
218 + done
219 + fi
220 +}
221 +
222 +src_prepare() {
223 + default
224 +
225 + sed -i "/^basedir=/s|=.*|=${EPREFIX}/usr/lib/${PN}|" setup_dxvk.sh || die
226 +}
227 +
228 +src_configure() {
229 + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
230 +
231 + # AVX has a history of causing issues with this package, disable for safety
232 + # https://github.com/Tk-Glitch/PKGBUILDS/issues/515
233 + append-flags -mno-avx
234 +
235 + if [[ ${CHOST} != *-mingw* ]]; then
236 + unset AR CC CXX RC STRIP # likely unusable unless CHOST is mingw
237 +
238 + CHOST_amd64=x86_64-w64-mingw32
239 + CHOST_x86=i686-w64-mingw32
240 + CHOST=$(usex x86 ${CHOST_x86} ${CHOST_amd64})
241 +
242 + strip-unsupported-flags
243 + fi
244 +
245 + multilib-minimal_src_configure
246 +}
247 +
248 +multilib_src_configure() {
249 + # multilib's ${CHOST_amd64}-gcc -m32 is unusable with crossdev,
250 + # unset again so meson eclass will set ${CHOST}-gcc + others
251 + use crossdev-mingw && unset AR CC CXX RC STRIP
252 +
253 + local emesonargs=(
254 + --prefix="${EPREFIX}"/usr/lib/${PN}
255 + --{bin,lib}dir=x$((${ABI#x}==86?32:64))
256 + $(meson_use {,enable_}d3d9)
257 + $(meson_use {,enable_}d3d10)
258 + $(meson_use {,enable_}d3d11)
259 + $(meson_use {,enable_}dxgi)
260 + $(usev !debug --strip) # portage won't strip .dll, so allow it here
261 + -Denable_tests=false # needs wine/vulkan and is intended for manual use
262 + )
263 +
264 + meson_src_configure
265 +}
266 +
267 +multilib_src_install_all() {
268 + dobin setup_dxvk.sh
269 + dodoc README.md dxvk.conf
270 +
271 + find "${ED}" -type f -name '*.a' -delete || die
272 +}
273 +
274 +pkg_postinst() {
275 + if [[ ! ${REPLACING_VERSIONS} ]]; then
276 + elog "To enable ${PN} on a wine prefix, you can run the following command:"
277 + elog
278 + elog " WINEPREFIX=/path/to/prefix setup_dxvk.sh install --symlink"
279 + elog
280 + elog "See ${EROOT}/usr/share/doc/${PF}/README.md* for details."
281 + fi
282 +
283 + # don't try to keep wine-*[vulkan] in RDEPEND, but still give a warning
284 + local wine
285 + for wine in app-emulation/wine-{vanilla,staging}; do
286 + has_version ${wine} && ! has_version ${wine}[vulkan] &&
287 + ewarn "${wine} was not built with USE=vulkan, ${PN} will not be usable with it"
288 + done
289 +}
290
291 diff --git a/app-emulation/dxvk/metadata.xml b/app-emulation/dxvk/metadata.xml
292 new file mode 100644
293 index 000000000000..84811f271d8e
294 --- /dev/null
295 +++ b/app-emulation/dxvk/metadata.xml
296 @@ -0,0 +1,21 @@
297 +<?xml version="1.0" encoding="UTF-8"?>
298 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
299 +<pkgmetadata>
300 + <maintainer type="person">
301 + <email>ionen@g.o</email>
302 + <name>Ionen Wolkens</name>
303 + </maintainer>
304 + <use>
305 + <flag name="crossdev-mingw">
306 + Use <pkg>sys-devel/crossdev</pkg> for the toolchain rather than
307 + <pkg>dev-util/mingw64-toolchain</pkg> (requires manual setting up)
308 + </flag>
309 + <flag name="d3d9">Enable support for DirectX 9 (d3d9.dll)</flag>
310 + <flag name="d3d10">Enable support for DirectX 10 (d3d10.dll)</flag>
311 + <flag name="d3d11">Enable support for DirectX 11 (d3d11.dll)</flag>
312 + <flag name="dxgi">Enable support for the DirectX Graphics Infrastructure (dxgi.dll)</flag>
313 + </use>
314 + <upstream>
315 + <remote-id type="github">doitsujin/dxvk</remote-id>
316 + </upstream>
317 +</pkgmetadata>