Gentoo Archives: gentoo-commits

From: Aric Belsito <lluixhi@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: app-emulation/wine-vanilla/files/, app-emulation/wine-vanilla/
Date: Mon, 02 Jul 2018 18:52:47
Message-Id: 1530557534.b362fbc2ac23e63422c0df6c9cd9aa2a99011aae.lluixhi@gentoo
1 commit: b362fbc2ac23e63422c0df6c9cd9aa2a99011aae
2 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
3 AuthorDate: Mon Jul 2 18:52:14 2018 +0000
4 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
5 CommitDate: Mon Jul 2 18:52:14 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=b362fbc2
7
8 app-emulation/wine-vanilla: new package
9
10 still testing
11
12 app-emulation/wine-vanilla/Manifest | 2 +
13 .../wine-vanilla/files/wine-2.0-musl-dlclose.patch | 165 +++++++
14 app-emulation/wine-vanilla/metadata.xml | 48 ++
15 .../wine-vanilla/wine-vanilla-2.0.3.ebuild | 522 +++++++++++++++++++++
16 4 files changed, 737 insertions(+)
17
18 diff --git a/app-emulation/wine-vanilla/Manifest b/app-emulation/wine-vanilla/Manifest
19 new file mode 100644
20 index 0000000..044e395
21 --- /dev/null
22 +++ b/app-emulation/wine-vanilla/Manifest
23 @@ -0,0 +1,2 @@
24 +DIST gentoo-wine-patches-20180120.tar.xz 58672 BLAKE2B 84d621075b65475cec41a06429680b518d7eafb938cefd903f3f8aa71ea3049ac9d8de05af48f9f4f4a1b9172c7ef17784540413e410eb8ec11e8ec4a63858c6 SHA512 5b354a409c7a2b77499aaa593b9248a1d15d755e3687b095755faacc30068bfcdbdd5c2a2a78617cb1a78c46d2931162bd69ec3379b035d81494bea7108263c2
25 +DIST wine-2.0.3.tar.xz 18864648 BLAKE2B 0503a11e7545d5af805bfc3c2f614b6e35e39b7b532ee45dd9947e1a9a53eb788a304e744c683e42bf84f0e67e2c046ea5f839b6bbad1cf73b9996eaae5c30c1 SHA512 e20dbcb3a48ecb3526eba075d4baebab2529dfc50b7a6d5e18294704470f61db386013f457118c270274b911f9643d203110f46558d23e84e6a6c2d78e237dbb
26
27 diff --git a/app-emulation/wine-vanilla/files/wine-2.0-musl-dlclose.patch b/app-emulation/wine-vanilla/files/wine-2.0-musl-dlclose.patch
28 new file mode 100644
29 index 0000000..35beacc
30 --- /dev/null
31 +++ b/app-emulation/wine-vanilla/files/wine-2.0-musl-dlclose.patch
32 @@ -0,0 +1,165 @@
33 +--- a/configure.ac
34 ++++ b/configure.ac
35 +@@ -1123,6 +1123,12 @@ then
36 +
37 + dnl *** End of X11/Xlib.h check
38 +
39 ++ dnl Check for the unload_after_dlclose libc
40 ++ AC_RUN_IFELSE(
41 ++ [AC_LANG_PROGRAM([[#include <dlfcn.h>]], [[dlclose(dlopen("./conftest", 0)); return 0;]])],
42 ++ ac_save_CPPFLAGS="$ac_save_CPPFLAGS -DNO_UNLOAD_AFTER_DLCLOSE",
43 ++ [])
44 ++
45 + dnl Check for the presence of OpenGL
46 + opengl_msg=""
47 + if test "x$with_opengl" != "xno"
48 +--- a/include/winternl.h 2017-01-16 00:39:34.000000000 +0000
49 ++++ a/include/winternl.h 2017-01-16 00:39:34.000000000 +0000
50 +@@ -2095,6 +2095,9 @@
51 + UNICODE_STRING BaseDllName;
52 + ULONG Flags;
53 + SHORT LoadCount;
54 ++#ifdef NO_UNLOAD_AFTER_DLCLOSE
55 ++ SHORT UnLoadCount;
56 ++#endif
57 + SHORT TlsIndex;
58 + HANDLE SectionHandle;
59 + ULONG CheckSum;
60 +--- a/dlls/ntdll/loader.c 2017-01-27 06:56:42.057449375 +0000
61 ++++ a/dlls/ntdll/loader.c 2017-01-27 06:56:42.057449375 +0000
62 +@@ -1046,6 +1046,9 @@
63 + wm->ldr.Flags = LDR_DONT_RESOLVE_REFS;
64 + wm->ldr.TlsIndex = -1;
65 + wm->ldr.LoadCount = 1;
66 ++#ifdef NO_UNLOAD_AFTER_DLCLOSE
67 ++ wm->ldr.UnLoadCount = 0;
68 ++#endif
69 + wm->ldr.SectionHandle = NULL;
70 + wm->ldr.CheckSum = 0;
71 + wm->ldr.TimeDateStamp = 0;
72 +@@ -3095,9 +3095,34 @@
73 + * LdrShutdownProcess (NTDLL.@)
74 + *
75 + */
76 ++static void free_modref( WINE_MODREF *wm );
77 + void WINAPI LdrShutdownProcess(void)
78 + {
79 + TRACE("()\n");
80 ++#ifdef NO_UNLOAD_AFTER_DLCLOSE
81 ++ PLIST_ENTRY entry, mark, prev;
82 ++ PLDR_MODULE mod;
83 ++ WINE_MODREF*wm;
84 ++
85 ++ mark = &NtCurrentTeb()->Peb->LdrData->InInitializationOrderModuleList;
86 ++ for (entry = mark->Blink; entry != mark; entry = prev)
87 ++ {
88 ++ mod = CONTAINING_RECORD(entry, LDR_MODULE, InInitializationOrderModuleList);
89 ++ wm = CONTAINING_RECORD(mod, WINE_MODREF, ldr);
90 ++ prev = entry->Blink;
91 ++ if (mod->UnLoadCount) free_modref( wm );
92 ++ }
93 ++
94 ++ /* check load order list too for modules that haven't been initialized yet */
95 ++ mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
96 ++ for (entry = mark->Blink; entry != mark; entry = prev)
97 ++ {
98 ++ mod = CONTAINING_RECORD(entry, LDR_MODULE, InLoadOrderModuleList);
99 ++ wm = CONTAINING_RECORD(mod, WINE_MODREF, ldr);
100 ++ prev = entry->Blink;
101 ++ if (mod->UnLoadCount) free_modref( wm );
102 ++ }
103 ++#endif
104 + process_detaching = TRUE;
105 + process_detach();
106 + }
107 +@@ -3135,6 +3135,30 @@
108 +
109 + RtlEnterCriticalSection( &loader_section );
110 +
111 ++#ifdef NO_UNLOAD_AFTER_DLCLOSE
112 ++ PLIST_ENTRY prev;
113 ++ WINE_MODREF*wm;
114 ++
115 ++ mark = &NtCurrentTeb()->Peb->LdrData->InInitializationOrderModuleList;
116 ++ for (entry = mark->Blink; entry != mark; entry = prev)
117 ++ {
118 ++ mod = CONTAINING_RECORD(entry, LDR_MODULE, InInitializationOrderModuleList);
119 ++ wm = CONTAINING_RECORD(mod, WINE_MODREF, ldr);
120 ++ prev = entry->Blink;
121 ++ if (mod->UnLoadCount) free_modref( wm );
122 ++ }
123 ++
124 ++ /* check load order list too for modules that haven't been initialized yet */
125 ++ mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
126 ++ for (entry = mark->Blink; entry != mark; entry = prev)
127 ++ {
128 ++ mod = CONTAINING_RECORD(entry, LDR_MODULE, InLoadOrderModuleList);
129 ++ wm = CONTAINING_RECORD(mod, WINE_MODREF, ldr);
130 ++ prev = entry->Blink;
131 ++ if (mod->UnLoadCount) free_modref( wm );
132 ++ }
133 ++#endif
134 ++
135 + mark = &NtCurrentTeb()->Peb->LdrData->InInitializationOrderModuleList;
136 + for (entry = mark->Blink; entry != mark; entry = entry->Blink)
137 + {
138 +@@ -3233,6 +3233,39 @@
139 + }
140 +
141 ++#ifdef NO_UNLOAD_AFTER_DLCLOSE
142 ++/***********************************************************************
143 ++ * MODULE_IncRefCount
144 ++ *
145 ++ * The loader_section must be locked while calling this function.
146 ++ */
147 ++static void MODULE_IncRefCount( WINE_MODREF *wm )
148 ++{
149 ++ int i;
150 ++
151 ++ if ( wm->ldr.Flags & LDR_UNLOAD_IN_PROGRESS )
152 ++ return;
153 ++
154 ++ if ( wm->ldr.UnLoadCount > 0 )
155 ++ return;
156 ++
157 ++ ++wm->ldr.UnLoadCount;
158 ++ TRACE("(%s) ldr.UnLoadCount: %d\n", debugstr_w(wm->ldr.BaseDllName.Buffer), wm->ldr.UnLoadCount );
159 ++
160 ++ if ( wm->ldr.UnLoadCount == 1 )
161 ++ {
162 ++ wm->ldr.Flags |= LDR_UNLOAD_IN_PROGRESS;
163 ++
164 ++ for ( i = 0; i < wm->nDeps; i++ )
165 ++ if ( wm->deps[i] ) {
166 ++ MODULE_IncRefCount( wm );
167 ++ }
168 ++
169 ++ wm->ldr.Flags &= ~LDR_UNLOAD_IN_PROGRESS;
170 ++ }
171 ++}
172 ++#endif
173 ++
174 + /***********************************************************************
175 + * MODULE_DecRefCount
176 + *
177 + * The loader_section must be locked while calling this function.
178 +--- wine32/dlls/ntdll/loader.c
179 ++++ wine32/dlls/ntdll/loader.c
180 +@@ -3326,6 +3326,17 @@
181 + if ( wm->ldr.LoadCount <= 0 )
182 + return;
183 +
184 ++#ifdef NO_UNLOAD_AFTER_DLCLOSE
185 ++ WCHAR env[512] = { 's','x','s','.','d','l','l','|','u','r','l','m','o','n','.','d','l','l','|','m','s','i','s','i','p','.','d','l','l','|','a','d','v','p','a','c','k','.','d','l','l','|','m','s','c','o','r','e','e','.','d','l','l','|','f','u','s','i','o','n','.','d','l','l',0 };
186 ++ char *env_p = getenv("WINE_DLL_NOUNLOAD");
187 ++ if (env_p) wine_utf8_mbstowcs(0, env_p, strlen(env_p), env, 512);
188 ++ TRACE("NOUNLOAD: %s, DLL: %s\n", debugstr_w(env), debugstr_w(wm->ldr.BaseDllName.Buffer));
189 ++ if ( strstrW(env, wm->ldr.BaseDllName.Buffer) != NULL ) {
190 ++ TRACE("%s: apply nounload hacks on this platform\n", debugstr_w(wm->ldr.BaseDllName.Buffer));
191 ++ MODULE_IncRefCount(wm);
192 ++ return;
193 ++ }
194 ++#endif
195 + --wm->ldr.LoadCount;
196 + TRACE("(%s) ldr.LoadCount: %d\n", debugstr_w(wm->ldr.BaseDllName.Buffer), wm->ldr.LoadCount );
197 +
198
199 diff --git a/app-emulation/wine-vanilla/metadata.xml b/app-emulation/wine-vanilla/metadata.xml
200 new file mode 100644
201 index 0000000..4fe7411
202 --- /dev/null
203 +++ b/app-emulation/wine-vanilla/metadata.xml
204 @@ -0,0 +1,48 @@
205 +<?xml version="1.0" encoding="UTF-8"?>
206 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
207 +<pkgmetadata>
208 + <maintainer type="project">
209 + <email>wine@g.o</email>
210 + <name>Wine</name>
211 + <description>
212 + This package must be kept in sync with repo/proj/wine repository.
213 + Any changes need to be run past the maintainer to ensure the two repositories are kept in sync.
214 + </description>
215 + </maintainer>
216 + <longdescription>
217 +Wine is an Open Source implementation of the Windows API on top of X and Unix.
218 +
219 +Think of Wine as a compatibility layer for running Windows programs. Wine does not require Microsoft Windows, as it is a completely free alternative implementation of the Windows API consisting of 100% non-Microsoft code, however Wine can optionally use native Windows DLLs if they are available. Wine provides both a development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, FreeBSD, and Solaris.
220 +
221 +This variant of the Wine packaging does not include external patchsets
222 + </longdescription>
223 + <use>
224 + <flag name="capi">Enable ISDN support via CAPI</flag>
225 + <flag name="custom-cflags">Bypass strip-flags; use at your own peril</flag>
226 + <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to run DOS applications</flag>
227 + <flag name="gecko">Add support for the Gecko engine when using iexplore</flag>
228 + <flag name="gssapi">Use GSSAPI (Kerberos SSP support)</flag>
229 + <flag name="gstreamer">Use <pkg>media-libs/gstreamer</pkg> to provide DirectShow functionality;</flag>
230 + <flag name="mono">Add support for .NET using Wine's Mono add-on</flag>
231 + <flag name="netapi">Use libnetapi from <pkg>net-fs/samba</pkg> to support Windows networks in netapi32.dll</flag>
232 + <flag name="opencl">Enable OpenCL support</flag>
233 + <flag name="osmesa">Add support for OpenGL in bitmaps using libOSMesa</flag>
234 + <flag name="pcap">Support packet capture software (e.g. wireshark)</flag>
235 + <flag name="perl">Install helpers written in perl (winedump/winemaker)</flag>
236 + <flag name="prelink">Run prelink on DLLs during build;
237 + For versions before wine-1.7.55 or hardened, do not disable if you do not know what this means as it can break things at runtime</flag>
238 + <flag name="realtime">Pull in <pkg>sys-auth/rtkit</pkg> for low-latency pulseaudio support</flag>
239 + <flag name="run-exes">Use Wine to open and run .EXE and .MSI files</flag>
240 + <flag name="samba">Add support for NTLM auth. see
241 + http://wiki.winehq.org/NtlmAuthSetupGuide and
242 + http://wiki.winehq.org/NtlmSigningAndSealing</flag>
243 + <flag name="sdl">Add support for gamepad detection using SDL</flag>
244 + <flag name="udev">Use <pkg>virtual/libudev</pkg> to provide plug and play support</flag>
245 + <flag name="vkd3d">Use <pkg>app-emulation/vkd3d</pkg> to provide Direct3D 12 support</flag>
246 + <flag name="vulkan">Enable Vulkan drivers</flag>
247 + </use>
248 + <upstream>
249 + <remote-id type="github">wine-compholio/wine-staging</remote-id>
250 + <remote-id type="sourceforge">wine</remote-id>
251 + </upstream>
252 +</pkgmetadata>
253
254 diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild
255 new file mode 100644
256 index 0000000..1f7d659
257 --- /dev/null
258 +++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild
259 @@ -0,0 +1,522 @@
260 +# Copyright 1999-2018 Gentoo Foundation
261 +# Distributed under the terms of the GNU General Public License v2
262 +
263 +EAPI=6
264 +
265 +PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
266 +PLOCALE_BACKUP="en"
267 +
268 +inherit autotools estack eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
269 +
270 +MY_PN="${PN%%-*}"
271 +MY_P="${MY_PN}-${PV}"
272 +
273 +if [[ ${PV} == "9999" ]] ; then
274 + EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
275 + EGIT_BRANCH="master"
276 + inherit git-r3
277 + SRC_URI=""
278 + #KEYWORDS=""
279 +else
280 + MAJOR_V=$(get_version_component_range 1)
281 + SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.xz"
282 + KEYWORDS="-* amd64 x86 ~x86-fbsd"
283 +fi
284 +S="${WORKDIR}/${MY_P}"
285 +
286 +GWP_V="20180120"
287 +PATCHDIR="${WORKDIR}/gentoo-wine-patches"
288 +
289 +DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
290 +HOMEPAGE="https://www.winehq.org/"
291 +SRC_URI="${SRC_URI}
292 + https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
293 +"
294 +
295 +LICENSE="LGPL-2.1"
296 +SLOT="${PV}"
297 +IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
298 +REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
299 + X? ( truetype )
300 + elibc_glibc? ( threads )
301 + osmesa? ( opengl )
302 + test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
303 +
304 +# FIXME: the test suite is unsuitable for us; many tests require net access
305 +# or fail due to Xvfb's opengl limitations.
306 +RESTRICT="test"
307 +
308 +COMMON_DEPEND="
309 + X? (
310 + x11-libs/libXcursor[${MULTILIB_USEDEP}]
311 + x11-libs/libXext[${MULTILIB_USEDEP}]
312 + x11-libs/libXrandr[${MULTILIB_USEDEP}]
313 + x11-libs/libXi[${MULTILIB_USEDEP}]
314 + x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
315 + )
316 + alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
317 + capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
318 + cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
319 + fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
320 + gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
321 + gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
322 + gstreamer? (
323 + media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
324 + media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
325 + )
326 + jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
327 + lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
328 + ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
329 + mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
330 + ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
331 + netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
332 + nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
333 + odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
334 + openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
335 + opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
336 + opengl? (
337 + virtual/glu[${MULTILIB_USEDEP}]
338 + virtual/opengl[${MULTILIB_USEDEP}]
339 + )
340 + osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
341 + pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
342 + png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
343 + pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
344 + scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
345 + ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
346 + truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
347 + udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
348 + udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
349 + v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
350 + xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
351 + xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
352 + xml? (
353 + dev-libs/libxml2[${MULTILIB_USEDEP}]
354 + dev-libs/libxslt[${MULTILIB_USEDEP}]
355 + )"
356 +
357 +RDEPEND="${COMMON_DEPEND}
358 + app-emulation/wine-desktop-common
359 + >app-eselect/eselect-wine-0.3
360 + !app-emulation/wine:0
361 + dos? ( >=games-emulation/dosbox-0.74_p20160629 )
362 + gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
363 + mono? ( app-emulation/wine-mono:4.6.4 )
364 + perl? (
365 + dev-lang/perl
366 + dev-perl/XML-Simple
367 + )
368 + pulseaudio? (
369 + realtime? ( sys-auth/rtkit )
370 + )
371 + samba? ( >=net-fs/samba-3.0.25[winbind] )
372 + selinux? ( sec-policy/selinux-wine )
373 + udisks? ( sys-fs/udisks:2 )"
374 +
375 +# tools/make_requests requires perl
376 +DEPEND="${COMMON_DEPEND}
377 + sys-devel/flex
378 + >=sys-kernel/linux-headers-2.6
379 + virtual/pkgconfig
380 + virtual/yacc
381 + X? ( x11-base/xorg-proto )
382 + prelink? ( sys-devel/prelink )
383 + xinerama? ( x11-base/xorg-proto )"
384 +
385 +# These use a non-standard "Wine" category, which is provided by
386 +# /etc/xdg/applications-merged/wine.menu
387 +QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
388 +usr/share/applications/wine-notepad.desktop
389 +usr/share/applications/wine-uninstaller.desktop
390 +usr/share/applications/wine-winecfg.desktop"
391 +
392 +PATCHES=(
393 + "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
394 + "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
395 + "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
396 + "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch" #310611
397 + "${PATCHDIR}/patches/${MY_PN}-2.0-rearrange-manpages.patch" #469418 #617864
398 + "${FILESDIR}/${MY_PN}-2.0-musl-dlclose.patch
399 +)
400 +PATCHES_BIN=()
401 +
402 +# https://bugs.gentoo.org/show_bug.cgi?id=635222
403 +if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
404 + DEPEND+=" dev-util/patchbin"
405 +fi
406 +
407 +wine_compiler_check() {
408 + [[ ${MERGE_TYPE} = "binary" ]] && return 0
409 +
410 + # GCC-specific bugs
411 + if tc-is-gcc; then
412 + # bug #549768
413 + if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
414 + ebegin "Checking for gcc-5 ms_abi compiler bug"
415 + $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
416 + # Run in subshell to prevent "Aborted" message
417 + ( "${T}"/pr66838 || false ) >/dev/null 2>&1
418 + if ! eend $?; then
419 + eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
420 + eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
421 + eerror "or use gcc-config to select a different compiler version."
422 + eerror "See https://bugs.gentoo.org/549768"
423 + eerror
424 + return 1
425 + fi
426 + fi
427 + # bug #574044
428 + if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
429 + ebegin "Checking for gcc-5-3 stack realignment compiler bug"
430 + # Compile in subshell to prevent "Aborted" message
431 + ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
432 + if ! eend $?; then
433 + eerror "Wine cannot be built with this version of gcc-5.3"
434 + eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
435 + eerror "or use gcc-config to select a different compiler version."
436 + eerror "See https://bugs.gentoo.org/574044"
437 + eerror
438 + return 1
439 + fi
440 + fi
441 + fi
442 +
443 + # Ensure compiler support
444 + if use abi_x86_64; then
445 + ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
446 + # Compile in subshell to prevent "Aborted" message
447 + ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
448 + if ! eend $?; then
449 + eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
450 + eerror
451 + eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
452 + eerror
453 + return 1
454 + fi
455 + fi
456 +}
457 +
458 +wine_build_environment_check() {
459 + [[ ${MERGE_TYPE} = "binary" ]] && return 0
460 +
461 + if use abi_x86_64; then
462 + if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
463 + eerror "You need gcc-4.4+ to compile 64-bit wine"
464 + die
465 + elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
466 + eerror "You need clang-3.8+ to compile 64-bit wine"
467 + die
468 + fi
469 + fi
470 + if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
471 + ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
472 + ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
473 + ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
474 + fi
475 + if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
476 + if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
477 + ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
478 + ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
479 + ewarn "See package.env in man 5 portage for more information on how to do this."
480 + ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
481 + fi
482 + fi
483 +
484 + if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
485 + eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
486 + eerror "See https://bugs.gentoo.org/487864 for more details."
487 + eerror
488 + return 1
489 + fi
490 +}
491 +
492 +wine_env_vcs_vars() {
493 + local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
494 + local pn_live_val="${pn_live_var}"
495 + eval pn_live_val='$'${pn_live_val}
496 + if [[ ! -z ${EGIT_COMMIT} ]]; then
497 + eerror "Commits must now be specified using the environmental variables"
498 + eerror "WINE_COMMIT"
499 + eerror
500 + return 1
501 + fi
502 +}
503 +
504 +pkg_pretend() {
505 + wine_build_environment_check || die
506 +
507 + # Verify OSS support
508 + if use oss && ! use kernel_FreeBSD; then
509 + if ! has_version ">=media-sound/oss-4"; then
510 + eerror "You cannot build wine with USE=oss without having support from a"
511 + eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
512 + eerror
513 + die
514 + fi
515 + fi
516 +}
517 +
518 +pkg_setup() {
519 + wine_build_environment_check || die
520 + wine_env_vcs_vars || die
521 +
522 + WINE_VARIANT="${PN#wine}-${PV}"
523 + WINE_VARIANT="${WINE_VARIANT#-}"
524 +
525 + MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
526 + MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
527 + MY_DATADIR="${MY_DATAROOTDIR}"
528 + MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
529 + MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
530 + MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
531 + MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
532 + MY_MANDIR="${MY_DATADIR}/man"
533 +}
534 +
535 +src_unpack() {
536 + if [[ ${PV} == "9999" ]] ; then
537 + EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
538 + fi
539 +
540 + default
541 +
542 + l10n_find_plocales_changes "${S}/po" "" ".po"
543 +}
544 +
545 +src_prepare() {
546 +
547 + eapply_bin(){
548 + local patch
549 + for patch in ${PATCHES_BIN[@]}; do
550 + patchbin --nogit < "${patch}" || die
551 + done
552 + }
553 +
554 + local md5="$(md5sum server/protocol.def)"
555 +
556 + default
557 + eapply_bin
558 + eautoreconf
559 +
560 + # Modification of the server protocol requires regenerating the server requests
561 + if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
562 + einfo "server/protocol.def was patched; running tools/make_requests"
563 + tools/make_requests || die #432348
564 + fi
565 + sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
566 + if ! use run-exes; then
567 + sed -i '/^MimeType/d' loader/wine.desktop || die #117785
568 + fi
569 +
570 + # Edit wine.desktop to work for specific variant
571 + sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
572 +
573 + # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
574 + cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
575 +
576 + l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
577 +
578 + # Fix manpage generation for locales #469418 and abi_x86_64 #617864
579 + # Requires wine-2.0-rearrange-manpages.patch
580 +
581 + # Duplicate manpages input files for wine64
582 + local f
583 + for f in loader/*.man.in; do
584 + cp ${f} ${f/wine/wine64} || die
585 + done
586 + # Add wine64 manpages to Makefile
587 + if use abi_x86_64; then
588 + sed -i "/wine.man.in/i \
589 + \\\twine64.man.in \\\\" loader/Makefile.in || die
590 + sed -i -E 's/(.*wine)(.*\.UTF-8\.man\.in.*)/&\
591 +\164\2/' loader/Makefile.in || die
592 + fi
593 +
594 + rm_man_file(){
595 + local file="${1}"
596 + loc=${2}
597 + sed -i "/${loc}\.UTF-8\.man\.in/d" "${file}" || die
598 + }
599 +
600 + while read f; do
601 + l10n_for_each_disabled_locale_do rm_man_file "${f}"
602 + done < <(find -name "Makefile.in" -exec grep -q "UTF-8.man.in" "{}" \; -print)
603 +}
604 +
605 +src_configure() {
606 + wine_compiler_check || die
607 +
608 + export LDCONFIG=/bin/true
609 + use custom-cflags || strip-flags
610 +
611 + multilib-minimal_src_configure
612 +}
613 +
614 +multilib_src_configure() {
615 + local myconf=(
616 + --prefix="${MY_PREFIX}"
617 + --datarootdir="${MY_DATAROOTDIR}"
618 + --datadir="${MY_DATADIR}"
619 + --docdir="${MY_DOCDIR}"
620 + --includedir="${MY_INCLUDEDIR}"
621 + --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
622 + --libexecdir="${MY_LIBEXECDIR}"
623 + --localstatedir="${MY_LOCALSTATEDIR}"
624 + --mandir="${MY_MANDIR}"
625 + --sysconfdir=/etc/wine
626 + $(use_with alsa)
627 + $(use_with capi)
628 + $(use_with lcms cms)
629 + $(use_with cups)
630 + $(use_with ncurses curses)
631 + $(use_with udisks dbus)
632 + $(use_with fontconfig)
633 + $(use_with ssl gnutls)
634 + $(use_enable gecko mshtml)
635 + $(use_with gphoto2 gphoto)
636 + $(use_with gsm)
637 + $(use_with gstreamer)
638 + --without-hal
639 + $(use_with jpeg)
640 + $(use_with ldap)
641 + $(use_enable mono mscoree)
642 + $(use_with mp3 mpg123)
643 + $(use_with netapi)
644 + $(use_with nls gettext)
645 + $(use_with openal)
646 + $(use_with opencl)
647 + $(use_with opengl)
648 + $(use_with osmesa)
649 + $(use_with oss)
650 + $(use_with pcap)
651 + $(use_with png)
652 + $(use_with pulseaudio pulse)
653 + $(use_with threads pthread)
654 + $(use_with scanner sane)
655 + $(use_enable test tests)
656 + $(use_with truetype freetype)
657 + $(use_with udev)
658 + $(use_with v4l)
659 + $(use_with X x)
660 + $(use_with xcomposite)
661 + $(use_with xinerama)
662 + $(use_with xml)
663 + $(use_with xml xslt)
664 + )
665 +
666 + local PKG_CONFIG AR RANLIB
667 + # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
668 + # set AR and RANLIB to make QA scripts happy; #483342
669 + tc-export PKG_CONFIG AR RANLIB
670 +
671 + if use amd64; then
672 + if [[ ${ABI} == amd64 ]]; then
673 + myconf+=( --enable-win64 )
674 + else
675 + myconf+=( --disable-win64 )
676 + fi
677 +
678 + # Note: using --with-wine64 results in problems with multilib.eclass
679 + # CC/LD hackery. We're using separate tools instead.
680 + fi
681 +
682 + ECONF_SOURCE=${S} \
683 + econf "${myconf[@]}"
684 + emake depend
685 +}
686 +
687 +multilib_src_test() {
688 + # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
689 + if [[ ${ABI} == x86 ]]; then
690 + if [[ $(id -u) == 0 ]]; then
691 + ewarn "Skipping tests since they cannot be run under the root user."
692 + ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
693 + return
694 + fi
695 +
696 + WINEPREFIX="${T}/.wine-${ABI}" \
697 + Xemake test
698 + fi
699 +}
700 +
701 +multilib_src_install_all() {
702 + local DOCS=( ANNOUNCE AUTHORS README )
703 + add_locale_docs() {
704 + local locale_doc="documentation/README.$1"
705 + [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
706 + }
707 + l10n_for_each_locale_do add_locale_docs
708 +
709 + einstalldocs
710 + prune_libtool_files --all
711 +
712 + if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
713 + rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
714 + "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
715 + fi
716 +
717 + # Remove wineconsole if neither backend is installed #551124
718 + if ! use X && ! use ncurses; then
719 + rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
720 + rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
721 + rm_wineconsole() {
722 + rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
723 + }
724 + multilib_foreach_abi rm_wineconsole
725 + fi
726 +
727 + use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
728 + use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
729 +
730 + if use abi_x86_64 && ! use abi_x86_32; then
731 + dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
732 + dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
733 + fi
734 +
735 + # Failglob for binloops, shouldn't be necessary, but including to stay safe
736 + eshopts_push -s failglob #615218
737 + # Make wrappers for binaries for handling multiple variants
738 + # Note: wrappers instead of symlinks because some are shell which use basename
739 + local b
740 + for b in "${D%/}${MY_PREFIX}"/bin/*; do
741 + make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
742 + done
743 + eshopts_pop
744 +}
745 +
746 +pkg_postinst() {
747 + eselect wine register ${P}
748 + if [[ ${PN} == "wine-vanilla" ]]; then
749 + eselect wine register --vanilla ${P} || die
750 + fi
751 +
752 + eselect wine update --all --if-unset || die
753 +
754 + xdg_desktop_database_update
755 +
756 + if ! use gecko; then
757 + ewarn "Without Wine Gecko, wine prefixes will not have a default"
758 + ewarn "implementation of iexplore. Many older windows applications"
759 + ewarn "rely upon the existence of an iexplore implementation, so"
760 + ewarn "you will likely need to install an external one, like via winetricks"
761 + fi
762 + if ! use mono; then
763 + ewarn "Without Wine Mono, wine prefixes will not have a default"
764 + ewarn "implementation of .NET. Many windows applications rely upon"
765 + ewarn "the existence of a .NET implementation, so you will likely need"
766 + ewarn "to install an external one, like via winetricks"
767 + fi
768 +}
769 +
770 +pkg_prerm() {
771 + eselect wine deregister ${P}
772 + if [[ ${PN} == "wine-vanilla" ]]; then
773 + eselect wine deregister --vanilla ${P} || die
774 + fi
775 +
776 + eselect wine update --all --if-unset || die
777 +}
778 +
779 +pkg_postrm() {
780 + xdg_desktop_database_update
781 +}