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/wine-proton/
Date: Sat, 10 Sep 2022 09:48:33
Message-Id: 1662803234.6a3d944e75698d85244745c0f1a723a2e693dc7a.ionen@gentoo
1 commit: 6a3d944e75698d85244745c0f1a723a2e693dc7a
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 9 11:11:43 2022 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 10 09:47:14 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a3d944e
7
8 app-emulation/wine-proton: add 7.0.9999 (experimental_7.0)
9
10 Same as 7.0.4 ebuild except:
11 * depend on gst-plugins-base[opengl] (checked by configure.ac)
12 * wine-mono-7.3.0 -> 7.3.1
13
14 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
15
16 .../wine-proton/wine-proton-7.0.9999.ebuild | 319 +++++++++++++++++++++
17 1 file changed, 319 insertions(+)
18
19 diff --git a/app-emulation/wine-proton/wine-proton-7.0.9999.ebuild b/app-emulation/wine-proton/wine-proton-7.0.9999.ebuild
20 new file mode 100644
21 index 000000000000..ea37d6fbf06a
22 --- /dev/null
23 +++ b/app-emulation/wine-proton/wine-proton-7.0.9999.ebuild
24 @@ -0,0 +1,319 @@
25 +# Copyright 2022 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=8
29 +
30 +MULTILIB_COMPAT=( abi_x86_{32,64} )
31 +PYTHON_COMPAT=( python3_{8..11} )
32 +inherit autotools flag-o-matic multilib multilib-build \
33 + python-any-r1 readme.gentoo-r1 toolchain-funcs wrapper
34 +
35 +WINE_GECKO=2.47.3
36 +WINE_MONO=7.3.1
37 +WINE_PV=$(ver_rs 2 -)
38 +
39 +if [[ ${PV} == *9999 ]]; then
40 + inherit git-r3
41 + EGIT_REPO_URI="https://github.com/ValveSoftware/wine.git"
42 + EGIT_BRANCH="experimental_$(ver_cut 1-2)"
43 +else
44 + SRC_URI="https://github.com/ValveSoftware/wine/archive/refs/tags/proton-wine-${WINE_PV}.tar.gz"
45 + S="${WORKDIR}/${PN}-wine-${WINE_PV}"
46 + KEYWORDS="-* ~amd64 ~x86"
47 +fi
48 +
49 +DESCRIPTION="Valve Software's fork of Wine"
50 +HOMEPAGE="https://github.com/ValveSoftware/wine/"
51 +
52 +LICENSE="LGPL-2.1+ BSD-2 IJG MIT ZLIB gsm libpng2 libtiff"
53 +SLOT="${PV}"
54 +IUSE="
55 + +abi_x86_32 +abi_x86_64 +alsa crossdev-mingw custom-cflags debug
56 + +fontconfig +gecko +gstreamer llvm-libunwind +mono nls openal
57 + osmesa perl pulseaudio +sdl selinux +ssl udev udisks +unwind usb
58 + v4l +vkd3d +xcomposite xinerama"
59 +
60 +# tests are non-trivial to run, can hang easily, don't play well with
61 +# sandbox, and several need real opengl/vulkan or network access
62 +RESTRICT="test"
63 +
64 +# `grep WINE_CHECK_SONAME configure.ac` + if not directly linked
65 +WINE_DLOPEN_DEPEND="
66 + dev-libs/gmp:=[${MULTILIB_USEDEP}]
67 + dev-libs/libgcrypt:=[${MULTILIB_USEDEP}]
68 + media-libs/freetype[${MULTILIB_USEDEP}]
69 + media-libs/libglvnd[X,${MULTILIB_USEDEP}]
70 + media-libs/vulkan-loader[${MULTILIB_USEDEP}]
71 + x11-libs/libXcursor[${MULTILIB_USEDEP}]
72 + x11-libs/libXfixes[${MULTILIB_USEDEP}]
73 + x11-libs/libXi[${MULTILIB_USEDEP}]
74 + x11-libs/libXrandr[${MULTILIB_USEDEP}]
75 + x11-libs/libXrender[${MULTILIB_USEDEP}]
76 + x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
77 + fontconfig? ( media-libs/fontconfig[${MULTILIB_USEDEP}] )
78 + osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
79 + sdl? ( media-libs/libsdl2[haptic,joystick,${MULTILIB_USEDEP}] )
80 + ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
81 + udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
82 + v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
83 + xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
84 + xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )"
85 +WINE_COMMON_DEPEND="
86 + ${WINE_DLOPEN_DEPEND}
87 + x11-libs/libX11[${MULTILIB_USEDEP}]
88 + x11-libs/libXext[${MULTILIB_USEDEP}]
89 + alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
90 + gstreamer? (
91 + dev-libs/glib:2[${MULTILIB_USEDEP}]
92 + media-libs/gst-plugins-base:1.0[opengl,${MULTILIB_USEDEP}]
93 + media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
94 + )
95 + openal? ( media-libs/openal[${MULTILIB_USEDEP}] )
96 + pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
97 + udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
98 + unwind? (
99 + llvm-libunwind? ( sys-libs/llvm-libunwind[${MULTILIB_USEDEP}] )
100 + !llvm-libunwind? ( sys-libs/libunwind:=[${MULTILIB_USEDEP}] )
101 + )
102 + usb? ( dev-libs/libusb:1[${MULTILIB_USEDEP}] )
103 + vkd3d? ( >=app-emulation/vkd3d-1.2[${MULTILIB_USEDEP}] )"
104 +RDEPEND="
105 + ${WINE_COMMON_DEPEND}
106 + app-emulation/wine-desktop-common
107 + gecko? ( app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] )
108 + gstreamer? ( media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}] )
109 + mono? ( app-emulation/wine-mono:${WINE_MONO} )
110 + perl? (
111 + dev-lang/perl
112 + dev-perl/XML-LibXML
113 + )
114 + selinux? ( sec-policy/selinux-wine )
115 + udisks? ( sys-fs/udisks:2 )"
116 +DEPEND="
117 + ${WINE_COMMON_DEPEND}
118 + sys-kernel/linux-headers
119 + x11-base/xorg-proto"
120 +BDEPEND="
121 + ${PYTHON_DEPS}
122 + dev-lang/perl
123 + sys-devel/bison
124 + sys-devel/flex
125 + virtual/pkgconfig
126 + nls? ( sys-devel/gettext )
127 + !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
128 +IDEPEND=">=app-eselect/eselect-wine-1.2.2-r1"
129 +
130 +QA_TEXTRELS="usr/lib/*/wine/i386-unix/*.so" # uses -fno-PIC -Wl,-z,notext
131 +
132 +PATCHES=(
133 + "${FILESDIR}"/${PN}-7.0.4-llvm-libunwind.patch
134 + "${FILESDIR}"/${PN}-7.0.4-musl.patch
135 + "${FILESDIR}"/${PN}-7.0.4-noexecstack.patch
136 + "${FILESDIR}"/${PN}-7.0.4-restore-menubuilder.patch
137 +)
138 +
139 +pkg_pretend() {
140 + [[ ${MERGE_TYPE} == binary ]] && return
141 +
142 + if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
143 + local mingw=-w64-mingw32
144 + for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev abi_x86_32 i686${mingw}); do
145 + if ! type -P ${mingw}-gcc >/dev/null; then
146 + eerror "With USE=crossdev-mingw, you must prepare the MinGW toolchain"
147 + eerror "yourself by installing sys-devel/crossdev then running:"
148 + eerror
149 + eerror " crossdev --target ${mingw}"
150 + eerror
151 + eerror "For more information, please see: https://wiki.gentoo.org/wiki/Mingw"
152 + eerror "--> Note that mingw builds are default for ${PN} even without this USE."
153 + die "USE=crossdev-mingw is enabled, but ${mingw}-gcc was not found"
154 + fi
155 + done
156 + fi
157 +}
158 +
159 +src_prepare() {
160 + # sanity check, bumping these has a history of oversights
161 + local geckomono=$(sed -En '/^#define (GECKO|MONO)_VER/{s/[^0-9.]//gp}' \
162 + dlls/appwiz.cpl/addons.c || die)
163 + if [[ ${WINE_GECKO}$'\n'${WINE_MONO} != "${geckomono}" ]]; then
164 + local gmfatal=
165 + [[ ${PV} == *9999 ]] && gmfatal=nonfatal
166 + ${gmfatal} die -n "gecko/mono mismatch in ebuild, has: " ${geckomono} " (please file a bug)"
167 + fi
168 +
169 + default
170 +
171 + # ensure .desktop calls this variant + slot
172 + sed -i "/^Exec=/s/wine /${P} /" loader/wine.desktop || die
173 +
174 + # similarly to staging, append to `wine --version` for identification
175 + sed -i "s/wine_build[^1]*1/& (Proton-${WINE_PV})/" configure.ac || die
176 +
177 + # always update for patches (including user's wrt #432348)
178 + eautoreconf
179 + tools/make_requests || die # perl
180 + dlls/winevulkan/make_vulkan -x vk.xml || die # python, needed for proton's
181 +}
182 +
183 +src_configure() {
184 + WINE_PREFIX=/usr/lib/${P}
185 + WINE_DATADIR=/usr/share/${P}
186 +
187 + local conf=(
188 + --prefix="${EPREFIX}"${WINE_PREFIX}
189 + --datadir="${EPREFIX}"${WINE_DATADIR}
190 + --includedir="${EPREFIX}"/usr/include/${P}
191 + --libdir="${EPREFIX}"${WINE_PREFIX}
192 + --mandir="${EPREFIX}"${WINE_DATADIR}/man
193 +
194 + # upstream (Valve) doesn't really support misc configurations (e.g.
195 + # adds vulkan code not always guarded by --with-vulkan), so force
196 + # some major options that are typically needed by games either way
197 + --with-freetype
198 + --with-mingw # needed by many, notably Blizzard titles
199 + --with-opengl
200 + --with-vulkan
201 + --with-x
202 +
203 + # ...and disable most options unimportant for games and unused by
204 + # Proton rather than expose as volatile USEs with little support
205 + --without-capi
206 + --without-cups
207 + --without-gphoto
208 + --without-gssapi
209 + --without-krb5
210 + --without-ldap
211 + --without-netapi
212 + --without-opencl
213 + --without-pcap
214 + --without-sane
215 + ac_cv_lib_soname_odbc=
216 +
217 + $(use_enable gecko mshtml)
218 + $(use_enable mono mscoree)
219 + --disable-tests
220 + $(use_with alsa)
221 + $(use_with fontconfig)
222 + $(use_with gstreamer)
223 + $(use_with nls gettext)
224 + $(use_with openal)
225 + $(use_with osmesa)
226 + --without-oss # media-sound/oss is not packaged (OSSv4)
227 + $(use_with pulseaudio pulse)
228 + $(use_with sdl)
229 + $(use_with ssl gnutls)
230 + $(use_with udev)
231 + $(use_with udisks dbus) # dbus is only used for udisks
232 + $(use_with unwind)
233 + $(use_with usb)
234 + $(use_with v4l v4l2)
235 + $(use_with vkd3d)
236 + $(use_with xcomposite)
237 + $(use_with xinerama)
238 + )
239 +
240 + tc-ld-force-bfd #867097
241 + use custom-cflags || strip-flags # can break in obscure ways, also no lto
242 + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
243 +
244 + # build using upstream's way (--with-wine64)
245 + # order matters: configure+compile 64->32, install 32->64
246 + local -i bits
247 + for bits in $(usev abi_x86_64 64) $(usev abi_x86_32 32); do
248 + (
249 + einfo "Configuring ${PN} for ${bits}bits in ${WORKDIR}/build${bits} ..."
250 +
251 + mkdir ../build${bits} || die
252 + cd ../build${bits} || die
253 +
254 + # CROSSCC_amd64/x86 are unused by Wine, but recognized here for users
255 + if (( bits == 64 )); then
256 + : "${CROSSCC:=${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}}"
257 + conf+=( --enable-win64 )
258 + elif use amd64; then
259 + conf+=(
260 + $(usev abi_x86_64 --with-wine64=../build64)
261 + TARGETFLAGS=-m32 # for widl
262 + )
263 + # _setup is optional, but use over Wine's auto-detect (+#472038)
264 + multilib_toolchain_setup x86
265 + fi
266 + : "${CROSSCC:=${CROSSCC_x86:-i686-w64-mingw32-gcc}}"
267 +
268 + # use *FLAGS for mingw, but strip unsupported (e.g. --hash-style=gnu)
269 + : "${CROSSCFLAGS:=$(CC=${CROSSCC} test-flags-CC ${CFLAGS:--O2})}"
270 + : "${CROSSLDFLAGS:=$(
271 + filter-flags '-fuse-ld=*'
272 + CC=${CROSSCC} test-flags-CCLD ${LDFLAGS})}"
273 + export CROSS{CC,{C,LD}FLAGS}
274 +
275 + ECONF_SOURCE=${S} econf "${conf[@]}"
276 + )
277 + done
278 +}
279 +
280 +src_compile() {
281 + use abi_x86_64 && emake -C ../build64 # do first
282 + use abi_x86_32 && emake -C ../build32
283 +}
284 +
285 +src_install() {
286 + use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install
287 + use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last
288 +
289 + # symlink for plain 'wine' and install its man pages if 64bit-only #404331
290 + if use abi_x86_64 && use !abi_x86_32; then
291 + dosym wine64 ${WINE_PREFIX}/bin/wine
292 + dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader
293 + local man
294 + for man in ../build64/loader/wine.*man; do
295 + : "${man##*/wine}"
296 + : "${_%.*}"
297 + insinto ${WINE_DATADIR}/man/${_:+${_#.}/}man1
298 + newins ${man} wine.1
299 + done
300 + fi
301 +
302 + use perl || rm "${ED}"${WINE_DATADIR}/man/man1/wine{dump,maker}.1 \
303 + "${ED}"${WINE_PREFIX}/bin/{function_grep.pl,wine{dump,maker}} || die
304 +
305 + # create variant wrappers for eselect-wine
306 + local bin
307 + for bin in "${ED}"${WINE_PREFIX}/bin/*; do
308 + make_wrapper "${bin##*/}-${P#wine-}" "${bin#"${ED}"}"
309 + done
310 +
311 + # don't let portage try to strip PE files with the wrong
312 + # strip executable and instead handle it here (saves ~120MB)
313 + dostrip -x ${WINE_PREFIX}/wine/{i386,x86_64}-windows
314 + use debug ||
315 + find "${ED}"${WINE_PREFIX}/wine/*-windows -regex '.*\.\(a\|dll\|exe\)' \
316 + -exec $(usex abi_x86_64 x86_64 i686)-w64-mingw32-strip --strip-unneeded {} + || die
317 +
318 + dodoc ANNOUNCE AUTHORS README* documentation/README*
319 + readme.gentoo_create_doc
320 +}
321 +
322 +wine-eselect() {
323 + ebegin "${1^}ing ${P} using eselect-wine"
324 + eselect wine ${1} ${P} &&
325 + eselect wine ${1} --${PN#wine-} ${P} &&
326 + eselect wine update --if-unset &&
327 + eselect wine update --${PN#wine-} --if-unset
328 + eend ${?} || die -n "eselect failed, may need to manually handle ${P}"
329 +}
330 +
331 +pkg_preinst() {
332 + has_version ${CATEGORY}/${PN} && WINE_HAD_ANY_SLOT=
333 +}
334 +
335 +pkg_postinst() {
336 + wine-eselect register
337 +
338 + [[ -v WINE_HAD_ANY_SLOT ]] || readme.gentoo_print_elog
339 +}
340 +
341 +pkg_prerm() {
342 + nonfatal wine-eselect deregister
343 +}