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