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/vkd3d-proton/
Date: Fri, 13 May 2022 02:48:50
Message-Id: 1652408969.abece420ad88b7e34917d74b9253024606f3cc16.ionen@gentoo
1 commit: abece420ad88b7e34917d74b9253024606f3cc16
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 10 07:37:03 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=abece420
7
8 app-emulation/vkd3d-proton: new package, add 2.6 + live
9
10 Complement to app-emulation/dxvk that's setup very similarly.
11 Contains a lot of improvements over regular vkd3d for Proton
12 but (like dxvk) can be used by any Wine.
13
14 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
15
16 app-emulation/vkd3d-proton/Manifest | 4 +
17 app-emulation/vkd3d-proton/metadata.xml | 18 +++
18 app-emulation/vkd3d-proton/vkd3d-proton-2.6.ebuild | 161 +++++++++++++++++++++
19 .../vkd3d-proton/vkd3d-proton-9999.ebuild | 161 +++++++++++++++++++++
20 4 files changed, 344 insertions(+)
21
22 diff --git a/app-emulation/vkd3d-proton/Manifest b/app-emulation/vkd3d-proton/Manifest
23 new file mode 100644
24 index 000000000000..d0abe731bac6
25 --- /dev/null
26 +++ b/app-emulation/vkd3d-proton/Manifest
27 @@ -0,0 +1,4 @@
28 +DIST vkd3d-proton-2.6-dxil-spirv.tar.gz 631130 BLAKE2B 99f40c5efde87d0af86542b427e5b0429be68ca69ba0c2b6d10a821811756d8dadff4449f268ae404f8ace09a91b3e8aaa135e534a77c0239e58c1a970a044cc SHA512 3c20090b7a1b53c30fd4967622fc7384e1bcc504c30d8075068b87dad1bd2c6f4a12459bf42e61bf76b9dd454ec17a9d529f74ab0d5583627e966d94bb341dc3
29 +DIST vkd3d-proton-2.6-spirv-headers.tar.gz 1299014 BLAKE2B 0b1e635aaa6eebec3525b13698a064e0e5b8a78829a772cbe9e1890148059bf396bc5c830e8d6ee3070a3343775991642565283994c65acfa0d82a91590b7d84 SHA512 ecb2158cad55edb4ba069383668f3b311a2f6aa6777b5b7ed94795d454622426ee34fee52b13c97d2f07b5b2f965815ee61a0203b76a0b0d2c708a4786d06b96
30 +DIST vkd3d-proton-2.6-vulkan-headers.tar.gz 415130 BLAKE2B 0c6444c4c1cb43b9c69757d7c2257ce2fe1bc6be308341f3189766f120994e4920bc738b737d9eefc299359dab568fb8809782e3663dd589c0e4d13aecb8873a SHA512 02cf1d63b29e48ef0efe489eb32237ba2f9f4bf58a182b00dc96aab18faba94de79283398e9e945cd81130f83fff228c59b04e496716ea9ccc148a5f4465282c
31 +DIST vkd3d-proton-2.6.tar.gz 1271948 BLAKE2B 02d2574a66614613748fe3471a6fd5aac2650fdae15a17b17ea2ed028fa53a0579b866e7240036a26108afc343395826474bb99e015b9299c2abec811bb872ab SHA512 6f27d213652e2380a9ba4534ac9ffe4b752b4608fbc2e8acd273fa151ab19ad0b132e3436384d2b8591cd1a59f0b69d342c893dc3a64be85188b5e3274bcf3f1
32
33 diff --git a/app-emulation/vkd3d-proton/metadata.xml b/app-emulation/vkd3d-proton/metadata.xml
34 new file mode 100644
35 index 000000000000..65a03f88f50d
36 --- /dev/null
37 +++ b/app-emulation/vkd3d-proton/metadata.xml
38 @@ -0,0 +1,18 @@
39 +<?xml version="1.0" encoding="UTF-8"?>
40 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
41 +<pkgmetadata>
42 + <maintainer type="person">
43 + <email>ionen@g.o</email>
44 + <name>Ionen Wolkens</name>
45 + </maintainer>
46 + <use>
47 + <flag name="crossdev-mingw">
48 + Use <pkg>sys-devel/crossdev</pkg> for the toolchain rather than
49 + <pkg>dev-util/mingw64-toolchain</pkg> (requires manual setting up)
50 + </flag>
51 + <flag name="extras">Install extra tools and demos in /usr/lib/vkd3d-proton</flag>
52 + </use>
53 + <upstream>
54 + <remote-id type="github">HansKristian-Work/vkd3d-proton</remote-id>
55 + </upstream>
56 +</pkgmetadata>
57
58 diff --git a/app-emulation/vkd3d-proton/vkd3d-proton-2.6.ebuild b/app-emulation/vkd3d-proton/vkd3d-proton-2.6.ebuild
59 new file mode 100644
60 index 000000000000..68245c3ef796
61 --- /dev/null
62 +++ b/app-emulation/vkd3d-proton/vkd3d-proton-2.6.ebuild
63 @@ -0,0 +1,161 @@
64 +# Copyright 2022 Gentoo Authors
65 +# Distributed under the terms of the GNU General Public License v2
66 +
67 +EAPI=8
68 +
69 +MULTILIB_COMPAT=( abi_x86_{32,64} )
70 +inherit flag-o-matic meson-multilib toolchain-funcs
71 +
72 +if [[ ${PV} == 9999 ]]; then
73 + inherit git-r3
74 + EGIT_REPO_URI="https://github.com/HansKristian-Work/vkd3d-proton.git"
75 + EGIT_SUBMODULES=(
76 + # uses hacks / recent features and easily breaks, keep bundled headers
77 + # (also cross-compiled and -I/usr/include is troublesome)
78 + subprojects/{SPIRV,Vulkan}-Headers
79 + subprojects/dxil-spirv
80 + subprojects/dxil-spirv/third_party/spirv-headers # skip cross/tools
81 + )
82 +else
83 + VKD3D_HASH=3e5aab6fb3e18f81a71b339be4cb5cdf55140980 # match tag on bumps
84 + DXIL_HASH=b537bbb91bccdbc695cb7e5211d608f8d1c205bd
85 + SPIRV_HASH=ae217c17809fadb232ec94b29304b4afcd417bb4
86 + VULKAN_HASH=83e1a9ed8ce289cebb1c02c8167d663dc1befb24
87 + SRC_URI="
88 + https://github.com/HansKristian-Work/vkd3d-proton/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
89 + https://github.com/HansKristian-Work/dxil-spirv/archive/${DXIL_HASH}.tar.gz -> ${P}-dxil-spirv.tar.gz
90 + https://github.com/KhronosGroup/SPIRV-Headers/archive/${SPIRV_HASH}.tar.gz -> ${P}-vulkan-headers.tar.gz
91 + https://github.com/KhronosGroup/Vulkan-Headers/archive/${VULKAN_HASH}.tar.gz -> ${P}-spirv-headers.tar.gz"
92 + KEYWORDS="-* ~amd64 ~x86"
93 +fi
94 +
95 +DESCRIPTION="Fork of VKD3D, development branches for Proton's Direct3D 12 implementation"
96 +HOMEPAGE="https://github.com/HansKristian-Work/vkd3d-proton/"
97 +
98 +LICENSE="LGPL-2.1+ Apache-2.0 MIT"
99 +SLOT="0"
100 +IUSE="+abi_x86_32 crossdev-mingw debug extras"
101 +
102 +BDEPEND="
103 + dev-util/glslang
104 + !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
105 +
106 +pkg_pretend() {
107 + [[ ${MERGE_TYPE} == binary ]] && return
108 +
109 + if use crossdev-mingw; then
110 + local tool=-w64-mingw32-g++
111 + for tool in $(usev abi_x86_64 x86_64${tool}) $(usev abi_x86_32 i686${tool}); do
112 + if ! type -P ${tool} >/dev/null; then
113 + eerror "With USE=crossdev-mingw, it is necessary to setup the mingw toolchain."
114 + eerror "For instructions, please see: https://wiki.gentoo.org/wiki/Mingw"
115 + use abi_x86_32 && use abi_x86_64 &&
116 + eerror "Also, with USE=abi_x86_32, will need both i686 and x86_64 toolchains."
117 + die "USE=crossdev-mingw is set but ${tool} was not found"
118 + elif [[ ! $(LC_ALL=C ${tool} -v 2>&1) =~ "Thread model: posix" ]]; then
119 + eerror "${PN} requires GCC to be built with --enable-threads=posix"
120 + eerror "Please see: https://wiki.gentoo.org/wiki/Mingw#POSIX_threads_for_Windows"
121 + die "USE=crossdev-mingw is set but ${tool} does not use POSIX threads"
122 + fi
123 + done
124 + tool=-w64-mingw32-widl
125 + for tool in $(usev abi_x86_64 x86_64${tool}) $(usev abi_x86_32 i686${tool}); do
126 + if ! type -P widl >/dev/null && ! type -P ${tool} >/dev/null; then
127 + eerror "With USE=crossdev-mingw, you need to provide the widl compiler by either"
128 + eerror "building crossdev mingw64-runtime with USE=tools or installing wine."
129 + die "USE=crossdev-mingw is set but neither widl nor ${tool} were found"
130 + fi
131 + done
132 + fi
133 +}
134 +
135 +src_prepare() {
136 + if [[ ${PV} != 9999 ]]; then
137 + rmdir subprojects/{{SPIRV,Vulkan}-Headers,dxil-spirv} || die
138 + mv ../dxil-spirv-${DXIL_HASH} subprojects/dxil-spirv || die
139 + mv ../SPIRV-Headers-${SPIRV_HASH} subprojects/SPIRV-Headers || die
140 + mv ../Vulkan-Headers-${VULKAN_HASH} subprojects/Vulkan-Headers || die
141 + ln -s ../../../SPIRV-Headers/include \
142 + subprojects/dxil-spirv/third_party/spirv-headers || die
143 + fi
144 +
145 + default
146 +
147 + sed -i "/^basedir=/s|=.*|=${EPREFIX}/usr/lib/${PN}|" setup_vkd3d_proton.sh || die
148 +
149 + if [[ ${PV} != 9999 ]]; then
150 + # without .git, meson sets vkd3d_build as 0x${PV} leading to failure
151 + sed -i "s/@VCS_TAG@/${VKD3D_HASH::15}/" vkd3d_build.h.in || die
152 + sed -i "s/@VCS_TAG@/${VKD3D_HASH::7}/" vkd3d_version.h.in || die
153 + fi
154 +}
155 +
156 +src_configure() {
157 + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
158 +
159 + if [[ ${CHOST} != *-mingw* ]]; then
160 + unset AR CC CXX STRIP WIDL # likely unusable unless CHOST is mingw
161 +
162 + CHOST_amd64=x86_64-w64-mingw32
163 + CHOST_x86=i686-w64-mingw32
164 + CHOST=$(usex x86 ${CHOST_x86} ${CHOST_amd64})
165 +
166 + # preferring meson eclass' cross file over upstream's but, unlike
167 + # dxvk, we lose static options in the process (from build-win*.txt)
168 + append-ldflags -static -static-libgcc -static-libstdc++
169 +
170 + strip-unsupported-flags
171 + fi
172 +
173 + multilib-minimal_src_configure
174 +}
175 +
176 +multilib_src_configure() {
177 + # multilib's ${CHOST_amd64}-gcc -m32 is unusable with crossdev,
178 + # unset again so meson eclass will set ${CHOST}-gcc + others
179 + use crossdev-mingw && unset AR CC CXX STRIP WIDL
180 +
181 + # prefer ${CHOST}'s widl (mingw) over wine's as used by upstream if
182 + # possible, but eclasses don't handle that so setup machine files
183 + local widl=$(tc-getPROG WIDL widl)
184 + use amd64 && [[ ${widl} == widl && ${ABI} == x86 ]] && widl="widl','-m32"
185 + printf "[binaries]\nwidl = ['${widl}']\n" > "${T}"/widl.${ABI}.ini || die
186 +
187 + local emesonargs=(
188 + --prefix="${EPREFIX}"/usr/lib/${PN}
189 + --{bin,lib}dir=x$((${ABI#x}==86?86:64))
190 + --{cross,native}-file="${T}"/widl.${ABI}.ini
191 + $(meson_use {,enable_}extras)
192 + $(meson_use debug enable_trace)
193 + $(usev !debug --strip) # portage won't strip .dll, so allow it here
194 + -Denable_tests=false # needs wine/vulkan and is intended for manual use
195 + )
196 +
197 + meson_src_configure
198 +}
199 +
200 +multilib_src_install_all() {
201 + dobin setup_vkd3d_proton.sh
202 + einstalldocs
203 +
204 + # unnecesasry files, see package-release.sh
205 + rm "${ED}"/usr/lib/${PN}/x*/libvkd3d-proton-utils-3.dll || die
206 + find "${ED}" -type f -name '*.a' -delete || die
207 +}
208 +
209 +pkg_postinst() {
210 + if [[ ! ${REPLACING_VERSIONS} ]]; then
211 + elog "To enable ${PN} on a wine prefix, you can run the following command:"
212 + elog
213 + elog " WINEPREFIX=/path/to/prefix setup_vkd3d_proton.sh install --symlink"
214 + elog
215 + elog "See ${EROOT}/usr/share/doc/${PF}/README.md* for details."
216 + fi
217 +
218 + # don't try to keep wine-*[vulkan] in RDEPEND, but still give a warning
219 + local wine
220 + for wine in app-emulation/wine-{vanilla,staging}; do
221 + has_version ${wine} && ! has_version ${wine}[vulkan] &&
222 + ewarn "${wine} was not built with USE=vulkan, ${PN} will not be usable with it"
223 + done
224 +}
225
226 diff --git a/app-emulation/vkd3d-proton/vkd3d-proton-9999.ebuild b/app-emulation/vkd3d-proton/vkd3d-proton-9999.ebuild
227 new file mode 100644
228 index 000000000000..68245c3ef796
229 --- /dev/null
230 +++ b/app-emulation/vkd3d-proton/vkd3d-proton-9999.ebuild
231 @@ -0,0 +1,161 @@
232 +# Copyright 2022 Gentoo Authors
233 +# Distributed under the terms of the GNU General Public License v2
234 +
235 +EAPI=8
236 +
237 +MULTILIB_COMPAT=( abi_x86_{32,64} )
238 +inherit flag-o-matic meson-multilib toolchain-funcs
239 +
240 +if [[ ${PV} == 9999 ]]; then
241 + inherit git-r3
242 + EGIT_REPO_URI="https://github.com/HansKristian-Work/vkd3d-proton.git"
243 + EGIT_SUBMODULES=(
244 + # uses hacks / recent features and easily breaks, keep bundled headers
245 + # (also cross-compiled and -I/usr/include is troublesome)
246 + subprojects/{SPIRV,Vulkan}-Headers
247 + subprojects/dxil-spirv
248 + subprojects/dxil-spirv/third_party/spirv-headers # skip cross/tools
249 + )
250 +else
251 + VKD3D_HASH=3e5aab6fb3e18f81a71b339be4cb5cdf55140980 # match tag on bumps
252 + DXIL_HASH=b537bbb91bccdbc695cb7e5211d608f8d1c205bd
253 + SPIRV_HASH=ae217c17809fadb232ec94b29304b4afcd417bb4
254 + VULKAN_HASH=83e1a9ed8ce289cebb1c02c8167d663dc1befb24
255 + SRC_URI="
256 + https://github.com/HansKristian-Work/vkd3d-proton/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
257 + https://github.com/HansKristian-Work/dxil-spirv/archive/${DXIL_HASH}.tar.gz -> ${P}-dxil-spirv.tar.gz
258 + https://github.com/KhronosGroup/SPIRV-Headers/archive/${SPIRV_HASH}.tar.gz -> ${P}-vulkan-headers.tar.gz
259 + https://github.com/KhronosGroup/Vulkan-Headers/archive/${VULKAN_HASH}.tar.gz -> ${P}-spirv-headers.tar.gz"
260 + KEYWORDS="-* ~amd64 ~x86"
261 +fi
262 +
263 +DESCRIPTION="Fork of VKD3D, development branches for Proton's Direct3D 12 implementation"
264 +HOMEPAGE="https://github.com/HansKristian-Work/vkd3d-proton/"
265 +
266 +LICENSE="LGPL-2.1+ Apache-2.0 MIT"
267 +SLOT="0"
268 +IUSE="+abi_x86_32 crossdev-mingw debug extras"
269 +
270 +BDEPEND="
271 + dev-util/glslang
272 + !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
273 +
274 +pkg_pretend() {
275 + [[ ${MERGE_TYPE} == binary ]] && return
276 +
277 + if use crossdev-mingw; then
278 + local tool=-w64-mingw32-g++
279 + for tool in $(usev abi_x86_64 x86_64${tool}) $(usev abi_x86_32 i686${tool}); do
280 + if ! type -P ${tool} >/dev/null; then
281 + eerror "With USE=crossdev-mingw, it is necessary to setup the mingw toolchain."
282 + eerror "For instructions, please see: https://wiki.gentoo.org/wiki/Mingw"
283 + use abi_x86_32 && use abi_x86_64 &&
284 + eerror "Also, with USE=abi_x86_32, will need both i686 and x86_64 toolchains."
285 + die "USE=crossdev-mingw is set but ${tool} was not found"
286 + elif [[ ! $(LC_ALL=C ${tool} -v 2>&1) =~ "Thread model: posix" ]]; then
287 + eerror "${PN} requires GCC to be built with --enable-threads=posix"
288 + eerror "Please see: https://wiki.gentoo.org/wiki/Mingw#POSIX_threads_for_Windows"
289 + die "USE=crossdev-mingw is set but ${tool} does not use POSIX threads"
290 + fi
291 + done
292 + tool=-w64-mingw32-widl
293 + for tool in $(usev abi_x86_64 x86_64${tool}) $(usev abi_x86_32 i686${tool}); do
294 + if ! type -P widl >/dev/null && ! type -P ${tool} >/dev/null; then
295 + eerror "With USE=crossdev-mingw, you need to provide the widl compiler by either"
296 + eerror "building crossdev mingw64-runtime with USE=tools or installing wine."
297 + die "USE=crossdev-mingw is set but neither widl nor ${tool} were found"
298 + fi
299 + done
300 + fi
301 +}
302 +
303 +src_prepare() {
304 + if [[ ${PV} != 9999 ]]; then
305 + rmdir subprojects/{{SPIRV,Vulkan}-Headers,dxil-spirv} || die
306 + mv ../dxil-spirv-${DXIL_HASH} subprojects/dxil-spirv || die
307 + mv ../SPIRV-Headers-${SPIRV_HASH} subprojects/SPIRV-Headers || die
308 + mv ../Vulkan-Headers-${VULKAN_HASH} subprojects/Vulkan-Headers || die
309 + ln -s ../../../SPIRV-Headers/include \
310 + subprojects/dxil-spirv/third_party/spirv-headers || die
311 + fi
312 +
313 + default
314 +
315 + sed -i "/^basedir=/s|=.*|=${EPREFIX}/usr/lib/${PN}|" setup_vkd3d_proton.sh || die
316 +
317 + if [[ ${PV} != 9999 ]]; then
318 + # without .git, meson sets vkd3d_build as 0x${PV} leading to failure
319 + sed -i "s/@VCS_TAG@/${VKD3D_HASH::15}/" vkd3d_build.h.in || die
320 + sed -i "s/@VCS_TAG@/${VKD3D_HASH::7}/" vkd3d_version.h.in || die
321 + fi
322 +}
323 +
324 +src_configure() {
325 + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
326 +
327 + if [[ ${CHOST} != *-mingw* ]]; then
328 + unset AR CC CXX STRIP WIDL # likely unusable unless CHOST is mingw
329 +
330 + CHOST_amd64=x86_64-w64-mingw32
331 + CHOST_x86=i686-w64-mingw32
332 + CHOST=$(usex x86 ${CHOST_x86} ${CHOST_amd64})
333 +
334 + # preferring meson eclass' cross file over upstream's but, unlike
335 + # dxvk, we lose static options in the process (from build-win*.txt)
336 + append-ldflags -static -static-libgcc -static-libstdc++
337 +
338 + strip-unsupported-flags
339 + fi
340 +
341 + multilib-minimal_src_configure
342 +}
343 +
344 +multilib_src_configure() {
345 + # multilib's ${CHOST_amd64}-gcc -m32 is unusable with crossdev,
346 + # unset again so meson eclass will set ${CHOST}-gcc + others
347 + use crossdev-mingw && unset AR CC CXX STRIP WIDL
348 +
349 + # prefer ${CHOST}'s widl (mingw) over wine's as used by upstream if
350 + # possible, but eclasses don't handle that so setup machine files
351 + local widl=$(tc-getPROG WIDL widl)
352 + use amd64 && [[ ${widl} == widl && ${ABI} == x86 ]] && widl="widl','-m32"
353 + printf "[binaries]\nwidl = ['${widl}']\n" > "${T}"/widl.${ABI}.ini || die
354 +
355 + local emesonargs=(
356 + --prefix="${EPREFIX}"/usr/lib/${PN}
357 + --{bin,lib}dir=x$((${ABI#x}==86?86:64))
358 + --{cross,native}-file="${T}"/widl.${ABI}.ini
359 + $(meson_use {,enable_}extras)
360 + $(meson_use debug enable_trace)
361 + $(usev !debug --strip) # portage won't strip .dll, so allow it here
362 + -Denable_tests=false # needs wine/vulkan and is intended for manual use
363 + )
364 +
365 + meson_src_configure
366 +}
367 +
368 +multilib_src_install_all() {
369 + dobin setup_vkd3d_proton.sh
370 + einstalldocs
371 +
372 + # unnecesasry files, see package-release.sh
373 + rm "${ED}"/usr/lib/${PN}/x*/libvkd3d-proton-utils-3.dll || die
374 + find "${ED}" -type f -name '*.a' -delete || die
375 +}
376 +
377 +pkg_postinst() {
378 + if [[ ! ${REPLACING_VERSIONS} ]]; then
379 + elog "To enable ${PN} on a wine prefix, you can run the following command:"
380 + elog
381 + elog " WINEPREFIX=/path/to/prefix setup_vkd3d_proton.sh install --symlink"
382 + elog
383 + elog "See ${EROOT}/usr/share/doc/${PF}/README.md* for details."
384 + fi
385 +
386 + # don't try to keep wine-*[vulkan] in RDEPEND, but still give a warning
387 + local wine
388 + for wine in app-emulation/wine-{vanilla,staging}; do
389 + has_version ${wine} && ! has_version ${wine}[vulkan] &&
390 + ewarn "${wine} was not built with USE=vulkan, ${PN} will not be usable with it"
391 + done
392 +}