1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: mozconfig-v6.46.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-v3,
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_GTK2ONLY
64 # Set this variable before the inherit line, when an ebuild can provide
65 # optional gtk2-only support via IUSE="gtk2".
67 # Note that this option conflicts directly with MOZCONFIG_OPTIONAL_GTK3, both
68 # variables cannot be set at the same time and this variable will be ignored if
69 # MOZCONFIG_OPTIONAL_GTK3 is set.
71 # Leave the variable UNSET if gtk2-only 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 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
77 # Set this variable before the inherit line, when an ebuild can provide
78 # optional qt5 support via IUSE="qt5". Currently this would include
79 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
81 # Leave the variable UNSET if qt5 support should not be available.
82 # Set the variable to "enabled" if the use flag should be enabled by default.
83 # Set the variable to any value if the use flag should exist but not be default-enabled.
85 # use-flags common among all mozilla ebuilds
86 IUSE="${IUSE} dbus debug +jemalloc3 neon pulseaudio selinux +skia startup-notification system-cairo
87 system-harfbuzz system-icu system-jpeg system-libevent system-sqlite system-libvpx"
90 # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
91 # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
93 RDEPEND=">=app-text/hunspell-1.2
96 >=x11-libs/cairo-1.10[X]
97 >=x11-libs/gtk+-2.18:2
99 >=x11-libs/pango-1.22.0
100 >=media-libs/libpng-1.6.21:0=[apng]
101 >=media-libs/mesa-10.2:*
102 media-libs/fontconfig
103 >=media-libs/freetype-2.4.10
104 kernel_linux? ( media-libs/alsa-lib )
105 pulseaudio? ( media-sound/pulseaudio )
106 virtual/freedesktop-icon-theme
107 dbus? ( >=sys-apps/dbus-0.60
108 >=dev-libs/dbus-glib-0.72 )
109 startup-notification? ( >=x11-libs/startup-notification-0.8 )
110 >=dev-libs/glib-2.26:2
111 >=sys-libs/zlib-1.2.3
112 >=virtual/libffi-3.0.10
115 x11-libs/libXcomposite
121 system-cairo? ( >=x11-libs/cairo-1.12[X,xcb] >=x11-libs/pixman-0.19.2 )
122 system-icu? ( >=dev-libs/icu-51.1:= )
123 system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
124 system-libevent? ( =dev-libs/libevent-2.0*:0= )
125 system-sqlite? ( >=dev-db/sqlite-3.12.2:3[secure-delete,debug=] )
126 system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
127 system-harfbuzz? ( >=media-libs/harfbuzz-1.2.6:0=[graphite,icu] >=media-gfx/graphite2-1.3.8 )
130 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
131 MOZCONFIG_OPTIONAL_GTK2ONLY=
132 if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
138 gtk3? ( >=x11-libs/gtk+-3.4.0:3 )"
139 elif [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
140 if [[ ${MOZCONFIG_OPTIONAL_GTK2ONLY} = "enabled" ]]; then
146 !gtk2? ( >=x11-libs/gtk+-3.4.0:3 )"
148 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
150 if [[ ${MOZCONFIG_OPTIONAL_QT5} = "enabled" ]]; then
160 dev-qt/qtprintsupport:5
163 dev-qt/qtdeclarative:5
166 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
167 if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
174 kernel_linux? ( >=sys-apps/dbus-0.60
175 >=dev-libs/dbus-glib-0.72
176 net-misc/networkmanager )
179 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
180 if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
189 >=sys-devel/binutils-2.16.1
194 selinux? ( sec-policy/selinux-mozilla )"
196 # force system-icu if system-harfbuzz is selected, to avoid potential ABI issues
198 system-harfbuzz? ( system-icu )"
200 # only one of gtk3 or qt5 should be permitted to be selected, since only one will be used.
201 [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
202 REQUIRED_USE+=" ?? ( gtk3 qt5 )"
204 # only one of gtk2 or qt5 should be permitted to be selected, since only one will be used.
205 [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
206 REQUIRED_USE+=" ?? ( gtk2 qt5 )"
208 # @FUNCTION: mozconfig_config
210 # Set common configure options for mozilla packages.
211 # Call this within src_configure() phase, after mozconfig_init
215 # inherit mozconfig-v6.46
220 # # ... misc ebuild-unique settings via calls to
221 # # ... mozconfig_{annotate,use_with,use_enable}
226 # Migrated from mozcoreconf-2
227 mozconfig_annotate 'system_libs' \
231 if has bindist ${IUSE}; then
232 mozconfig_use_enable !bindist official-branding
233 if [[ ${PN} == firefox ]] && use bindist ; then
234 mozconfig_annotate '' --with-branding=browser/branding/aurora
238 mozconfig_use_enable debug
239 mozconfig_use_enable debug tests
241 if ! use debug ; then
242 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
244 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
247 mozconfig_use_enable startup-notification
249 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
250 # wifi pulls in dbus so manage both here
251 mozconfig_use_enable wifi necko-wifi
252 if use kernel_linux && use wifi && ! use dbus; then
253 echo "Enabling dbus support due to wifi request"
254 mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
256 mozconfig_use_enable dbus
259 mozconfig_use_enable dbus
260 mozconfig_annotate 'disabled' --disable-necko-wifi
263 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
264 mozconfig_use_enable jit ion
267 # These are enabled by default in all mozilla applications
268 mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${SYSROOT}${EPREFIX}"/usr
269 mozconfig_annotate '' --with-system-nss --with-nss-prefix="${SYSROOT}${EPREFIX}"/usr
270 mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
271 if use system-libevent; then
272 mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
274 mozconfig_annotate '' --prefix="${EPREFIX}"/usr
275 mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
276 mozconfig_annotate 'Gentoo default' --enable-system-hunspell
277 mozconfig_annotate '' --disable-gnomeui
278 mozconfig_annotate '' --enable-gio
279 mozconfig_annotate '' --disable-crashreporter
280 mozconfig_annotate 'Gentoo default' --with-system-png
281 mozconfig_annotate '' --enable-system-ffi
282 mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
283 mozconfig_use_enable skia
284 mozconfig_annotate '' --disable-gconf
285 mozconfig_annotate '' --with-intl-api
287 # default toolkit is cairo-gtk2, optional use flags can change this
288 local toolkit="cairo-gtk2"
289 local toolkit_comment=""
290 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
293 toolkit_comment="gtk3 use flag"
296 if [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
300 toolkit_comment="gtk2 use flag"
303 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
306 toolkit_comment="qt5 use flag"
307 # need to specify these vars because the qt5 versions are not found otherwise,
308 # and setting --with-qtdir overrides the pkg-config include dirs
310 for i in qmake moc rcc; do
311 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
312 >> "${S}"/.mozconfig || die
314 echo 'unset QTDIR' >> "${S}"/.mozconfig || die
315 mozconfig_annotate '+qt5' --disable-gio
318 mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
320 # Use jemalloc unless libc is not glibc >= 2.4
321 # at this time the minimum glibc in the tree is 2.9 so we should be safe.
322 if use elibc_glibc && use jemalloc3; then
323 # We must force-enable jemalloc 3 via .mozconfig
324 echo "export MOZ_JEMALLOC3=1" >> "${S}"/.mozconfig || die
325 mozconfig_annotate '' --enable-jemalloc
326 mozconfig_annotate '' --enable-replace-malloc
329 # Instead of the standard --build= and --host=, mozilla uses --host instead
330 # of --build, and --target intstead of --host.
331 # Note, mozilla also has --build but it does not do what you think it does.
332 mozconfig_annotate '' --target="${CHOST}"
333 if [[ "${CBUILD:-${CHOST}}" != "${CHOST}" ]]; then
334 # set --host only when cross-compiling
335 mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
338 mozconfig_use_enable pulseaudio
340 mozconfig_use_enable system-cairo
341 mozconfig_use_enable system-sqlite
342 mozconfig_use_with system-jpeg
343 mozconfig_use_with system-icu
344 mozconfig_use_with system-libvpx
345 mozconfig_use_with system-harfbuzz
346 mozconfig_use_with system-harfbuzz system-graphite2
348 # Modifications to better support ARM, bug 553364
350 mozconfig_annotate '' --with-fpu=neon
351 mozconfig_annotate '' --with-thumb=yes
352 mozconfig_annotate '' --with-thumb-interwork=no
354 if [[ ${CHOST} == armv* ]] ; then
355 mozconfig_annotate '' --with-float-abi=hard
356 mozconfig_annotate '' --enable-skia
358 if ! use system-libvpx ; then
359 sed -i -e "s|softfp|hard|" \
360 "${S}"/media/libvpx/moz.build
365 # @FUNCTION: mozconfig_install_prefs
367 # Set preferences into the prefs.js file specified as a parameter to
368 # the function. This sets both some common prefs to all mozilla
369 # packages, and any prefs that may relate to the use flags administered
370 # by mozconfig_config().
372 # Call this within src_install() phase, after copying the template
373 # prefs file (if any) from ${FILESDIR}
377 # inherit mozconfig-v6.46
380 # cp "${FILESDIR}"/gentoo-default-prefs.js \
381 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
384 # mozconfig_install_prefs \
385 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
390 mozconfig_install_prefs() {
391 local prefs_file="${1}"
393 einfo "Adding prefs from mozconfig to ${prefs_file}"
395 # set dictionary path, to use system hunspell
396 echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
397 >>"${prefs_file}" || die
399 # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
400 if use system-harfbuzz ; then
401 echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
402 >>"${prefs_file}" || die
405 # force cairo as the canvas renderer if USE=skia is disabled
407 echo "lockPref(\"gfx.canvas.azure.backends\",\"cairo\");" \
408 >>"${prefs_file}" || die
409 echo "lockPref(\"gfx.content.azure.backends\",\"cairo\");" \
410 >>"${prefs_file}" || die