kde5.eclass: Cleanup obsolete blocker
[gentoo.git] / eclass / mozconfig-v6.51.eclass
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 #
4 # @ECLASS: mozconfig-v6.51.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-v3,
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 # deterministic jit support via IUSE="jit".  The upstream default will be used
47 # otherwise, which is generally to enable jit unless support for the platform
48 # is missing.
49 #
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_GTK2ONLY
65 # @DEFAULT_UNSET
66 # @DESCRIPTION:
67 # Set this variable before the inherit line, when an ebuild can provide
68 # optional gtk2-only support via IUSE="gtk2".
69 #
70 # Note that this option conflicts directly with MOZCONFIG_OPTIONAL_GTK3, both
71 # variables cannot be set at the same time and this variable will be ignored if
72 # MOZCONFIG_OPTIONAL_GTK3 is set.
73 #
74 # Leave the variable UNSET if gtk2-only support should not be available.
75 # Set the variable to "enabled" if the use flag should be enabled by default.
76 # Set the variable to any value if the use flag should exist but not be default-enabled.
77
78 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
79 # @DEFAULT_UNSET
80 # @DESCRIPTION:
81 # Set this variable before the inherit line, when an ebuild can provide
82 # optional qt5 support via IUSE="qt5".  Currently this would include
83 # ebuilds for firefox, but thunderbird and seamonkey could follow in the future.
84 #
85 # Leave the variable UNSET if qt5 support should not be available.
86 # Set the variable to "enabled" if the use flag should be enabled by default.
87 # Set the variable to any value if the use flag should exist but not be default-enabled.
88
89 # use-flags common among all mozilla ebuilds
90 IUSE="${IUSE} dbus debug +jemalloc neon pulseaudio selinux +skia startup-notification system-cairo
91         system-harfbuzz system-icu system-jpeg system-libevent system-sqlite system-libvpx"
92
93 # some notes on deps:
94 # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
95 # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
96
97 RDEPEND=">=app-text/hunspell-1.2:=
98         dev-libs/atk
99         dev-libs/expat
100         >=x11-libs/cairo-1.10[X]
101         x11-libs/gdk-pixbuf
102         >=x11-libs/pango-1.22.0
103         >=media-libs/libpng-1.6.25:0=[apng]
104         >=media-libs/mesa-10.2:*
105         media-libs/fontconfig
106         >=media-libs/freetype-2.4.10
107         kernel_linux? ( media-libs/alsa-lib )
108         pulseaudio? ( media-sound/pulseaudio )
109         virtual/freedesktop-icon-theme
110         dbus? ( >=sys-apps/dbus-0.60
111                 >=dev-libs/dbus-glib-0.72 )
112         startup-notification? ( >=x11-libs/startup-notification-0.8 )
113         >=dev-libs/glib-2.26:2
114         >=sys-libs/zlib-1.2.3
115         >=virtual/libffi-3.0.10
116         virtual/ffmpeg
117         x11-libs/libX11
118         x11-libs/libXcomposite
119         x11-libs/libXdamage
120         x11-libs/libXext
121         x11-libs/libXfixes
122         x11-libs/libXrender
123         x11-libs/libXt
124         system-cairo? ( >=x11-libs/cairo-1.12[X,xcb] >=x11-libs/pixman-0.19.2 )
125         system-icu? ( >=dev-libs/icu-56.1:= )
126         system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
127         system-libevent? ( >=dev-libs/libevent-2.0:0= )
128         system-sqlite? ( >=dev-db/sqlite-3.14.1:3[secure-delete,debug=] )
129         system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
130         system-harfbuzz? ( >=media-libs/harfbuzz-1.2.6:0=[graphite,icu] >=media-gfx/graphite2-1.3.8 )
131 "
132
133 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
134         MOZCONFIG_OPTIONAL_GTK2ONLY=
135         if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
136                 IUSE+=" +gtk3"
137         else
138                 IUSE+=" gtk3"
139         fi
140         RDEPEND+="
141         gtk3? ( >=x11-libs/gtk+-3.4.0:3 )
142         !gtk3? ( >=x11-libs/gtk+-2.18:2 )"
143 elif [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
144         if [[ ${MOZCONFIG_OPTIONAL_GTK2ONLY} = "enabled" ]]; then
145                 IUSE+=" +gtk2"
146         else
147                 IUSE+=" gtk2"
148         fi
149         RDEPEND+="
150         gtk2? ( >=x11-libs/gtk+-2.18:2 )
151         !gtk2? ( >=x11-libs/gtk+-3.4.0:3 )"
152 else
153         RDEPEND+="
154                 >=x11-libs/gtk+-2.18:2"
155 fi
156 if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
157         inherit qmake-utils
158         if [[ ${MOZCONFIG_OPTIONAL_QT5} = "enabled" ]]; then
159                 IUSE+=" +qt5"
160         else
161                 IUSE+=" qt5"
162         fi
163         RDEPEND+="
164         qt5? (
165                 dev-qt/qtcore:5
166                 dev-qt/qtgui:5
167                 dev-qt/qtnetwork:5
168                 dev-qt/qtprintsupport:5
169                 dev-qt/qtwidgets:5
170                 dev-qt/qtxml:5
171                 dev-qt/qtdeclarative:5
172         )"
173 fi
174 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
175         if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
176                 IUSE+=" +wifi"
177         else
178                 IUSE+=" wifi"
179         fi
180         RDEPEND+="
181         wifi? (
182                 kernel_linux? ( >=sys-apps/dbus-0.60
183                         >=dev-libs/dbus-glib-0.72
184                         net-misc/networkmanager )
185         )"
186 fi
187 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
188         if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
189                 IUSE+=" +jit"
190         else
191                 IUSE+=" jit"
192         fi
193 fi
194
195 DEPEND="app-arch/zip
196         app-arch/unzip
197         >=sys-devel/binutils-2.16.1
198         sys-apps/findutils
199         ${RDEPEND}"
200
201 RDEPEND+="
202         selinux? ( sec-policy/selinux-mozilla )"
203
204 # force system-icu if system-harfbuzz is selected, to avoid potential ABI issues
205 REQUIRED_USE="
206         system-harfbuzz? ( system-icu )"
207
208 # only one of gtk3 or qt5 should be permitted to be selected, since only one will be used.
209 [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
210         REQUIRED_USE+=" ?? ( gtk3 qt5 )"
211
212 # only one of gtk2 or qt5 should be permitted to be selected, since only one will be used.
213 [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]] && [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]] && \
214         REQUIRED_USE+=" ?? ( gtk2 qt5 )"
215
216 # @FUNCTION: mozconfig_config
217 # @DESCRIPTION:
218 # Set common configure options for mozilla packages.
219 # Call this within src_configure() phase, after mozconfig_init
220 #
221 # Example:
222 #
223 # inherit mozconfig-v6.46
224 #
225 # src_configure() {
226 #       mozconfig_init
227 #       mozconfig_config
228 #       # ... misc ebuild-unique settings via calls to
229 #       # ... mozconfig_{annotate,use_with,use_enable}
230 #       mozconfig_final
231 # }
232
233 mozconfig_config() {
234         # Migrated from mozcoreconf-2
235         mozconfig_annotate 'system_libs' \
236                 --with-system-zlib \
237                 --with-system-bz2
238
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
243                 fi
244         fi
245
246         # Enable position independent executables
247         mozconfig_annotate 'enabled by Gentoo' --enable-pie
248         mozconfig_use_enable debug
249         mozconfig_use_enable debug tests
250
251         if ! use debug ; then
252                 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
253         else
254                 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
255         fi
256
257         mozconfig_use_enable startup-notification
258
259         if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
260                 # wifi pulls in dbus so manage both here
261                 mozconfig_use_enable wifi necko-wifi
262                 if use kernel_linux && use wifi && ! use dbus; then
263                         echo "Enabling dbus support due to wifi request"
264                         mozconfig_annotate 'dbus required by necko-wifi on linux' --enable-dbus
265                 else
266                         mozconfig_use_enable dbus
267                 fi
268         else
269                 mozconfig_use_enable dbus
270                 mozconfig_annotate 'disabled' --disable-necko-wifi
271         fi
272
273         if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
274                 mozconfig_use_enable jit ion
275         fi
276
277         # These are enabled by default in all mozilla applications
278         mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${SYSROOT}${EPREFIX}"/usr
279         mozconfig_annotate '' --with-system-nss --with-nss-prefix="${SYSROOT}${EPREFIX}"/usr
280         mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
281         if use system-libevent; then
282                 mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
283         fi
284         mozconfig_annotate '' --prefix="${EPREFIX}"/usr
285         mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
286         mozconfig_annotate 'Gentoo default' --enable-system-hunspell
287         mozconfig_annotate '' --disable-gnomeui
288         mozconfig_annotate '' --enable-gio
289         mozconfig_annotate '' --disable-crashreporter
290         mozconfig_annotate 'Gentoo default' --with-system-png
291         mozconfig_annotate '' --enable-system-ffi
292         mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
293         mozconfig_use_enable skia
294         mozconfig_annotate '' --disable-gconf
295         mozconfig_annotate '' --with-intl-api
296
297         # default toolkit is cairo-gtk2, optional use flags can change this
298         local toolkit="cairo-gtk2"
299         local toolkit_comment=""
300         if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
301                 if use gtk3; then
302                         toolkit="cairo-gtk3"
303                         toolkit_comment="gtk3 use flag"
304                 fi
305         fi
306         if [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
307                 if ! use gtk2 ; then
308                         toolkit="cairo-gtk3"
309                 else
310                         toolkit_comment="gtk2 use flag"
311                 fi
312         fi
313         if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
314                 if use qt5; then
315                         toolkit="cairo-qt"
316                         toolkit_comment="qt5 use flag"
317                         # need to specify these vars because the qt5 versions are not found otherwise,
318                         # and setting --with-qtdir overrides the pkg-config include dirs
319                         local i
320                         for i in qmake moc rcc; do
321                                 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
322                                         >> "${S}"/.mozconfig || die
323                         done
324                         echo 'unset QTDIR' >> "${S}"/.mozconfig || die
325                         mozconfig_annotate '+qt5' --disable-gio
326                 fi
327         fi
328         mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
329
330         # Use jemalloc unless libc is not glibc >= 2.4
331         # at this time the minimum glibc in the tree is 2.9 so we should be safe.
332         if use elibc_glibc && use jemalloc; then
333                 # We must force-enable jemalloc 4 via .mozconfig
334                 echo "export MOZ_JEMALLOC4=1" >> "${S}"/.mozconfig || die
335                 mozconfig_annotate '' --enable-replace-malloc
336         fi
337
338         # Instead of the standard --build= and --host=, mozilla uses --host instead
339         # of --build, and --target intstead of --host.
340         # Note, mozilla also has --build but it does not do what you think it does.
341         # Set both --target and --host as mozilla uses python to guess values otherwise
342         mozconfig_annotate '' --target="${CHOST}"
343         mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
344
345         mozconfig_use_enable pulseaudio
346
347         mozconfig_use_enable system-cairo
348         mozconfig_use_enable system-sqlite
349         mozconfig_use_with system-jpeg
350         mozconfig_use_with system-icu
351         mozconfig_use_with system-libvpx
352         mozconfig_use_with system-harfbuzz
353         mozconfig_use_with system-harfbuzz system-graphite2
354
355         # Modifications to better support ARM, bug 553364
356         if use neon ; then
357                 mozconfig_annotate '' --with-fpu=neon
358                 mozconfig_annotate '' --with-thumb=yes
359                 mozconfig_annotate '' --with-thumb-interwork=no
360         fi
361         if [[ ${CHOST} == armv* ]] ; then
362                 mozconfig_annotate '' --with-float-abi=hard
363                 mozconfig_annotate '' --enable-skia
364
365                 if ! use system-libvpx ; then
366                         sed -i -e "s|softfp|hard|" \
367                                 "${S}"/media/libvpx/moz.build
368                 fi
369         fi
370 }
371
372 # @FUNCTION: mozconfig_install_prefs
373 # @DESCRIPTION:
374 # Set preferences into the prefs.js file specified as a parameter to
375 # the function.  This sets both some common prefs to all mozilla
376 # packages, and any prefs that may relate to the use flags administered
377 # by mozconfig_config().
378 #
379 # Call this within src_install() phase, after copying the template
380 # prefs file (if any) from ${FILESDIR}
381 #
382 # Example:
383 #
384 # inherit mozconfig-v6.46
385 #
386 # src_install() {
387 #       cp "${FILESDIR}"/gentoo-default-prefs.js \
388 #       "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"  \
389 #       || die
390 #
391 #       mozconfig_install_prefs \
392 #       "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
393 #
394 #       ...
395 # }
396
397 mozconfig_install_prefs() {
398         local prefs_file="${1}"
399
400         einfo "Adding prefs from mozconfig to ${prefs_file}"
401
402         # set dictionary path, to use system hunspell
403         echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
404                 >>"${prefs_file}" || die
405
406         # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
407         if use system-harfbuzz ; then
408                 echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
409                         >>"${prefs_file}" || die
410         fi
411
412         # force cairo as the canvas renderer if USE=skia is disabled
413         if ! use skia ; then
414                 echo "lockPref(\"gfx.canvas.azure.backends\",\"cairo\");" \
415                         >>"${prefs_file}" || die
416                 echo "lockPref(\"gfx.content.azure.backends\",\"cairo\");" \
417                         >>"${prefs_file}" || die
418         fi
419 }