x11-misc/alock: Take ownership of package
[gentoo.git] / eclass / mozconfig-v6.38.eclass
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4 #
5 # @ECLASS: mozconfig-v5.33.eclass
6 # @MAINTAINER:
7 # mozilla team <mozilla@gentoo.org>
8 # @BLURB: the new mozilla common configuration eclass for FF33 and newer, v5
9 # @DESCRIPTION:
10 # This eclass is used in mozilla ebuilds (firefox, thunderbird, seamonkey)
11 # to provide a single common place for the common mozilla engine compoments.
12 #
13 # The eclass provides all common dependencies as well as common use flags.
14 #
15 # Some use flags which may be optional in particular mozilla packages can be
16 # supported through setting eclass variables.
17 #
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.
20
21 inherit multilib flag-o-matic toolchain-funcs mozcoreconf-v3
22
23 case ${EAPI} in
24         0|1|2|3|4) die "EAPI=${EAPI} not supported"
25 esac
26
27 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
28 # @DESCRIPTION:
29 # Set this variable before the inherit line, when an ebuild needs to provide
30 # optional necko-wifi support via IUSE="wifi".  Currently this would include
31 # ebuilds for firefox, and potentially seamonkey.
32 #
33 # Leave the variable UNSET if necko-wifi support should not be available.
34 # Set the variable to "enabled" if the use flag should be enabled by default.
35 # Set the variable to any value if the use flag should exist but not be default-enabled.
36
37 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_JIT
38 # @DESCRIPTION:
39 # Set this variable before the inherit line, when an ebuild needs to provide
40 # optional necko-wifi support via IUSE="jit".  Currently this would include
41 # ebuilds for firefox, and potentially seamonkey.
42 #
43 # Leave the variable UNSET if optional jit support should not be available.
44 # Set the variable to "enabled" if the use flag should be enabled by default.
45 # Set the variable to any value if the use flag should exist but not be default-enabled.
46
47 # use-flags common among all mozilla ebuilds
48 IUSE="${IUSE} dbus debug gstreamer gstreamer-0 +jemalloc3 neon pulseaudio selinux startup-notification system-cairo system-icu system-jpeg system-sqlite system-libvpx"
49
50 # some notes on deps:
51 # gtk:2 minimum is technically 2.10 but gio support (enabled by default) needs 2.14
52 # media-libs/mesa needs to be 10.2 or above due to a bug with flash+vdpau
53
54 RDEPEND=">=app-text/hunspell-1.2
55         dev-libs/atk
56         dev-libs/expat
57         >=dev-libs/libevent-1.4.7
58         >=x11-libs/cairo-1.10[X]
59         >=x11-libs/gtk+-2.18:2
60         x11-libs/gdk-pixbuf
61         >=x11-libs/pango-1.22.0
62         >=media-libs/libpng-1.6.16:0=[apng]
63         >=media-libs/mesa-10.2:*
64         media-libs/fontconfig
65         >=media-libs/freetype-2.4.10
66         kernel_linux? ( media-libs/alsa-lib )
67         pulseaudio? ( media-sound/pulseaudio )
68         virtual/freedesktop-icon-theme
69         dbus? ( >=sys-apps/dbus-0.60
70                 >=dev-libs/dbus-glib-0.72 )
71         startup-notification? ( >=x11-libs/startup-notification-0.8 )
72         >=dev-libs/glib-2.26:2
73         >=sys-libs/zlib-1.2.3
74         >=virtual/libffi-3.0.10
75         gstreamer? (
76                 >=media-libs/gstreamer-1.4.5:1.0
77                 >=media-libs/gst-plugins-base-1.4.5:1.0
78                 >=media-libs/gst-plugins-good-1.4.5:1.0
79                 >=media-plugins/gst-plugins-libav-1.4.5:1.0
80         )
81         gstreamer-0? (
82                 media-plugins/gst-plugins-meta:0.10[ffmpeg]
83         )
84         x11-libs/libX11
85         x11-libs/libXcomposite
86         x11-libs/libXdamage
87         x11-libs/libXext
88         x11-libs/libXfixes
89         x11-libs/libXrender
90         x11-libs/libXt
91         system-cairo? ( >=x11-libs/cairo-1.12[X] >=x11-libs/pixman-0.19.2 )
92         system-icu? ( >=dev-libs/icu-51.1:= )
93         system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
94         system-sqlite? ( >=dev-db/sqlite-3.8.8.2:3[secure-delete,debug=] )
95         system-libvpx? ( >=media-libs/libvpx-1.3.0:0=[postproc] )
96 "
97
98 if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]]; then
99         if [[ ${MOZCONFIG_OPTIONAL_WIFI} = "enabled" ]]; then
100                 IUSE+=" +wifi"
101         else
102                 IUSE+=" wifi"
103         fi
104         RDEPEND+="
105         wifi? ( >=sys-apps/dbus-0.60
106                 >=dev-libs/dbus-glib-0.72
107                 net-wireless/wireless-tools )"
108 fi
109 if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
110         if [[ ${MOZCONFIG_OPTIONAL_JIT} = "enabled" ]]; then
111                 IUSE+=" +jit"
112         else
113                 IUSE+=" jit"
114         fi
115 fi
116
117 DEPEND="app-arch/zip
118         app-arch/unzip
119         >=sys-devel/binutils-2.16.1
120         ${RDEPEND}"
121
122 RDEPEND+="
123         selinux? ( sec-policy/selinux-mozilla )"
124
125 # only one of gstreamer and gstreamer-0 can be enabled at a time, so set REQUIRED_USE to signify this
126 REQUIRED_USE="?? ( gstreamer gstreamer-0 )"
127
128 # @FUNCTION: mozconfig_config
129 # @DESCRIPTION:
130 # Set common configure options for mozilla packages.
131 # Call this within src_configure() phase, after mozconfig_init
132 #
133 # Example:
134 #
135 # inherit mozconfig-v5.33
136 #
137 # src_configure() {
138 #       mozconfig_init
139 #       mozconfig_config
140 #       # ... misc ebuild-unique settings via calls to
141 #       # ... mozconfig_{annotate,use_with,use_enable}
142 #       mozconfig_final
143 # }
144
145 mozconfig_config() {
146         # Migrated from mozcoreconf-2
147         mozconfig_annotate 'system_libs' \
148                 --with-system-zlib \
149                 --enable-pango \
150                 --enable-svg \
151                 --with-system-bz2
152
153         mozconfig_annotate '' --enable-default-toolkit=cairo-gtk2
154
155         if has bindist ${IUSE}; then
156                 mozconfig_use_enable !bindist official-branding
157                 if [[ ${PN} == firefox ]] && use bindist ; then
158                         mozconfig_annotate '' --with-branding=browser/branding/aurora
159                 fi
160         fi
161
162         mozconfig_use_enable debug
163         mozconfig_use_enable debug tests
164
165         if ! use debug ; then
166                 mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
167         else
168                 mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
169         fi
170
171         mozconfig_use_enable startup-notification
172
173         if [[ -n ${MOZCONFIG_OPTIONAL_WIFI} ]] ; then
174                 # wifi pulls in dbus so manage both here
175                 mozconfig_use_enable wifi necko-wifi
176                 if use wifi && ! use dbus; then
177                         echo "Enabling dbus support due to wifi request"
178                         mozconfig_annotate 'dbus required by necko-wifi' --enable-dbus
179                 else
180                         mozconfig_use_enable dbus
181                 fi
182         else
183                 mozconfig_use_enable dbus
184                 mozconfig_annotate 'disabled' --disable-necko-wifi
185         fi
186
187         # These are forced-on for webm support
188         mozconfig_annotate 'required' --enable-ogg
189         mozconfig_annotate 'required' --enable-wave
190
191         if [[ -n ${MOZCONFIG_OPTIONAL_JIT} ]]; then
192                 mozconfig_use_enable jit ion
193         fi
194
195         # These are enabled by default in all mozilla applications
196         mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
197         mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
198         mozconfig_annotate '' --x-includes="${EPREFIX}"/usr/include --x-libraries="${EPREFIX}"/usr/$(get_libdir)
199         mozconfig_annotate '' --with-system-libevent="${EPREFIX}"/usr
200         mozconfig_annotate '' --prefix="${EPREFIX}"/usr
201         mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
202         mozconfig_annotate 'Gentoo default' --enable-system-hunspell
203         mozconfig_annotate '' --disable-gnomevfs
204         mozconfig_annotate '' --disable-gnomeui
205         mozconfig_annotate '' --enable-gio
206         mozconfig_annotate '' --disable-crashreporter
207         mozconfig_annotate 'Gentoo default' --with-system-png
208         mozconfig_annotate '' --enable-system-ffi
209         mozconfig_annotate 'Gentoo default to honor system linker' --disable-gold
210         mozconfig_annotate '' --disable-gconf
211         mozconfig_annotate 'Gentoo default' --disable-skia
212
213         # Use jemalloc unless libc is not glibc >= 2.4
214         # at this time the minimum glibc in the tree is 2.9 so we should be safe.
215         if use elibc_glibc && use jemalloc3; then
216                 # We must force-enable jemalloc 3 via .mozconfig
217                 echo "export MOZ_JEMALLOC3=1" >> "${S}"/.mozconfig || die
218                 mozconfig_annotate '' --enable-jemalloc
219                 mozconfig_annotate '' --enable-replace-malloc
220         fi
221
222         mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
223         mozconfig_annotate '' --build="${CTARGET:-${CHOST}}"
224
225         if use gstreamer ; then
226                 mozconfig_annotate '+gstreamer' --enable-gstreamer=1.0
227         elif use gstreamer-0 ; then
228                 mozconfig_annotate '+gstreamer-0' --enable-gstreamer=0.10
229         else
230                 mozconfig_annotate '' --disable-gstreamer
231         fi
232         mozconfig_use_enable pulseaudio
233
234         mozconfig_use_enable system-cairo
235         mozconfig_use_enable system-sqlite
236         mozconfig_use_with system-jpeg
237         mozconfig_use_with system-icu
238         mozconfig_use_with system-icu intl-api
239         mozconfig_use_with system-libvpx
240
241         # Modifications to better support ARM, bug 553364
242         if use neon ; then
243                 mozconfig_annotate '' --with-fpu=neon
244                 mozconfig_annotate '' --with-thumb=yes
245                 mozconfig_annotate '' --with-thumb-interwork=no
246         fi
247         if [[ ${CHOST} == armv* ]] ; then
248                 mozconfig_annotate '' --with-float-abi=hard
249                 mozconfig_annotate '' --enable-skia
250
251                 if ! use system-libvpx ; then
252                         sed -i -e "s|softfp|hard|" \
253                                 "${S}"/media/libvpx/moz.build
254                 fi
255         fi
256 }