1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: mozconfig-v6.45.eclass
6 # mozilla team <mozilla@gentoo.org>
7 # @BLURB: the new mozilla common configuration eclass for FF33 and newer, v6
9 # This eclass is used in mozilla ebuilds (firefox, thunderbird, seamonkey)
10 # to provide a single common place for the common mozilla engine compoments.
12 # The eclass provides all common dependencies as well as common use flags.
14 # Some use flags which may be optional in particular mozilla packages can be
15 # supported through setting eclass variables.
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.
22 die "EAPI=${EAPI} not supported"
29 inherit flag-o-matic toolchain-funcs mozcoreconf-v4
31 # @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
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.
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.
53 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK3
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.
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.
64 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
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.
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.
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"
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
84 RDEPEND=">=app-text/hunspell-1.2:=
87 >=x11-libs/cairo-1.10[X]
88 >=x11-libs/gtk+-2.18:2
90 >=x11-libs/pango-1.22.0
91 >=media-libs/libpng-1.6.19:0=[apng]
92 >=media-libs/mesa-10.2:*
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 )
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
113 x11-libs/libXcomposite
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 )
127 if [[ ${PV/45.0*/} == "" ]]; then
129 system-libvpx? ( >=media-libs/libvpx-1.3.0:0=[postproc] )"
131 # 45.1.0 and above bumped the libvpx requirement
133 system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )"
136 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
137 if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
143 gtk3? ( >=x11-libs/gtk+-3.4.0:3 )"
145 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
147 if [[ ${MOZCONFIG_OPTIONAL_QT5} = "enabled" ]]; then
157 dev-qt/qtprintsupport:5
160 dev-qt/qtdeclarative:5
163 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
164 if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
171 kernel_linux? ( >=sys-apps/dbus-0.60
172 >=dev-libs/dbus-glib-0.72
173 net-misc/networkmanager )
176 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
177 if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
186 >=sys-devel/binutils-2.16.1
190 selinux? ( sec-policy/selinux-mozilla )"
192 # force system-icu if system-harfbuzz is set to avoid any potential ABI issues
194 system-harfbuzz? ( system-icu )"
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 )"
200 # @FUNCTION: mozconfig_config
202 # Set common configure options for mozilla packages.
203 # Call this within src_configure() phase, after mozconfig_init
207 # inherit mozconfig-v5.33
212 # # ... misc ebuild-unique settings via calls to
213 # # ... mozconfig_{annotate,use_with,use_enable}
218 # Migrated from mozcoreconf-v3
219 mozconfig_annotate 'more disable_update_strip' \
221 --disable-installer \
224 if [[ ${PN} != seamonkey ]]; then
225 mozconfig_annotate 'basic_profile' \
226 --disable-profilelocking \
227 --enable-single-profile \
228 --disable-profilesharing
231 # Migrated from mozcoreconf-2
232 mozconfig_annotate 'system_libs' \
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
245 mozconfig_use_enable debug
246 mozconfig_use_enable debug tests
248 if ! use debug ; then
249 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
251 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
254 mozconfig_use_enable startup-notification
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
263 mozconfig_use_enable dbus
266 mozconfig_use_enable dbus
267 mozconfig_annotate 'disabled' --disable-necko-wifi
270 # These are forced-on for webm support
271 mozconfig_annotate 'required' --enable-ogg
272 mozconfig_annotate 'required' --enable-wave
274 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
275 mozconfig_use_enable jit ion
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
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
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
304 toolkit_comment="gtk3 use flag"
307 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
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
314 for i in qmake moc rcc; do
315 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
316 >> "${S}"/.mozconfig || die
318 echo 'unset QTDIR' >> "${S}"/.mozconfig || die
319 mozconfig_annotate '+qt5' --disable-gio
322 mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
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
333 mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
334 mozconfig_annotate '' --build="${CTARGET:-${CHOST}}"
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
341 mozconfig_annotate '' --disable-gstreamer
343 mozconfig_use_enable pulseaudio
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
353 # Modifications to better support ARM, bug 553364
355 mozconfig_annotate '' --with-fpu=neon
356 mozconfig_annotate '' --with-thumb=yes
357 mozconfig_annotate '' --with-thumb-interwork=no
359 if [[ ${CHOST} == armv* ]] ; then
360 mozconfig_annotate '' --with-float-abi=hard
361 mozconfig_annotate '' --enable-skia
363 if ! use system-libvpx ; then
364 sed -i -e "s|softfp|hard|" \
365 "${S}"/media/libvpx/moz.build
370 # @FUNCTION: mozconfig_install_prefs
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().
377 # Call this within src_install() phase, after copying the template
378 # prefs file (if any) from ${FILESDIR}
382 # inherit mozconfig-v6.46
385 # cp "${FILESDIR}"/gentoo-default-prefs.js \
386 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
389 # mozconfig_install_prefs \
390 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
395 mozconfig_install_prefs() {
396 local prefs_file="${1}"
398 einfo "Adding prefs from mozconfig to ${prefs_file}"
400 # set dictionary path, to use system hunspell
401 echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
402 >>"${prefs_file}" || die
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