1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: mozconfig-v6.58.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-v3,
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-v5
31 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
33 # Set this variable before the inherit line, when an ebuild needs to provide
34 # optional necko-wifi support via IUSE="wifi". Currently this would include
35 # ebuilds for firefox, and potentially seamonkey.
37 # Leave the variable UNSET if necko-wifi support should not be available.
38 # Set the variable to "enabled" if the use flag should be enabled by default.
39 # Set the variable to any value if the use flag should exist but not be default-enabled.
41 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_JIT
43 # Set this variable before the inherit line, when an ebuild needs to provide
44 # deterministic jit support via IUSE="jit". The upstream default will be used
45 # otherwise, which is generally to enable jit unless support for the platform
48 # Set the variable to "enabled" if the use flag should be enabled by default.
49 # Set the variable to any value if the use flag should exist but not be default-enabled.
51 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK3
53 # Set this variable before the inherit line, when an ebuild can provide
54 # optional gtk3 support via IUSE="force-gtk3". Currently this would include
55 # thunderbird and seamonkey in the future, once support is ready for testing.
57 # Leave the variable UNSET if gtk3 support should not be optionally available.
58 # Set the variable to "enabled" if the use flag should be enabled by default.
59 # Set the variable to any value if the use flag should exist but not be default-enabled.
60 # If gtk+:3 is to be the standard toolkit, do not use this and instead use
61 # MOZCONFIG_OPTIONAL_GTK2ONLY.
63 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK2ONLY
65 # Set this variable before the inherit line, when an ebuild can provide
66 # optional gtk2-only support via IUSE="gtk2".
68 # Note that this option conflicts directly with MOZCONFIG_OPTIONAL_GTK3, both
69 # variables cannot be set at the same time and this variable will be ignored if
70 # MOZCONFIG_OPTIONAL_GTK3 is set.
72 # Leave the variable UNSET if gtk2-only support should not be available.
73 # Set the variable to "enabled" if the use flag should be enabled by default.
74 # Set the variable to any value if the use flag should exist but not be default-enabled.
76 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
78 # Set this variable before the inherit line, when an ebuild can provide
79 # optional qt5 support via IUSE="qt5". Currently this would include
80 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
82 # Leave the variable UNSET if qt5 support should not be available.
83 # Set the variable to "enabled" if the use flag should be enabled by default.
84 # Set the variable to any value if the use flag should exist but not be default-enabled.
86 # use-flags common among all mozilla ebuilds
87 IUSE="${IUSE} dbus debug neon pulseaudio selinux startup-notification system-harfbuzz
88 system-icu system-jpeg system-libevent system-sqlite system-libvpx"
91 # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
92 # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
94 RDEPEND=">=app-text/hunspell-1.5.4:=
97 >=x11-libs/cairo-1.10[X]
98 >=x11-libs/gtk+-2.18:2
100 >=x11-libs/pango-1.22.0
101 >=media-libs/libpng-1.6.34:0=[apng]
102 >=media-libs/mesa-10.2:*
103 media-libs/fontconfig
104 >=media-libs/freetype-2.4.10
105 kernel_linux? ( !pulseaudio? ( media-libs/alsa-lib ) )
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 >=x11-libs/pixman-0.19.2
111 >=dev-libs/glib-2.26:2
112 >=sys-libs/zlib-1.2.3
113 >=virtual/libffi-3.0.10
116 x11-libs/libXcomposite
122 system-icu? ( >=dev-libs/icu-59.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.20.1:3[secure-delete,debug=] )
126 system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
127 system-harfbuzz? ( >=media-libs/harfbuzz-1.4.2:0= >=media-gfx/graphite2-1.3.9-r1 )
130 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
131 MOZCONFIG_OPTIONAL_GTK2ONLY=
132 if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
137 RDEPEND+=" force-gtk3? ( >=x11-libs/gtk+-3.4.0:3 )"
138 elif [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
139 if [[ ${MOZCONFIG_OPTIONAL_GTK2ONLY} = "enabled" ]]; then
144 RDEPEND+=" !gtk2? ( >=x11-libs/gtk+-3.4.0:3 )"
146 # no gtk3 related dep set by optional use flags, force it
147 RDEPEND+=" >=x11-libs/gtk+-3.4.0:3"
149 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
150 if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
157 kernel_linux? ( >=sys-apps/dbus-0.60
158 >=dev-libs/dbus-glib-0.72
159 net-misc/networkmanager )
165 >=sys-devel/binutils-2.16.1
167 pulseaudio? ( media-sound/pulseaudio )
169 ( >=dev-lang/rust-1.21.0 >=dev-util/cargo-0.22.0 )
170 >=dev-lang/rust-1.21.0[extended]
171 ( >=dev-lang/rust-bin-1.21.0 >=dev-util/cargo-0.22.0 )
176 pulseaudio? ( || ( media-sound/pulseaudio
177 >=media-sound/apulse-0.1.9 ) )
178 selinux? ( sec-policy/selinux-mozilla )"
180 # @FUNCTION: mozconfig_config
182 # Set common configure options for mozilla packages.
183 # Call this within src_configure() phase, after mozconfig_init
187 # inherit mozconfig-v6.46
192 # # ... misc ebuild-unique settings via calls to
193 # # ... mozconfig_{annotate,use_with,use_enable}
198 # Migrated from mozcoreconf-2
199 mozconfig_annotate 'system_libs' \
203 # Stylo is only broken on x86 builds
204 use x86 && mozconfig_annotate 'Upstream bug 1341234' --disable-stylo
206 # Must pass release in order to properly select linker
207 mozconfig_annotate 'Enable by Gentoo' --enable-release
209 # Must pass --enable-gold if using ld.gold
210 if tc-ld-is-gold ; then
211 mozconfig_annotate 'tc-ld-is-gold=true' --enable-gold
213 mozconfig_annotate 'tc-ld-is-gold=false' --disable-gold
216 if has bindist ${IUSE}; then
217 mozconfig_use_enable !bindist official-branding
218 if [[ ${PN} == firefox ]] && use bindist ; then
219 mozconfig_annotate '' --with-branding=browser/branding/aurora
223 # Enable position independent executables
224 mozconfig_annotate 'enabled by Gentoo' --enable-pie
225 mozconfig_use_enable debug
226 mozconfig_use_enable debug tests
228 if ! use debug ; then
229 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
231 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
234 mozconfig_use_enable startup-notification
236 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
237 # wifi pulls in dbus so manage both here
238 mozconfig_use_enable wifi necko-wifi
239 if use kernel_linux && use wifi && ! use dbus; then
240 echo "Enabling dbus support due to wifi request"
241 mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
243 mozconfig_use_enable dbus
246 mozconfig_use_enable dbus
247 mozconfig_annotate 'disabled' --disable-necko-wifi
250 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
251 mozconfig_use_enable jit ion
254 # These are enabled by default in all mozilla applications
255 mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${SYSROOT}${EPREFIX}"/usr
256 mozconfig_annotate '' --with-system-nss --with-nss-prefix="${SYSROOT}${EPREFIX}"/usr
257 mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
258 if use system-libevent; then
259 mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
261 mozconfig_annotate '' --prefix="${EPREFIX}"/usr
262 mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
263 mozconfig_annotate 'Gentoo default' --enable-system-hunspell
264 mozconfig_annotate '' --disable-crashreporter
265 mozconfig_annotate 'Gentoo default' --with-system-png
266 mozconfig_annotate '' --enable-system-ffi
267 mozconfig_annotate '' --disable-gconf
268 mozconfig_annotate '' --with-intl-api
270 # skia has no support for big-endian platforms
271 if [[ $(tc-endian) == "big" ]]; then
272 mozconfig_annotate 'big endian target' --disable-skia
274 mozconfig_annotate '' --enable-skia
277 # default toolkit is cairo-gtk3, optional use flags can change this
278 local toolkit="cairo-gtk3"
279 local toolkit_comment=""
280 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
281 if ! use force-gtk3; then
283 toolkit_comment="force-gtk3 use flag"
286 if [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
290 toolkit_comment="gtk2 use flag"
293 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
296 toolkit_comment="qt5 use flag"
297 # need to specify these vars because the qt5 versions are not found otherwise,
298 # and setting --with-qtdir overrides the pkg-config include dirs
300 for i in qmake moc rcc; do
301 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
302 >> "${S}"/.mozconfig || die
304 echo 'unset QTDIR' >> "${S}"/.mozconfig || die
305 mozconfig_annotate '+qt5' --disable-gio
308 mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
310 # Instead of the standard --build= and --host=, mozilla uses --host instead
311 # of --build, and --target intstead of --host.
312 # Note, mozilla also has --build but it does not do what you think it does.
313 # Set both --target and --host as mozilla uses python to guess values otherwise
314 mozconfig_annotate '' --target="${CHOST}"
315 mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
317 mozconfig_use_enable pulseaudio
318 # force the deprecated alsa sound code if pulseaudio is disabled
319 if use kernel_linux && ! use pulseaudio ; then
320 mozconfig_annotate '-pulseaudio' --enable-alsa
323 # For testing purpose only
324 mozconfig_annotate 'Sandbox' --enable-content-sandbox
326 mozconfig_use_enable system-sqlite
327 mozconfig_use_with system-jpeg
328 mozconfig_use_with system-icu
329 mozconfig_use_with system-libvpx
330 mozconfig_use_with system-harfbuzz
331 mozconfig_use_with system-harfbuzz system-graphite2
333 # Modifications to better support ARM, bug 553364
335 mozconfig_annotate '' --with-fpu=neon
336 mozconfig_annotate '' --with-thumb=yes
337 mozconfig_annotate '' --with-thumb-interwork=no
339 if [[ ${CHOST} == armv* ]] ; then
340 mozconfig_annotate '' --with-float-abi=hard
341 if ! use system-libvpx ; then
342 sed -i -e "s|softfp|hard|" \
343 "${S}"/media/libvpx/moz.build
348 # @FUNCTION: mozconfig_install_prefs
350 # Set preferences into the prefs.js file specified as a parameter to
351 # the function. This sets both some common prefs to all mozilla
352 # packages, and any prefs that may relate to the use flags administered
353 # by mozconfig_config().
355 # Call this within src_install() phase, after copying the template
356 # prefs file (if any) from ${FILESDIR}
360 # inherit mozconfig-v6.46
363 # cp "${FILESDIR}"/gentoo-default-prefs.js \
364 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
367 # mozconfig_install_prefs \
368 # "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
373 mozconfig_install_prefs() {
374 local prefs_file="${1}"
376 einfo "Adding prefs from mozconfig to ${prefs_file}"
378 # set dictionary path, to use system hunspell
379 echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
380 >>"${prefs_file}" || die
382 # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
383 if use system-harfbuzz ; then
384 echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
385 >>"${prefs_file}" || die
388 # force cairo as the canvas renderer on platforms without skia support
389 if [[ $(tc-endian) == "big" ]] ; then
390 echo "sticky_pref(\"gfx.canvas.azure.backends\",\"cairo\");" \
391 >>"${prefs_file}" || die
392 echo "sticky_pref(\"gfx.content.azure.backends\",\"cairo\");" \
393 >>"${prefs_file}" || die