media-libs/libsoundio: Merge "version bump to 1.0.2"
[gentoo.git] / app-emulation / wine / wine-1.7.11-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 AUTOTOOLS_AUTORECONF=1
8 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"
9 PLOCALE_BACKUP="en"
10
11 inherit autotools-utils eutils fdo-mime flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx
12
13 if [[ ${PV} == "9999" ]] ; then
14         EGIT_REPO_URI="git://source.winehq.org/git/wine.git http://source.winehq.org/git/wine.git"
15         EGIT_BRANCH="master"
16         inherit git-r3
17         SRC_URI=""
18         #KEYWORDS=""
19 else
20         MY_P="${PN}-${PV/_/-}"
21         SRC_URI="mirror://sourceforge/${PN}/Source/${MY_P}.tar.bz2"
22         KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
23         S=${WORKDIR}/${MY_P}
24 fi
25
26 GV="2.24"
27 MV="4.5.2"
28 PULSE_PATCHES="winepulse-patches-1.7.10"
29 WINE_GENTOO="wine-gentoo-2015.03.07"
30 DESCRIPTION="Free implementation of Windows(tm) on Unix"
31 HOMEPAGE="http://www.winehq.org/"
32 SRC_URI="${SRC_URI}
33         gecko? (
34                 abi_x86_32? ( mirror://sourceforge/${PN}/Wine%20Gecko/${GV}/wine_gecko-${GV}-x86.msi )
35                 abi_x86_64? ( mirror://sourceforge/${PN}/Wine%20Gecko/${GV}/wine_gecko-${GV}-x86_64.msi )
36         )
37         mono? ( mirror://sourceforge/${PN}/Wine%20Mono/${MV}/wine-mono-${MV}.msi )
38         pulseaudio? ( https://dev.gentoo.org/~tetromino/distfiles/${PN}/${PULSE_PATCHES}.tar.bz2 )
39         https://dev.gentoo.org/~tetromino/distfiles/${PN}/${WINE_GENTOO}.tar.bz2"
40
41 LICENSE="LGPL-2.1"
42 SLOT="0"
43 IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl +png +prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype +udisks v4l +X +xcomposite xinerama +xml"
44 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
45         test? ( abi_x86_32 )
46         elibc_glibc? ( threads )
47         mono? ( abi_x86_32 )
48         osmesa? ( opengl )" #286560
49
50 # FIXME: the test suite is unsuitable for us; many tests require net access
51 # or fail due to Xvfb's opengl limitations.
52 RESTRICT="test"
53
54 COMMON_DEPEND="
55         truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
56         capi? ( net-dialup/capi4k-utils )
57         ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
58         udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
59         fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
60         gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
61         openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
62         gstreamer? (
63                 media-libs/gstreamer:0.10[${MULTILIB_USEDEP}]
64                 media-libs/gst-plugins-base:0.10[${MULTILIB_USEDEP}]
65         )
66         X? (
67                 x11-libs/libXcursor[${MULTILIB_USEDEP}]
68                 x11-libs/libXext[${MULTILIB_USEDEP}]
69                 x11-libs/libXrandr[${MULTILIB_USEDEP}]
70                 x11-libs/libXi[${MULTILIB_USEDEP}]
71                 x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
72         )
73         xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
74         alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
75         cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
76         opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
77         opengl? (
78                 virtual/glu[${MULTILIB_USEDEP}]
79                 virtual/opengl[${MULTILIB_USEDEP}]
80         )
81         gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
82         jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
83         ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
84         lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
85         mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
86         netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
87         nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
88         odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
89         osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
90         pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
91         xml? (
92                 dev-libs/libxml2[${MULTILIB_USEDEP}]
93                 dev-libs/libxslt[${MULTILIB_USEDEP}]
94         )
95         scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
96         ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
97         png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
98         v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
99         xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
100         abi_x86_32? (
101                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
102                 !<app-emulation/emul-linux-x86-baselibs-20140508-r14
103                 !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
104                 !<app-emulation/emul-linux-x86-db-20140508-r3
105                 !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
106                 !<app-emulation/emul-linux-x86-medialibs-20140508-r6
107                 !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
108                 !<app-emulation/emul-linux-x86-opengl-20140508-r1
109                 !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
110                 !<app-emulation/emul-linux-x86-sdl-20140508-r1
111                 !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
112                 !<app-emulation/emul-linux-x86-soundlibs-20140508
113                 !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
114                 !<app-emulation/emul-linux-x86-xlibs-20140508
115         )"
116
117 RDEPEND="${COMMON_DEPEND}
118         dos? ( games-emulation/dosbox )
119         perl? ( dev-lang/perl dev-perl/XML-Simple )
120         samba? ( >=net-fs/samba-3.0.25 )
121         selinux? ( sec-policy/selinux-wine )
122         udisks? ( sys-fs/udisks:2 )
123         pulseaudio? ( realtime? ( sys-auth/rtkit ) )"
124
125 DEPEND="${COMMON_DEPEND}
126         X? (
127                 x11-proto/inputproto
128                 x11-proto/xextproto
129                 x11-proto/xf86vidmodeproto
130         )
131         xinerama? ( x11-proto/xineramaproto )
132         prelink? ( sys-devel/prelink )
133         >=sys-kernel/linux-headers-2.6
134         virtual/pkgconfig
135         virtual/yacc
136         sys-devel/flex"
137
138 # These use a non-standard "Wine" category, which is provided by
139 # /etc/xdg/applications-merged/wine.menu
140 QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
141 usr/share/applications/wine-notepad.desktop
142 usr/share/applications/wine-uninstaller.desktop
143 usr/share/applications/wine-winecfg.desktop"
144
145 wine_build_environment_check() {
146         [[ ${MERGE_TYPE} = "binary" ]] && return 0
147
148         # bug #549768
149         if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
150                 einfo "Checking for gcc-5 ms_abi compiler bug ..."
151                 $(tc-getCC) -O2 "${FILESDIR}"/pr66838.c -o "${T}"/pr66838 || die
152                 # Run in subshell to prevent "Aborted" message
153                 if ! ( "${T}"/pr66838 || false ) >/dev/null 2>&1; then
154                         eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
155                         eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
156                         eerror "or use gcc-config to select a different compiler version."
157                         eerror "See https://bugs.gentoo.org/549768"
158                         eerror
159                         return 1
160                 fi
161         fi
162
163         if use abi_x86_64 && [[ $(( $(gcc-major-version) * 100 + $(gcc-minor-version) )) -lt 404 ]]; then
164                 eerror "You need gcc-4.4+ to build 64-bit wine"
165                 eerror
166                 return 1
167         fi
168
169         if use abi_x86_32 && use opencl && [[ x$(eselect opencl show 2> /dev/null) = "xintel" ]]; then
170                 eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
171                 eerror "See https://bugs.gentoo.org/487864 for more details."
172                 eerror
173                 return 1
174         fi
175 }
176
177 pkg_pretend() {
178         wine_build_environment_check || die
179 }
180
181 pkg_setup() {
182         wine_build_environment_check || die
183 }
184
185 src_unpack() {
186         if [[ ${PV} == "9999" ]] ; then
187                 git-r3_src_unpack
188         else
189                 unpack ${MY_P}.tar.bz2
190         fi
191
192         use pulseaudio && unpack "${PULSE_PATCHES}.tar.bz2"
193         unpack "${WINE_GENTOO}.tar.bz2"
194
195         l10n_find_plocales_changes "${S}/po" "" ".po"
196 }
197
198 src_prepare() {
199         local md5="$(md5sum server/protocol.def)"
200         local PATCHES=(
201                 "${FILESDIR}"/${PN}-1.5.26-winegcc.patch #260726
202                 "${FILESDIR}"/${PN}-1.4_rc2-multilib-portage.patch #395615
203                 "${FILESDIR}"/${PN}-1.7.2-osmesa-check.patch #429386
204                 "${FILESDIR}"/${PN}-1.6-memset-O3.patch #480508
205                 "${FILESDIR}"/${PN}-gcc-4.9-null-pointer.patch #543446
206         )
207         use pulseaudio && PATCHES+=(
208                 "../${PULSE_PATCHES}"/*.patch #421365
209         )
210
211         autotools-utils_src_prepare
212
213         # Modification of the server protocol requires regenerating the server requests
214         if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
215                 einfo "server/protocol.def was patched; running tools/make_requests"
216                 tools/make_requests || die #432348
217         fi
218         sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
219         if ! use run-exes; then
220                 sed -i '/^MimeType/d' tools/wine.desktop || die #117785
221         fi
222
223         # hi-res default icon, #472990, http://bugs.winehq.org/show_bug.cgi?id=24652
224         cp "${WORKDIR}"/${WINE_GENTOO}/icons/oic_winlogo.ico dlls/user32/resources/ || die
225
226         l10n_get_locales > po/LINGUAS # otherwise wine doesn't respect LINGUAS
227 }
228
229 src_configure() {
230         export LDCONFIG=/bin/true
231         use custom-cflags || strip-flags
232
233         multilib-minimal_src_configure
234 }
235
236 multilib_src_configure() {
237         local myconf=(
238                 --sysconfdir=/etc/wine
239                 $(use_with alsa)
240                 $(use_with capi)
241                 $(use_with lcms cms)
242                 $(use_with cups)
243                 $(use_with ncurses curses)
244                 $(use_with udisks dbus)
245                 $(use_with fontconfig)
246                 $(use_with ssl gnutls)
247                 $(use_enable gecko mshtml)
248                 $(use_with gphoto2 gphoto)
249                 $(use_with gsm)
250                 $(use_with gstreamer)
251                 --without-hal
252                 $(use_with jpeg)
253                 $(use_with ldap)
254                 $(use_enable mono mscoree)
255                 $(use_with mp3 mpg123)
256                 $(use_with netapi)
257                 $(use_with nls gettext)
258                 $(use_with openal)
259                 $(use_with opencl)
260                 $(use_with opengl)
261                 $(use_with osmesa)
262                 $(use_with oss)
263                 $(use_with png)
264                 $(use_with threads pthread)
265                 $(use_with scanner sane)
266                 $(use_enable test tests)
267                 $(use_with truetype freetype)
268                 $(use_with v4l)
269                 $(use_with X x)
270                 $(use_with xcomposite)
271                 $(use_with xinerama)
272                 $(use_with xml)
273                 $(use_with xml xslt)
274         )
275
276         use pulseaudio && myconf+=( --with-pulse )
277
278         local PKG_CONFIG AR RANLIB
279         # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
280         # set AR and RANLIB to make QA scripts happy; #483342
281         tc-export PKG_CONFIG AR RANLIB
282
283         if use amd64; then
284                 if [[ ${ABI} == amd64 ]]; then
285                         myconf+=( --enable-win64 )
286                 else
287                         myconf+=( --disable-win64 )
288                 fi
289
290                 # Note: using --with-wine64 results in problems with multilib.eclass
291                 # CC/LD hackery. We're using separate tools instead.
292         fi
293
294         ECONF_SOURCE=${S} \
295         econf "${myconf[@]}"
296         emake depend
297 }
298
299 multilib_src_test() {
300         # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
301         if [[ ${ABI} == x86 ]]; then
302                 if [[ $(id -u) == 0 ]]; then
303                         ewarn "Skipping tests since they cannot be run under the root user."
304                         ewarn "To run the test ${PN} suite, add userpriv to FEATURES in make.conf"
305                         return
306                 fi
307
308                 WINEPREFIX="${T}/.wine-${ABI}" \
309                 Xemake test
310         fi
311 }
312
313 multilib_src_install_all() {
314         local DOCS=( ANNOUNCE AUTHORS README )
315         local l
316         add_locale_docs() {
317                 local locale_doc="documentation/README.$1"
318                 [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
319         }
320         l10n_for_each_locale_do add_locale_docs
321
322         einstalldocs
323         prune_libtool_files --all
324
325         emake -C "../${WINE_GENTOO}" install DESTDIR="${D}" EPREFIX="${EPREFIX}"
326         if use gecko ; then
327                 insinto /usr/share/wine/gecko
328                 use abi_x86_32 && doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi
329                 use abi_x86_64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi
330         fi
331         if use mono ; then
332                 insinto /usr/share/wine/mono
333                 doins "${DISTDIR}"/wine-mono-${MV}.msi
334         fi
335         if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
336                 rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die
337         fi
338
339         use abi_x86_32 && pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055
340         use abi_x86_64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader}
341
342         if use abi_x86_64 && ! use abi_x86_32; then
343                 dosym /usr/bin/wine{64,} # 404331
344                 dosym /usr/bin/wine{64,}-preloader
345         fi
346
347         # respect LINGUAS when installing man pages, #469418
348         for l in de fr pl; do
349                 use linguas_${l} || rm -r "${D}"usr/share/man/${l}*
350         done
351 }
352
353 pkg_preinst() {
354         gnome2_icon_savelist
355 }
356
357 pkg_postinst() {
358         gnome2_icon_cache_update
359         fdo-mime_desktop_database_update
360
361         if ! use gecko; then
362                 ewarn "Without Wine Gecko, wine prefixes will not have a default"
363                 ewarn "implementation of iexplore.  Many older windows applications"
364                 ewarn "rely upon the existence of an iexplore implementation, so"
365                 ewarn "you will likely need to install an external one, like via winetricks"
366         fi
367         if ! use mono; then
368                 ewarn "Without Wine Mono, wine prefixes will not have a default"
369                 ewarn "implementation of .NET.  Many windows applications rely upon"
370                 ewarn "the existence of a .NET implementation, so you will likely need"
371                 ewarn "to install an external one, like via winetricks"
372         fi
373 }
374
375 pkg_postrm() {
376         gnome2_icon_cache_update
377         fdo-mime_desktop_database_update
378 }