1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: mozconfig-v6.45.eclass
7 # mozilla team <mozilla@gentoo.org>
8 # @BLURB: the new mozilla common configuration eclass for FF33 and newer, v6
10 # This eclass is used in mozilla ebuilds (firefox, thunderbird, seamonkey)
11 # to provide a single common place for the common mozilla engine compoments.
13 # The eclass provides all common dependencies as well as common use flags.
15 # Some use flags which may be optional in particular mozilla packages can be
16 # supported through setting eclass variables.
18 # This eclass inherits mozconfig helper functions as defined in mozcoreconf-v4,
19 # and so ebuilds inheriting this eclass do not need to inherit that.
23 die "EAPI=${EAPI} not supported"
30 inherit flag-o-matic toolchain-funcs mozcoreconf-v4
32 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
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.
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.
42 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_JIT
44 # Set this variable before the inherit line, when an ebuild needs to provide
45 # optional necko-wifi support via IUSE="jit". Currently this would include
46 # ebuilds for firefox, and potentially seamonkey.
48 # Leave the variable UNSET if optional jit support should not be available.
49 # Set the variable to "enabled" if the use flag should be enabled by default.
50 # Set the variable to any value if the use flag should exist but not be default-enabled.
52 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK3
54 # Set this variable before the inherit line, when an ebuild can provide
55 # optional gtk3 support via IUSE="gtk3". Currently this would include
56 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
58 # Leave the variable UNSET if gtk3 support should not be available.
59 # Set the variable to "enabled" if the use flag should be enabled by default.
60 # Set the variable to any value if the use flag should exist but not be default-enabled.
62 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
64 # Set this variable before the inherit line, when an ebuild can provide
65 # optional qt5 support via IUSE="qt5". Currently this would include
66 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
68 # Leave the variable UNSET if qt5 support should not be available.
69 # Set the variable to "enabled" if the use flag should be enabled by default.
70 # Set the variable to any value if the use flag should exist but not be default-enabled.
72 # use-flags common among all mozilla ebuilds
73 IUSE="${IUSE} dbus debug ffmpeg +gstreamer gstreamer-0 +jemalloc3 neon pulseaudio selinux startup-notification system-cairo
74 system-harfbuzz system-icu system-jpeg system-libevent system-sqlite system-libvpx"
77 # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
78 # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
80 RDEPEND=">=app-text/hunspell-1.2:=
83 >=x11-libs/cairo-1.10[X]
84 >=x11-libs/gtk+-2.18:2
86 >=x11-libs/pango-1.22.0
87 >=media-libs/libpng-1.6.19:0=[apng]
88 >=media-libs/mesa-10.2:*
90 >=media-libs/freetype-2.4.10
91 kernel_linux? ( media-libs/alsa-lib )
92 pulseaudio? ( media-sound/pulseaudio )
93 virtual/freedesktop-icon-theme
94 dbus? ( >=sys-apps/dbus-0.60
95 >=dev-libs/dbus-glib-0.72 )
96 startup-notification? ( >=x11-libs/startup-notification-0.8 )
97 >=dev-libs/glib-2.26:2
99 >=virtual/libffi-3.0.10
100 ffmpeg? ( virtual/ffmpeg )
102 >=media-libs/gstreamer-1.4.5:1.0
103 >=media-libs/gst-plugins-base-1.4.5:1.0
104 >=media-libs/gst-plugins-good-1.4.5:1.0
105 >=media-plugins/gst-plugins-libav-1.4.5:1.0
108 >=media-libs/gstreamer-0.10.25:0.10
109 media-plugins/gst-plugins-meta:0.10[ffmpeg]
112 x11-libs/libXcomposite
118 system-cairo? ( >=x11-libs/cairo-1.12[X,xcb] >=x11-libs/pixman-0.19.2 )
119 system-icu? ( >=dev-libs/icu-51.1:= )
120 system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
121 system-libevent? ( =dev-libs/libevent-2.0*:0= )
122 system-sqlite? ( >=dev-db/sqlite-3.9.1:3[secure-delete,debug=] )
123 system-harfbuzz? ( >=media-libs/harfbuzz-1.1.3:0=[graphite,icu] >=media-gfx/graphite2-1.3.8 )
126 if [[ ${PV/45.0*/} == "" ]]; then
128 system-libvpx? ( >=media-libs/libvpx-1.3.0:0=[postproc] )"
130 # 45.1.0 and above bumped the libvpx requirement
132 system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )"
135 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
136 if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
142 gtk3? ( >=x11-libs/gtk+-3.4.0:3 )"
144 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
146 if [[ ${MOZCONFIG_OPTIONAL_QT5} = "enabled" ]]; then
156 dev-qt/qtprintsupport:5
159 dev-qt/qtdeclarative:5
162 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
163 if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
170 kernel_linux? ( >=sys-apps/dbus-0.60
171 >=dev-libs/dbus-glib-0.72
172 net-misc/networkmanager )
175 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
176 if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
185 >=sys-devel/binutils-2.16.1
189 selinux? ( sec-policy/selinux-mozilla )"
191 # only one of gstreamer and gstreamer-0 can be enabled at a time, so set REQUIRED_USE to signify this.
192 # also force system-icu if system-harfbuzz is set to avoid any potential ABI issues
194 ?? ( gstreamer gstreamer-0 )
195 system-harfbuzz? ( system-icu )"
197 # only one of gtk3 or qt5 should be permitted to be selected, since only one will be used.
198 [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
199 REQUIRED_USE+=" ?? ( gtk3 qt5 )"
201 # @FUNCTION: mozconfig_config
203 # Set common configure options for mozilla packages.
204 # Call this within src_configure() phase, after mozconfig_init
208 # inherit mozconfig-v5.33
213 # # ... misc ebuild-unique settings via calls to
214 # # ... mozconfig_{annotate,use_with,use_enable}
219 # Migrated from mozcoreconf-v3
220 mozconfig_annotate 'more disable_update_strip' \
222 --disable-installer \
225 if [[ ${PN} != seamonkey ]]; then
226 mozconfig_annotate 'basic_profile' \
227 --disable-profilelocking \
228 --enable-single-profile \
229 --disable-profilesharing
232 # Migrated from mozcoreconf-2
233 mozconfig_annotate 'system_libs' \
239 if has bindist ${IUSE}; then
240 mozconfig_use_enable !bindist official-branding
241 if [[ ${PN} == firefox ]] && use bindist ; then
242 mozconfig_annotate '' --with-branding=browser/branding/aurora
246 mozconfig_use_enable debug
247 mozconfig_use_enable debug tests
249 if ! use debug ; then
250 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
252 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
255 mozconfig_use_enable startup-notification
257 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
258 # wifi pulls in dbus so manage both here
259 mozconfig_use_enable wifi necko-wifi
260 if use kernel_linux && use wifi && ! use dbus; then
261 echo "Enabling dbus support due to wifi request"
262 mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
264 mozconfig_use_enable dbus
267 mozconfig_use_enable dbus
268 mozconfig_annotate 'disabled' --disable-necko-wifi
271 # These are forced-on for webm support
272 mozconfig_annotate 'required' --enable-ogg
273 mozconfig_annotate 'required' --enable-wave
275 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
276 mozconfig_use_enable jit ion
279 # These are enabled by default in all mozilla applications
280 mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
281 mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
282 mozconfig_annotate '' --x-includes="${EPREFIX}"/usr/include --x-libraries="${EPREFIX}"/usr/$(get_libdir)
283 if use system-libevent; then
284 mozconfig_annotate '' --with-system-libevent="${EPREFIX}"/usr
286 mozconfig_annotate '' --prefix="${EPREFIX}"/usr
287 mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
288 mozconfig_annotate 'Gentoo default' --enable-system-hunspell
289 mozconfig_annotate '' --disable-gnomeui
290 mozconfig_annotate '' --enable-gio
291 mozconfig_annotate '' --disable-crashreporter
292 mozconfig_annotate 'Gentoo default' --with-system-png
293 mozconfig_annotate '' --enable-system-ffi
294 mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
295 mozconfig_annotate 'Gentoo default' --disable-skia
296 mozconfig_annotate '' --disable-gconf
297 mozconfig_annotate '' --with-intl-api
299 # default toolkit is cairo-gtk2, optional use flags can change this
300 local toolkit="cairo-gtk2"
301 local toolkit_comment=""
302 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
305 toolkit_comment="gtk3 use flag"
308 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
311 toolkit_comment="qt5 use flag"
312 # need to specify these vars because the qt5 versions are not found otherwise,
313 # and setting --with-qtdir overrides the pkg-config include dirs
315 for i in qmake moc rcc; do
316 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
317 >> "${S}"/.mozconfig || die
319 echo 'unset QTDIR' >> "${S}"/.mozconfig || die
320 mozconfig_annotate '+qt5' --disable-gio
323 mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
325 # Use jemalloc unless libc is not glibc >= 2.4
326 # at this time the minimum glibc in the tree is 2.9 so we should be safe.
327 if use elibc_glibc && use jemalloc3; then
328 # We must force-enable jemalloc 3 via .mozconfig
329 echo "export MOZ_JEMALLOC3=1" >> "${S}"/.mozconfig || die
330 mozconfig_annotate '' --enable-jemalloc
331 mozconfig_annotate '' --enable-replace-malloc
334 mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
335 mozconfig_annotate '' --build="${CTARGET:-${CHOST}}"
337 use ffmpeg || mozconfig_annotate '-ffmpeg' --disable-ffmpeg
338 if use gstreamer ; then
339 use ffmpeg && einfo "${PN} will not use ffmpeg unless gstreamer:1.0 is not available at runtime"
340 mozconfig_annotate '+gstreamer' --enable-gstreamer=1.0
341 elif use gstreamer-0 ; then
342 use ffmpeg && einfo "${PN} will not use ffmpeg unless gstreamer:0.10 is not available at runtime"
343 mozconfig_annotate '+gstreamer-0' --enable-gstreamer=0.10
345 mozconfig_annotate '' --disable-gstreamer
347 mozconfig_use_enable pulseaudio
349 mozconfig_use_enable system-cairo
350 mozconfig_use_enable system-sqlite
351 mozconfig_use_with system-jpeg
352 mozconfig_use_with system-icu
353 mozconfig_use_with system-libvpx
354 mozconfig_use_with system-harfbuzz
355 mozconfig_use_with system-harfbuzz system-graphite2
357 # Modifications to better support ARM, bug 553364
359 mozconfig_annotate '' --with-fpu=neon
360 mozconfig_annotate '' --with-thumb=yes
361 mozconfig_annotate '' --with-thumb-interwork=no
363 if [[ ${CHOST} == armv* ]] ; then
364 mozconfig_annotate '' --with-float-abi=hard
365 mozconfig_annotate '' --enable-skia
367 if ! use system-libvpx ; then
368 sed -i -e "s|softfp|hard|" \
369 "${S}"/media/libvpx/moz.build
374 # @FUNCTION: mozconfig_install_prefs
376 # Set preferences into the prefs.js file specified as a parameter to
377 # the function. This sets both some common prefs to all mozilla
378 # packages, and any prefs that may relate to the use flags administered
379 # by mozconfig_config().
381 # Call this within src_install() phase, after copying the template
382 # prefs file (if any) from ${FILESDIR}
386 # inherit mozconfig-v6.46
389 # cp "${FILESDIR}"/gentoo-default-prefs.js \
390 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
393 # mozconfig_install_prefs \
394 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
399 mozconfig_install_prefs() {
400 local prefs_file="${1}"
402 einfo "Adding prefs from mozconfig to ${prefs_file}"
404 # set dictionary path, to use system hunspell
405 echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
406 >>"${prefs_file}" || die
408 # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
409 if use system-harfbuzz ; then
410 echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
411 >>"${prefs_file}" || die