]> git.draconx.ca Git - gentoo-fixes.git/blob - app-emulation/wine-vanilla/wine-vanilla-4.0.4-r1.ebuild
1a5f201b0208d9ef51188cafcab6d22584689b7a
[gentoo-fixes.git] / app-emulation / wine-vanilla / wine-vanilla-4.0.4-r1.ebuild
1 # This ebuild is a modified version of the work originally distributed with
2 # Gentoo GNU/Linux, covered by the following copyright and permission notice:
3 #
4 #   Copyright 1999-2021 Gentoo Authors
5 #   Distributed under the terms of the GNU General Public License v2
6 #
7 # The modifications are:
8 #
9 #   * Apply patch to build successfully with Autoconf 2.71 (2021-11)
10 #   * Build with -fcommon to get compatible behaviour from GCC 10 (2022-04)
11 #   * Port to EAPI 8 for compatibility with current eclasses (2022-12)
12
13 EAPI=8
14
15 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 si sk sl sr_RS@cyrillic sr_RS@latin sv ta te th tr uk wa zh_CN zh_TW"
16 PLOCALE_BACKUP="en"
17
18 inherit autotools estack flag-o-matic multilib multilib-minimal pax-utils plocale toolchain-funcs virtualx wrapper xdg-utils
19
20 MY_PN="${PN%%-*}"
21 MY_P="${MY_PN}-${PV}"
22
23 if [[ ${PV} == "9999" ]] ; then
24         EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
25         EGIT_BRANCH="master"
26         inherit git-r3
27         SRC_URI=""
28         #KEYWORDS=""
29 else
30         MAJOR_V=$(ver_cut 1)
31         MINOR_V=$(ver_cut 2)
32         SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.${MINOR_V}/${MY_P}.tar.xz"
33         KEYWORDS="-* ~amd64 ~x86"
34 fi
35 S="${WORKDIR}/${MY_P}"
36
37 GWP_V="20180120"
38 PATCHDIR="${WORKDIR}/gentoo-wine-patches"
39
40 DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
41 HOMEPAGE="https://www.winehq.org/"
42 SRC_URI="${SRC_URI}
43         https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
44 "
45
46 LICENSE="LGPL-2.1"
47 SLOT="${PV}"
48 IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gssapi gstreamer +jpeg kerberos 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 sdl selinux +ssl test +threads +truetype udev +udisks v4l vkd3d vulkan +X +xcomposite xinerama +xml"
49 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
50         X? ( truetype )
51         elibc_glibc? ( threads )
52         osmesa? ( opengl )
53         test? ( abi_x86_32 )
54         vkd3d? ( vulkan )" # osmesa-opengl #286560 # X-truetype #551124
55
56 # FIXME: the test suite is unsuitable for us; many tests require net access
57 # or fail due to Xvfb's opengl limitations.
58 RESTRICT="test"
59
60 BDEPEND="virtual/pkgconfig
61         sys-devel/bison
62         sys-devel/flex"
63
64 COMMON_DEPEND="
65         X? (
66                 x11-libs/libXcursor[${MULTILIB_USEDEP}]
67                 x11-libs/libXext[${MULTILIB_USEDEP}]
68                 x11-libs/libXfixes[${MULTILIB_USEDEP}]
69                 x11-libs/libXrandr[${MULTILIB_USEDEP}]
70                 x11-libs/libXi[${MULTILIB_USEDEP}]
71                 x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
72         )
73         alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
74         capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
75         cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
76         fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
77         gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
78         gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
79         gssapi? ( virtual/krb5[${MULTILIB_USEDEP}] )
80         gstreamer? (
81                 media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
82                 media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
83         )
84         jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
85         kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
86         lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
87         ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
88         mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
89         ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
90         netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
91         nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
92         odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
93         openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
94         opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
95         opengl? (
96                 virtual/glu[${MULTILIB_USEDEP}]
97                 virtual/opengl[${MULTILIB_USEDEP}]
98         )
99         osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
100         pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
101         png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
102         pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
103         scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
104         sdl? ( media-libs/libsdl2:=[haptic,joystick,${MULTILIB_USEDEP}] )
105         ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
106         truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
107         udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
108         udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
109         v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
110         vkd3d? ( app-emulation/vkd3d[${MULTILIB_USEDEP}] )
111         vulkan? ( media-libs/vulkan-loader[${MULTILIB_USEDEP}] )
112         xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
113         xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
114         xml? (
115                 dev-libs/libxml2[${MULTILIB_USEDEP}]
116                 dev-libs/libxslt[${MULTILIB_USEDEP}]
117         )"
118
119 RDEPEND="${COMMON_DEPEND}
120         app-emulation/wine-desktop-common
121         >app-eselect/eselect-wine-0.3
122         !app-emulation/wine:0
123         dos? ( >=games-emulation/dosbox-0.74_p20160629 )
124         gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
125         mono? ( app-emulation/wine-mono:4.7.5 )
126         perl? (
127                 dev-lang/perl
128                 dev-perl/XML-Simple
129         )
130         pulseaudio? (
131                 realtime? ( sys-auth/rtkit )
132         )
133         samba? ( >=net-fs/samba-3.0.25[winbind] )
134         selinux? ( sec-policy/selinux-wine )
135         udisks? ( sys-fs/udisks:2 )"
136
137 # tools/make_requests requires perl
138 DEPEND="${COMMON_DEPEND}
139         >=sys-kernel/linux-headers-2.6
140         X? ( x11-base/xorg-proto )
141         prelink? ( sys-devel/prelink )
142         xinerama? ( x11-base/xorg-proto )"
143
144 # These use a non-standard "Wine" category, which is provided by
145 # /etc/xdg/applications-merged/wine.menu
146 QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
147 usr/share/applications/wine-notepad.desktop
148 usr/share/applications/wine-uninstaller.desktop
149 usr/share/applications/wine-winecfg.desktop"
150
151 PATCHES=(
152         "$FILESDIR/$PV-configure-fixes.patch"
153         "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
154         "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
155         "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
156         "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch" #310611
157 )
158 PATCHES_BIN=()
159
160 # https://bugs.gentoo.org/show_bug.cgi?id=635222
161 if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
162         DEPEND+=" dev-util/patchbin"
163 fi
164
165 wine_compiler_check() {
166         [[ ${MERGE_TYPE} = "binary" ]] && return 0
167
168         # GCC-specific bugs
169         if tc-is-gcc; then
170                 # bug #549768
171                 if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
172                         ebegin "Checking for gcc-5 ms_abi compiler bug"
173                         $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
174                         # Run in subshell to prevent "Aborted" message
175                         ( "${T}"/pr66838 || false ) >/dev/null 2>&1
176                         if ! eend $?; then
177                                 eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
178                                 eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
179                                 eerror "or use gcc-config to select a different compiler version."
180                                 eerror "See https://bugs.gentoo.org/549768"
181                                 eerror
182                                 return 1
183                         fi
184                 fi
185                 # bug #574044
186                 if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
187                         ebegin "Checking for gcc-5-3 stack realignment compiler bug"
188                         # Compile in subshell to prevent "Aborted" message
189                         ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
190                         if ! eend $?; then
191                                 eerror "Wine cannot be built with this version of gcc-5.3"
192                                 eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
193                                 eerror "or use gcc-config to select a different compiler version."
194                                 eerror "See https://bugs.gentoo.org/574044"
195                                 eerror
196                                 return 1
197                         fi
198                 fi
199         fi
200
201         # Ensure compiler support
202         if use abi_x86_64; then
203                 ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
204                 # Compile in subshell to prevent "Aborted" message
205                 ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
206                 if ! eend $?; then
207                         eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
208                         eerror
209                         eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
210                         eerror
211                         return 1
212                 fi
213         fi
214 }
215
216 wine_build_environment_check() {
217         [[ ${MERGE_TYPE} = "binary" ]] && return 0
218
219         if use abi_x86_64; then
220                 if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
221                         eerror "You need gcc-4.4+ to compile 64-bit wine"
222                         die
223                 elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
224                         eerror "You need clang-3.8+ to compile 64-bit wine"
225                         die
226                 fi
227         fi
228         if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
229                 ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
230                 ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
231                 ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
232         fi
233         if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
234                 if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
235                         ewarn "Compilation can hang with CFLAGS=\"-march=i686\".  You can temporarily work"
236                         ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
237                         ewarn "See package.env in man 5 portage for more information on how to do this."
238                         ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
239                 fi
240         fi
241
242         if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
243                 eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
244                 eerror "See https://bugs.gentoo.org/487864 for more details."
245                 eerror
246                 return 1
247         fi
248 }
249
250 wine_env_vcs_vars() {
251         local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
252         local pn_live_val="${pn_live_var}"
253         eval pn_live_val='$'${pn_live_val}
254         if [[ ! -z ${EGIT_COMMIT} ]]; then
255                 eerror "Commits must now be specified using the environmental variables"
256                 eerror "EGIT_OVERRIDE_COMMIT_WINE"
257                 eerror
258                 return 1
259         fi
260 }
261
262 pkg_pretend() {
263         wine_build_environment_check || die
264
265         # Verify OSS support
266         if use oss && ! use kernel_FreeBSD; then
267                 if ! has_version ">=media-sound/oss-4"; then
268                         eerror "You cannot build wine with USE=oss without having support from a"
269                         eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
270                         eerror
271                         die
272                 fi
273         fi
274 }
275
276 pkg_setup() {
277         wine_build_environment_check || die
278         wine_env_vcs_vars || die
279
280         WINE_VARIANT="${PN#wine}-${PV}"
281         WINE_VARIANT="${WINE_VARIANT#-}"
282
283         MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
284         MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
285         MY_DATADIR="${MY_DATAROOTDIR}"
286         MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
287         MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
288         MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
289         MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
290         MY_MANDIR="${MY_DATADIR}/man"
291 }
292
293 src_unpack() {
294         if [[ ${PV} == "9999" ]] ; then
295                 EGIT_CHECKOUT_DIR="${S}" git-r3_src_unpack
296         fi
297
298         default
299
300         plocale_find_changes "${S}/po" "" ".po"
301 }
302
303 src_prepare() {
304
305         eapply_bin(){
306                 local patch
307                 for patch in ${PATCHES_BIN[@]}; do
308                         patchbin --nogit < "${patch}" || die
309                 done
310         }
311
312         local md5="$(md5sum server/protocol.def)"
313
314         default
315         eapply_bin
316         eautoreconf
317
318         # Modification of the server protocol requires regenerating the server requests
319         if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
320                 einfo "server/protocol.def was patched; running tools/make_requests"
321                 tools/make_requests || die #432348
322         fi
323         sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
324         if ! use run-exes; then
325                 sed -i '/^MimeType/d' loader/wine.desktop || die #117785
326         fi
327
328         # Edit wine.desktop to work for specific variant
329         sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
330
331         # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
332         cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
333
334         plocale_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
335
336         # Fix manpage generation for locales #469418 and abi_x86_64 #617864
337
338         # Duplicate manpages input files for wine64
339         local f
340         for f in loader/*.man.in; do
341                 cp ${f} ${f/wine/wine64} || die
342         done
343         # Add wine64 manpages to Makefile
344         if use abi_x86_64; then
345                 sed -i "/wine.man.in/i \
346                         \\\twine64.man.in \\\\" loader/Makefile.in || die
347                 sed -i -E 's/(.*wine)(.*\.UTF-8\.man\.in.*)/&\
348 \164\2/' loader/Makefile.in || die
349         fi
350
351         rm_man_file(){
352                 local file="${1}"
353                 loc=${2}
354                 sed -i "/${loc}\.UTF-8\.man\.in/d" "${file}" || die
355         }
356
357         while read f; do
358                 plocale_for_each_disabled_locale rm_man_file "${f}"
359         done < <(find -name "Makefile.in" -exec grep -q "UTF-8.man.in" "{}" \; -print)
360 }
361
362 src_configure() {
363         wine_compiler_check || die
364
365         export LDCONFIG=/bin/true
366         use custom-cflags || strip-flags
367         append-flags -fcommon
368
369         multilib-minimal_src_configure
370 }
371
372 multilib_src_configure() {
373         local myconf=(
374                 --prefix="${MY_PREFIX}"
375                 --datarootdir="${MY_DATAROOTDIR}"
376                 --datadir="${MY_DATADIR}"
377                 --docdir="${MY_DOCDIR}"
378                 --includedir="${MY_INCLUDEDIR}"
379                 --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
380                 --libexecdir="${MY_LIBEXECDIR}"
381                 --localstatedir="${MY_LOCALSTATEDIR}"
382                 --mandir="${MY_MANDIR}"
383                 --sysconfdir=/etc/wine
384                 $(use_with alsa)
385                 $(use_with capi)
386                 $(use_with lcms cms)
387                 $(use_with cups)
388                 $(use_with ncurses curses)
389                 $(use_with udisks dbus)
390                 $(use_with fontconfig)
391                 $(use_with ssl gnutls)
392                 $(use_enable gecko mshtml)
393                 $(use_with gphoto2 gphoto)
394                 $(use_with gsm)
395                 $(use_with gssapi)
396                 $(use_with gstreamer)
397                 --without-hal
398                 $(use_with jpeg)
399                 $(use_with kerberos krb5)
400                 $(use_with ldap)
401                 $(use_enable mono mscoree)
402                 $(use_with mp3 mpg123)
403                 $(use_with netapi)
404                 $(use_with nls gettext)
405                 $(use_with openal)
406                 $(use_with opencl)
407                 $(use_with opengl)
408                 $(use_with osmesa)
409                 $(use_with oss)
410                 $(use_with pcap)
411                 $(use_with png)
412                 $(use_with pulseaudio pulse)
413                 $(use_with threads pthread)
414                 $(use_with scanner sane)
415                 $(use_with sdl)
416                 $(use_enable test tests)
417                 $(use_with truetype freetype)
418                 $(use_with udev)
419                 $(use_with v4l)
420                 $(use_with vkd3d)
421                 $(use_with vulkan)
422                 $(use_with X x)
423                 $(use_with X xfixes)
424                 $(use_with xcomposite)
425                 $(use_with xinerama)
426                 $(use_with xml)
427                 $(use_with xml xslt)
428         )
429
430         local PKG_CONFIG AR RANLIB
431         # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
432         # set AR and RANLIB to make QA scripts happy; #483342
433         tc-export PKG_CONFIG AR RANLIB
434
435         if use amd64; then
436                 if [[ ${ABI} == amd64 ]]; then
437                         myconf+=( --enable-win64 )
438                 else
439                         myconf+=( --disable-win64 )
440                 fi
441
442                 # Note: using --with-wine64 results in problems with multilib.eclass
443                 # CC/LD hackery. We're using separate tools instead.
444         fi
445
446         ECONF_SOURCE=${S} \
447         econf "${myconf[@]}"
448         emake depend
449 }
450
451 multilib_src_test() {
452         # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
453         if [[ ${ABI} == x86 ]]; then
454                 if [[ $(id -u) == 0 ]]; then
455                         ewarn "Skipping tests since they cannot be run under the root user."
456                         ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
457                         return
458                 fi
459
460                 WINEPREFIX="${T}/.wine-${ABI}" \
461                 Xemake test
462         fi
463 }
464
465 multilib_src_install_all() {
466         local DOCS=( ANNOUNCE AUTHORS README )
467         add_locale_docs() {
468                 local locale_doc="documentation/README.$1"
469                 [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
470         }
471         plocale_for_each_locale add_locale_docs
472
473         einstalldocs
474         find "${ED}" -name *.la -delete || die
475
476         if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
477                 rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
478                         "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
479         fi
480
481         # Remove wineconsole if neither backend is installed #551124
482         if ! use X && ! use ncurses; then
483                 rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
484                 rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
485                 rm_wineconsole() {
486                         rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
487                 }
488                 multilib_foreach_abi rm_wineconsole
489         fi
490
491         use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
492         use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
493
494         if use abi_x86_64 && ! use abi_x86_32; then
495                 dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
496                 dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
497         fi
498
499         # Failglob for binloops, shouldn't be necessary, but including to stay safe
500         eshopts_push -s failglob #615218
501         # Make wrappers for binaries for handling multiple variants
502         # Note: wrappers instead of symlinks because some are shell which use basename
503         local b
504         for b in "${D%/}${MY_PREFIX}"/bin/*; do
505                 make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
506         done
507         eshopts_pop
508 }
509
510 pkg_postinst() {
511         eselect wine register ${P}
512         if [[ ${PN} == "wine-vanilla" ]]; then
513                 eselect wine register --vanilla ${P} || die
514         fi
515
516         eselect wine update --all --if-unset || die
517
518         xdg_desktop_database_update
519
520         if ! use gecko; then
521                 ewarn "Without Wine Gecko, wine prefixes will not have a default"
522                 ewarn "implementation of iexplore.  Many older windows applications"
523                 ewarn "rely upon the existence of an iexplore implementation, so"
524                 ewarn "you will likely need to install an external one, like via winetricks"
525         fi
526         if ! use mono; then
527                 ewarn "Without Wine Mono, wine prefixes will not have a default"
528                 ewarn "implementation of .NET.  Many windows applications rely upon"
529                 ewarn "the existence of a .NET implementation, so you will likely need"
530                 ewarn "to install an external one, like via winetricks"
531         fi
532 }
533
534 pkg_prerm() {
535         eselect wine deregister ${P}
536         if [[ ${PN} == "wine-vanilla" ]]; then
537                 eselect wine deregister --vanilla ${P} || die
538         fi
539
540         eselect wine update --all --if-unset || die
541 }
542
543 pkg_postrm() {
544         xdg_desktop_database_update
545 }