nvidia-driver.eclass: Use next gen version of readme.gentoo eclass
[gentoo.git] / eclass / mozconfig-v6.44.eclass
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4 #
5 # @ECLASS: mozconfig-v6.44.eclass
6 # @MAINTAINER:
7 # mozilla team <mozilla@gentoo.org>
8 # @BLURB: the new mozilla common configuration eclass for FF33 and newer, v6
9 # @DESCRIPTION:
10 # This eclass is used in mozilla ebuilds (firefox, thunderbird, seamonkey)
11 # to provide a single common place for the common mozilla engine compoments.
12 #
13 # The eclass provides all common dependencies as well as common use flags.
14 #
15 # Some use flags which may be optional in particular mozilla packages can be
16 # supported through setting eclass variables.
17 #
18 # This eclass inherits mozconfig helper functions as defined in mozcoreconf-v3,
19 # and so ebuilds inheriting this eclass do not need to inherit that.
20
21 inherit multilib flag-o-matic toolchain-funcs mozcoreconf-v3
22
23 case ${EAPI} in
24         0|1|2|3|4) die "EAPI=${EAPI} not supported"
25 esac
26
27 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
28 # @DESCRIPTION:
29 # Set this variable before the inherit line, when an ebuild needs to provide
30 # optional necko-wifi support via IUSE="wifi".  Currently this would include
31 # ebuilds for firefox, and potentially seamonkey.
32 #
33 # Leave the variable UNSET if necko-wifi support should not be available.
34 # Set the variable to "enabled" if the use flag should be enabled by default.
35 # Set the variable to any value if the use flag should exist but not be default-enabled.
36
37 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_JIT
38 # @DESCRIPTION:
39 # Set this variable before the inherit line, when an ebuild needs to provide
40 # optional necko-wifi support via IUSE="jit".  Currently this would include
41 # ebuilds for firefox, and potentially seamonkey.
42 #
43 # Leave the variable UNSET if optional jit support should not be available.
44 # Set the variable to "enabled" if the use flag should be enabled by default.
45 # Set the variable to any value if the use flag should exist but not be default-enabled.
46
47 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK3
48 # @DESCRIPTION:
49 # Set this variable before the inherit line, when an ebuild can provide
50 # optional gtk3 support via IUSE="gtk3".  Currently this would include
51 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
52 #
53 # Leave the variable UNSET if gtk3 support should not be available.
54 # Set the variable to "enabled" if the use flag should be enabled by default.
55 # Set the variable to any value if the use flag should exist but not be default-enabled.
56
57 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
58 # @DESCRIPTION:
59 # Set this variable before the inherit line, when an ebuild can provide
60 # optional qt5 support via IUSE="qt5".  Currently this would include
61 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
62 #
63 # Leave the variable UNSET if qt5 support should not be available.
64 # Set the variable to "enabled" if the use flag should be enabled by default.
65 # Set the variable to any value if the use flag should exist but not be default-enabled.
66
67 # use-flags common among all mozilla ebuilds
68 IUSE="${IUSE} dbus debug ffmpeg +gstreamer gstreamer-0 +jemalloc3 neon pulseaudio selinux startup-notification system-cairo
69         system-icu system-jpeg system-libevent system-sqlite system-libvpx"
70
71 # some notes on deps:
72 # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
73 # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
74
75 RDEPEND=">=app-text/hunspell-1.2
76         dev-libs/atk
77         dev-libs/expat
78         >=dev-libs/libevent-1.4.7
79         >=x11-libs/cairo-1.10[X]
80         >=x11-libs/gtk+-2.18:2
81         x11-libs/gdk-pixbuf
82         >=x11-libs/pango-1.22.0
83         >=media-libs/libpng-1.6.17:0=[apng]
84         >=media-libs/mesa-10.2:*
85         media-libs/fontconfig
86         >=media-libs/freetype-2.4.10
87         kernel_linux? ( media-libs/alsa-lib )
88         pulseaudio? ( media-sound/pulseaudio )
89         virtual/freedesktop-icon-theme
90         dbus? ( >=sys-apps/dbus-0.60
91                 >=dev-libs/dbus-glib-0.72 )
92         startup-notification? ( >=x11-libs/startup-notification-0.8 )
93         >=dev-libs/glib-2.26:2
94         >=sys-libs/zlib-1.2.3
95         >=virtual/libffi-3.0.10
96         ffmpeg? ( virtual/ffmpeg )
97         gstreamer? (
98                 >=media-libs/gstreamer-1.4.5:1.0
99                 >=media-libs/gst-plugins-base-1.4.5:1.0
100                 >=media-libs/gst-plugins-good-1.4.5:1.0
101                 >=media-plugins/gst-plugins-libav-1.4.5:1.0
102         )
103         gstreamer-0? (
104                 >=media-libs/gstreamer-0.10.25:0.10
105                 media-plugins/gst-plugins-meta:0.10[ffmpeg]
106         )
107         x11-libs/libX11
108         x11-libs/libXcomposite
109         x11-libs/libXdamage
110         x11-libs/libXext
111         x11-libs/libXfixes
112         x11-libs/libXrender
113         x11-libs/libXt
114         system-cairo? ( >=x11-libs/cairo-1.12[X,xcb] >=x11-libs/pixman-0.19.2 )
115         system-icu? ( >=dev-libs/icu-51.1:= )
116         system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
117         system-libevent? ( =dev-libs/libevent-2.0* )
118         system-sqlite? ( >=dev-db/sqlite-3.9.1:3[secure-delete,debug=] )
119         system-libvpx? ( >=media-libs/libvpx-1.3.0:0=[postproc] )
120 "
121
122 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
123         if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
124                 IUSE+=" +gtk3"
125         else
126                 IUSE+=" gtk3"
127         fi
128         RDEPEND+="
129         gtk3? ( >=x11-libs/gtk+-3.4.0:3 )"
130 fi
131 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
132         inherit qmake-utils
133         if [[ ${MOZCONFIG_OPTIONAL_QT5} = "enabled" ]]; then
134                 IUSE+=" +qt5"
135         else
136                 IUSE+=" qt5"
137         fi
138         RDEPEND+="
139         qt5? (
140                 dev-qt/qtcore:5
141                 dev-qt/qtgui:5
142                 dev-qt/qtnetwork:5
143                 dev-qt/qtprintsupport:5
144                 dev-qt/qtwidgets:5
145                 dev-qt/qtxml:5
146                 dev-qt/qtdeclarative:5
147         )"
148 fi
149 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
150         if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
151                 IUSE+=" +wifi"
152         else
153                 IUSE+=" wifi"
154         fi
155         RDEPEND+="
156         wifi? (
157                 kernel_linux? ( >=sys-apps/dbus-0.60
158                         >=dev-libs/dbus-glib-0.72
159                         net-misc/networkmanager )
160         )"
161 fi
162 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
163         if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
164                 IUSE+=" +jit"
165         else
166                 IUSE+=" jit"
167         fi
168 fi
169
170 DEPEND="app-arch/zip
171         app-arch/unzip
172         >=sys-devel/binutils-2.16.1
173         ${RDEPEND}"
174
175 RDEPEND+="
176         selinux? ( sec-policy/selinux-mozilla )"
177
178 # only one of gstreamer and gstreamer-0 can be enabled at a time, so set REQUIRED_USE to signify this
179 REQUIRED_USE="?? ( gstreamer gstreamer-0 )"
180
181 # only one of gtk3 or qt5 should be permitted to be selected, since only one will be used.
182 [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
183         REQUIRED_USE+=" ?? ( gtk3 qt5 )"
184
185 # @FUNCTION: mozconfig_config
186 # @DESCRIPTION:
187 # Set common configure options for mozilla packages.
188 # Call this within src_configure() phase, after mozconfig_init
189 #
190 # Example:
191 #
192 # inherit mozconfig-v5.33
193 #
194 # src_configure() {
195 #       mozconfig_init
196 #       mozconfig_config
197 #       # ... misc ebuild-unique settings via calls to
198 #       # ... mozconfig_{annotate,use_with,use_enable}
199 #       mozconfig_final
200 # }
201
202 mozconfig_config() {
203         # Migrated from mozcoreconf-2
204         mozconfig_annotate 'system_libs' \
205                 --with-system-zlib \
206                 --enable-pango \
207                 --enable-svg \
208                 --with-system-bz2
209
210         if has bindist ${IUSE}; then
211                 mozconfig_use_enable !bindist official-branding
212                 if [[ ${PN} == firefox ]] && use bindist ; then
213                         mozconfig_annotate '' --with-branding=browser/branding/aurora
214                 fi
215         fi
216
217         mozconfig_use_enable debug
218         mozconfig_use_enable debug tests
219
220         if ! use debug ; then
221                 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
222         else
223                 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
224         fi
225
226         mozconfig_use_enable startup-notification
227
228         if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
229                 # wifi pulls in dbus so manage both here
230                 mozconfig_use_enable wifi necko-wifi
231                 if use kernel_linux && use wifi && ! use dbus; then
232                         echo "Enabling dbus support due to wifi request"
233                         mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
234                 else
235                         mozconfig_use_enable dbus
236                 fi
237         else
238                 mozconfig_use_enable dbus
239                 mozconfig_annotate 'disabled' --disable-necko-wifi
240         fi
241
242         # These are forced-on for webm support
243         mozconfig_annotate 'required' --enable-ogg
244         mozconfig_annotate 'required' --enable-wave
245
246         if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
247                 mozconfig_use_enable jit ion
248         fi
249
250         # These are enabled by default in all mozilla applications
251         mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
252         mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
253         mozconfig_annotate '' --x-includes="${EPREFIX}"/usr/include --x-libraries="${EPREFIX}"/usr/$(get_libdir)
254         if use system-libevent; then
255                 mozconfig_annotate '' --with-system-libevent="${EPREFIX}"/usr
256         fi
257         mozconfig_annotate '' --prefix="${EPREFIX}"/usr
258         mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
259         mozconfig_annotate 'Gentoo default' --enable-system-hunspell
260         mozconfig_annotate '' --disable-gnomeui
261         mozconfig_annotate '' --enable-gio
262         mozconfig_annotate '' --disable-crashreporter
263         mozconfig_annotate 'Gentoo default' --with-system-png
264         mozconfig_annotate '' --enable-system-ffi
265         mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
266         mozconfig_annotate 'Gentoo default' --disable-skia
267         mozconfig_annotate '' --disable-gconf
268         mozconfig_annotate '' --with-intl-api
269
270         # default toolkit is cairo-gtk2, optional use flags can change this
271         local toolkit="cairo-gtk2"
272         local toolkit_comment=""
273         if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
274                 if use gtk3; then
275                         toolkit="cairo-gtk3"
276                         toolkit_comment="gtk3 use flag"
277                 fi
278         fi
279         if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
280                 if use qt5; then
281                         toolkit="cairo-qt"
282                         toolkit_comment="qt5 use flag"
283                         # need to specify these vars because the qt5 versions are not found otherwise,
284                         # and setting --with-qtdir overrides the pkg-config include dirs
285                         local i
286                         for i in qmake moc rcc; do
287                                 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
288                                         >> "${S}"/.mozconfig || die
289                         done
290                         echo 'unset QTDIR' >> "${S}"/.mozconfig || die
291                         mozconfig_annotate '+qt5' --disable-gio
292                 fi
293         fi
294         mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
295
296         # Use jemalloc unless libc is not glibc >= 2.4
297         # at this time the minimum glibc in the tree is 2.9 so we should be safe.
298         if use elibc_glibc && use jemalloc3; then
299                 # We must force-enable jemalloc 3 via .mozconfig
300                 echo "export MOZ_JEMALLOC3=1" >> "${S}"/.mozconfig || die
301                 mozconfig_annotate '' --enable-jemalloc
302                 mozconfig_annotate '' --enable-replace-malloc
303         fi
304
305         mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
306         mozconfig_annotate '' --build="${CTARGET:-${CHOST}}"
307
308         use ffmpeg || mozconfig_annotate '-ffmpeg' --disable-ffmpeg
309         if use gstreamer ; then
310                 use ffmpeg && einfo "${PN} will not use ffmpeg unless gstreamer:1.0 is not available at runtime"
311                 mozconfig_annotate '+gstreamer' --enable-gstreamer=1.0
312         elif use gstreamer-0 ; then
313                 use ffmpeg && einfo "${PN} will not use ffmpeg unless gstreamer:0.10 is not available at runtime"
314                 mozconfig_annotate '+gstreamer-0' --enable-gstreamer=0.10
315         else
316                 mozconfig_annotate '' --disable-gstreamer
317         fi
318         mozconfig_use_enable pulseaudio
319
320         mozconfig_use_enable system-cairo
321         mozconfig_use_enable system-sqlite
322         mozconfig_use_with system-jpeg
323         mozconfig_use_with system-icu
324         mozconfig_use_with system-libvpx
325
326         # Modifications to better support ARM, bug 553364
327         if use neon ; then
328                 mozconfig_annotate '' --with-fpu=neon
329                 mozconfig_annotate '' --with-thumb=yes
330                 mozconfig_annotate '' --with-thumb-interwork=no
331         fi
332         if [[ ${CHOST} == armv* ]] ; then
333                 mozconfig_annotate '' --with-float-abi=hard
334                 mozconfig_annotate '' --enable-skia
335
336                 if ! use system-libvpx ; then
337                         sed -i -e "s|softfp|hard|" \
338                                 "${S}"/media/libvpx/moz.build
339                 fi
340         fi
341 }