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