app-admin/lastpass-cli: serve man from devspace #654846
[gentoo.git] / eclass / mozconfig-v6.58.eclass
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 #
4 # @ECLASS: mozconfig-v6.58.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 # @DESCRIPTION:
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.
36 #
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.
40
41 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_JIT
42 # @DESCRIPTION:
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
46 # is missing.
47 #
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.
50
51 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK3
52 # @DESCRIPTION:
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.
56 #
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.
62
63 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_GTK2ONLY
64 # @DESCRIPTION:
65 # Set this variable before the inherit line, when an ebuild can provide
66 # optional gtk2-only support via IUSE="gtk2".
67 #
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.
71 #
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.
75
76 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_QT5
77 # @DESCRIPTION:
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.
81 #
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.
85
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"
89
90 # some notes on deps:
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
93
94 RDEPEND=">=app-text/hunspell-1.5.4:=
95         dev-libs/atk
96         dev-libs/expat
97         >=x11-libs/cairo-1.10[X]
98         >=x11-libs/gtk+-2.18:2
99         x11-libs/gdk-pixbuf
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
114         virtual/ffmpeg
115         x11-libs/libX11
116         x11-libs/libXcomposite
117         x11-libs/libXdamage
118         x11-libs/libXext
119         x11-libs/libXfixes
120         x11-libs/libXrender
121         x11-libs/libXt
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 )
128 "
129
130 if [[ -n ${MOZCONFIG_OPTIONAL_GTK3} ]]; then
131         MOZCONFIG_OPTIONAL_GTK2ONLY=
132         if [[ ${MOZCONFIG_OPTIONAL_GTK3} = "enabled" ]]; then
133                 IUSE+=" +force-gtk3"
134         else
135                 IUSE+=" force-gtk3"
136         fi
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
140                 IUSE+=" +gtk2"
141         else
142                 IUSE+=" gtk2"
143         fi
144         RDEPEND+=" !gtk2? ( >=x11-libs/gtk+-3.4.0:3 )"
145 else
146         # no gtk3 related dep set by optional use flags, force it
147         RDEPEND+="  >=x11-libs/gtk+-3.4.0:3"
148 fi
149 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
150         if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
151                 IUSE+=" +wifi"
152         else
153                 IUSE+=" wifi"
154         fi
155         RDEPEND+="
156         wifi? (
157                 kernel_linux? ( >=sys-apps/dbus-0.60
158                         >=dev-libs/dbus-glib-0.72
159                         net-misc/networkmanager )
160         )"
161 fi
162
163 DEPEND="app-arch/zip
164         app-arch/unzip
165         >=sys-devel/binutils-2.16.1
166         sys-apps/findutils
167         pulseaudio? ( media-sound/pulseaudio )
168         || (
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 )
172         )
173         ${RDEPEND}"
174
175 RDEPEND+="
176         pulseaudio? ( || ( media-sound/pulseaudio
177                 >=media-sound/apulse-0.1.9 ) )
178         selinux? ( sec-policy/selinux-mozilla )"
179
180 # @FUNCTION: mozconfig_config
181 # @DESCRIPTION:
182 # Set common configure options for mozilla packages.
183 # Call this within src_configure() phase, after mozconfig_init
184 #
185 # Example:
186 #
187 # inherit mozconfig-v6.46
188 #
189 # src_configure() {
190 #       mozconfig_init
191 #       mozconfig_config
192 #       # ... misc ebuild-unique settings via calls to
193 #       # ... mozconfig_{annotate,use_with,use_enable}
194 #       mozconfig_final
195 # }
196
197 mozconfig_config() {
198         # Migrated from mozcoreconf-2
199         mozconfig_annotate 'system_libs' \
200                 --with-system-zlib \
201                 --with-system-bz2
202
203         # Stylo is only broken on x86 builds
204         use x86 && mozconfig_annotate 'Upstream bug 1341234' --disable-stylo
205
206         # Must pass release in order to properly select linker
207         mozconfig_annotate 'Enable by Gentoo' --enable-release
208
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
212         else
213                 mozconfig_annotate 'tc-ld-is-gold=false' --disable-gold
214         fi
215
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
220                 fi
221         fi
222
223         # Enable position independent executables
224         mozconfig_annotate 'enabled by Gentoo' --enable-pie
225         mozconfig_use_enable debug
226         mozconfig_use_enable debug tests
227
228         if ! use debug ; then
229                 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
230         else
231                 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
232         fi
233
234         mozconfig_use_enable startup-notification
235
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
242                 else
243                         mozconfig_use_enable dbus
244                 fi
245         else
246                 mozconfig_use_enable dbus
247                 mozconfig_annotate 'disabled' --disable-necko-wifi
248         fi
249
250         if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
251                 mozconfig_use_enable jit ion
252         fi
253
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
260         fi
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
269
270         # skia has no support for big-endian platforms
271         if [[ $(tc-endian) == "big" ]]; then
272                 mozconfig_annotate 'big endian target' --disable-skia
273         else
274                 mozconfig_annotate '' --enable-skia
275         fi
276
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
282                         toolkit="cairo-gtk2"
283                         toolkit_comment="force-gtk3 use flag"
284                 fi
285         fi
286         if [[ -n ${MOZCONFIG_OPTIONAL_GTK2ONLY} ]]; then
287                 if use gtk2 ; then
288                         toolkit="cairo-gtk2"
289                 else
290                         toolkit_comment="gtk2 use flag"
291                 fi
292         fi
293         if [[ -n ${MOZCONFIG_OPTIONAL_QT5} ]]; then
294                 if use qt5; then
295                         toolkit="cairo-qt"
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
299                         local i
300                         for i in qmake moc rcc; do
301                                 echo "export HOST_${i^^}=\"$(qt5_get_bindir)/${i}\"" \
302                                         >> "${S}"/.mozconfig || die
303                         done
304                         echo 'unset QTDIR' >> "${S}"/.mozconfig || die
305                         mozconfig_annotate '+qt5' --disable-gio
306                 fi
307         fi
308         mozconfig_annotate "${toolkit_comment}" --enable-default-toolkit=${toolkit}
309
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}}"
316
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
321         fi
322
323         # For testing purpose only
324         mozconfig_annotate 'Sandbox' --enable-content-sandbox
325
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
332
333         # Modifications to better support ARM, bug 553364
334         if use neon ; then
335                 mozconfig_annotate '' --with-fpu=neon
336                 mozconfig_annotate '' --with-thumb=yes
337                 mozconfig_annotate '' --with-thumb-interwork=no
338         fi
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
344                 fi
345         fi
346 }
347
348 # @FUNCTION: mozconfig_install_prefs
349 # @DESCRIPTION:
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().
354 #
355 # Call this within src_install() phase, after copying the template
356 # prefs file (if any) from ${FILESDIR}
357 #
358 # Example:
359 #
360 # inherit mozconfig-v6.46
361 #
362 # src_install() {
363 #       cp "${FILESDIR}"/gentoo-default-prefs.js \
364 #       "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"  \
365 #       || die
366 #
367 #       mozconfig_install_prefs \
368 #       "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
369 #
370 #       ...
371 # }
372
373 mozconfig_install_prefs() {
374         local prefs_file="${1}"
375
376         einfo "Adding prefs from mozconfig to ${prefs_file}"
377
378         # set dictionary path, to use system hunspell
379         echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
380                 >>"${prefs_file}" || die
381
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
386         fi
387
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
394         fi
395 }