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