Gentoo Archives: gentoo-commits

From: Ian Stakenvicius <axs@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/mozilla:master commit in: eclass/
Date: Thu, 04 May 2017 17:46:27
Message-Id: 1493919962.e864fe3daa606444a43535c4a95e6215d8165cd1.axs@gentoo
1 commit: e864fe3daa606444a43535c4a95e6215d8165cd1
2 Author: Ian Stakenvicius <axs <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 4 17:46:02 2017 +0000
4 Commit: Ian Stakenvicius <axs <AT> gentoo <DOT> org>
5 CommitDate: Thu May 4 17:46:02 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=e864fe3d
7
8 Add support for EXTRA_ECONF processing
9
10 eclass/mozconfig-v6.52.eclass | 2 +-
11 eclass/mozconfig-v6.53.eclass | 6 +-
12 eclass/mozcoreconf-v5.eclass | 278 ++++++++++++++++++++++++++++++++++++++++++
13 3 files changed, 282 insertions(+), 4 deletions(-)
14
15 diff --git a/eclass/mozconfig-v6.52.eclass b/eclass/mozconfig-v6.52.eclass
16 index 9b3ca13..c859aa7 100644
17 --- a/eclass/mozconfig-v6.52.eclass
18 +++ b/eclass/mozconfig-v6.52.eclass
19 @@ -26,7 +26,7 @@ case ${EAPI} in
20 ;;
21 esac
22
23 -inherit flag-o-matic toolchain-funcs mozcoreconf-v4
24 +inherit flag-o-matic toolchain-funcs mozcoreconf-v5
25
26 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
27 # @DESCRIPTION:
28
29 diff --git a/eclass/mozconfig-v6.53.eclass b/eclass/mozconfig-v6.53.eclass
30 index 9222c7b..d15c47e 100644
31 --- a/eclass/mozconfig-v6.53.eclass
32 +++ b/eclass/mozconfig-v6.53.eclass
33 @@ -1,7 +1,7 @@
34 -# Copyright 1999-2015 Gentoo Foundation
35 +# Copyright 1999-2017 Gentoo Foundation
36 # Distributed under the terms of the GNU General Public License v2
37 #
38 -# @ECLASS: mozconfig-v6.52.eclass
39 +# @ECLASS: mozconfig-v6.53.eclass
40 # @MAINTAINER:
41 # mozilla team <mozilla@g.o>
42 # @BLURB: the new mozilla common configuration eclass for FF33 and newer, v6
43 @@ -26,7 +26,7 @@ case ${EAPI} in
44 ;;
45 esac
46
47 -inherit flag-o-matic toolchain-funcs mozcoreconf-v4
48 +inherit flag-o-matic toolchain-funcs mozcoreconf-v5
49
50 # @ECLASS-VARIABLE: MOZCONFIG_OPTIONAL_WIFI
51 # @DESCRIPTION:
52
53 diff --git a/eclass/mozcoreconf-v5.eclass b/eclass/mozcoreconf-v5.eclass
54 new file mode 100644
55 index 0000000..4ecfbd8
56 --- /dev/null
57 +++ b/eclass/mozcoreconf-v5.eclass
58 @@ -0,0 +1,278 @@
59 +# Copyright 1999-2017 Gentoo Foundation
60 +# Distributed under the terms of the GNU General Public License v2
61 +#
62 +# @ECLASS: mozcoreconf-v5.eclass
63 +# @MAINTAINER:
64 +# Mozilla team <mozilla@g.o>
65 +# @BLURB: core options and configuration functions for mozilla
66 +# @DESCRIPTION:
67 +#
68 +# inherit mozconfig-v6.* or above for mozilla configuration support
69 +
70 +# @ECLASS-VARIABLE: MOZILLA_FIVE_HOME
71 +# @DESCRIPTION:
72 +# This is an eclass-generated variable that defines the rpath that the mozilla
73 +# product will be installed in. Read-only
74 +
75 +if [[ ! ${_MOZCORECONF} ]]; then
76 +
77 +PYTHON_COMPAT=( python2_7 )
78 +PYTHON_REQ_USE='ncurses,sqlite,ssl,threads'
79 +
80 +inherit multilib toolchain-funcs flag-o-matic python-any-r1 versionator
81 +
82 +IUSE="${IUSE} custom-cflags custom-optimization"
83 +
84 +DEPEND="virtual/pkgconfig
85 + ${PYTHON_DEPS}"
86 +
87 +# @FUNCTION: mozconfig_annotate
88 +# @DESCRIPTION:
89 +# add an annotated line to .mozconfig
90 +#
91 +# Example:
92 +# mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc
93 +# => ac_add_options --enable-js-ultrasparc # building on ultrasparc
94 +mozconfig_annotate() {
95 + declare reason=$1 x ; shift
96 + [[ $# -gt 0 ]] || die "mozconfig_annotate missing flags for ${reason}\!"
97 + for x in ${*}; do
98 + echo "ac_add_options ${x} # ${reason}" >>.mozconfig
99 + done
100 +}
101 +
102 +# @FUNCTION: mozconfig_use_enable
103 +# @DESCRIPTION:
104 +# add a line to .mozconfig based on a USE-flag
105 +#
106 +# Example:
107 +# mozconfig_use_enable truetype freetype2
108 +# => ac_add_options --enable-freetype2 # +truetype
109 +mozconfig_use_enable() {
110 + declare flag=$(use_enable "$@")
111 + mozconfig_annotate "$(use $1 && echo +$1 || echo -$1)" "${flag}"
112 +}
113 +
114 +# @FUNCTION mozconfig_use_with
115 +# @DESCRIPTION
116 +# add a line to .mozconfig based on a USE-flag
117 +#
118 +# Example:
119 +# mozconfig_use_with kerberos gss-api /usr/$(get_libdir)
120 +# => ac_add_options --with-gss-api=/usr/lib # +kerberos
121 +mozconfig_use_with() {
122 + declare flag=$(use_with "$@")
123 + mozconfig_annotate "$(use $1 && echo +$1 || echo -$1)" "${flag}"
124 +}
125 +
126 +# @FUNCTION mozconfig_use_extension
127 +# @DESCRIPTION
128 +# enable or disable an extension based on a USE-flag
129 +#
130 +# Example:
131 +# mozconfig_use_extension gnome gnomevfs
132 +# => ac_add_options --enable-extensions=gnomevfs
133 +mozconfig_use_extension() {
134 + declare minus=$(use $1 || echo -)
135 + mozconfig_annotate "${minus:-+}$1" --enable-extensions=${minus}${2}
136 +}
137 +
138 +moz_pkgsetup() {
139 + # Ensure we use C locale when building
140 + export LANG="C"
141 + export LC_ALL="C"
142 + export LC_MESSAGES="C"
143 + export LC_CTYPE="C"
144 +
145 + # Ensure we use correct toolchain
146 + export HOST_CC="$(tc-getBUILD_CC)"
147 + export HOST_CXX="$(tc-getBUILD_CXX)"
148 + tc-export CC CXX LD PKG_CONFIG
149 +
150 + # Ensure that we have a sane build enviroment
151 + export MOZILLA_CLIENT=1
152 + export BUILD_OPT=1
153 + export NO_STATIC_LIB=1
154 + export USE_PTHREADS=1
155 + export ALDFLAGS=${LDFLAGS}
156 + # ensure MOZCONFIG is not defined
157 + eval unset MOZCONFIG
158 +
159 + # set MOZILLA_FIVE_HOME
160 + export MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
161 +
162 + # nested configure scripts in mozilla products generate unrecognized options
163 + # false positives when toplevel configure passes downwards.
164 + export QA_CONFIGURE_OPTIONS=".*"
165 +
166 + if [[ $(gcc-major-version) -eq 3 ]]; then
167 + ewarn "Unsupported compiler detected, DO NOT file bugs for"
168 + ewarn "outdated compilers. Bugs opened with gcc-3 will be closed"
169 + ewarn "invalid."
170 + fi
171 +
172 + python-any-r1_pkg_setup
173 +}
174 +
175 +# @FUNCTION: mozconfig_init
176 +# @DESCRIPTION:
177 +# Initialize mozilla configuration and populate with core settings.
178 +# This should be called in src_configure before any other mozconfig_* functions.
179 +mozconfig_init() {
180 + declare enable_optimize pango_version myext x
181 + declare XUL=$([[ ${PN} == xulrunner ]] && echo true || echo false)
182 + declare FF=$([[ ${PN} == firefox ]] && echo true || echo false)
183 + declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false)
184 + declare TB=$([[ ${PN} == thunderbird ]] && echo true || echo false)
185 +
186 + ####################################
187 + #
188 + # Setup the initial .mozconfig
189 + # See http://www.mozilla.org/build/configure-build.html
190 + #
191 + ####################################
192 +
193 + case ${PN} in
194 + *xulrunner)
195 + cp xulrunner/config/mozconfig .mozconfig \
196 + || die "cp xulrunner/config/mozconfig failed" ;;
197 + *firefox)
198 + cp browser/config/mozconfig .mozconfig \
199 + || die "cp browser/config/mozconfig failed" ;;
200 + seamonkey)
201 + # Must create the initial mozconfig to enable application
202 + : >.mozconfig || die "initial mozconfig creation failed"
203 + mozconfig_annotate "" --enable-application=suite ;;
204 + *thunderbird)
205 + # Must create the initial mozconfig to enable application
206 + : >.mozconfig || die "initial mozconfig creation failed"
207 + mozconfig_annotate "" --enable-application=mail ;;
208 + esac
209 +
210 + ####################################
211 + #
212 + # CFLAGS setup and ARCH support
213 + #
214 + ####################################
215 +
216 + # Set optimization level
217 + if [[ ${ARCH} == hppa ]]; then
218 + mozconfig_annotate "more than -O0 causes a segfault on hppa" --enable-optimize=-O0
219 + elif [[ ${ARCH} == x86 ]]; then
220 + mozconfig_annotate "less then -O2 causes a segfault on x86" --enable-optimize=-O2
221 + elif use custom-optimization || [[ ${ARCH} =~ (alpha|ia64) ]]; then
222 + # Set optimization level based on CFLAGS
223 + if is-flag -O0; then
224 + mozconfig_annotate "from CFLAGS" --enable-optimize=-O0
225 + elif [[ ${ARCH} == ppc ]] && has_version '>=sys-libs/glibc-2.8'; then
226 + mozconfig_annotate "more than -O1 segfaults on ppc with glibc-2.8" --enable-optimize=-O1
227 + elif is-flag -O4; then
228 + mozconfig_annotate "from CFLAGS" --enable-optimize=-O4
229 + elif is-flag -O3; then
230 + mozconfig_annotate "from CFLAGS" --enable-optimize=-O3
231 + elif is-flag -O1; then
232 + mozconfig_annotate "from CFLAGS" --enable-optimize=-O1
233 + elif is-flag -Os; then
234 + mozconfig_annotate "from CFLAGS" --enable-optimize=-Os
235 + else
236 + mozconfig_annotate "Gentoo's default optimization" --enable-optimize=-O2
237 + fi
238 + else
239 + # Enable Mozilla's default
240 + mozconfig_annotate "mozilla default" --enable-optimize
241 + fi
242 +
243 + # Strip optimization so it does not end up in compile string
244 + filter-flags '-O*'
245 +
246 + # Strip over-aggressive CFLAGS
247 + use custom-cflags || strip-flags
248 +
249 + # Additional ARCH support
250 + case "${ARCH}" in
251 + arm)
252 + # Reduce the memory requirements for linking
253 + append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads
254 + ;;
255 + alpha)
256 + # Historically we have needed to add -fPIC manually for 64-bit.
257 + # Additionally, alpha should *always* build with -mieee for correct math
258 + # operation
259 + append-flags -fPIC -mieee
260 + ;;
261 + ia64)
262 + # Historically we have needed to add this manually for 64-bit
263 + append-flags -fPIC
264 + ;;
265 + ppc64)
266 + append-flags -fPIC -mminimal-toc
267 + # Reduce the memory requirements for linking
268 + append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads
269 + ;;
270 + esac
271 +
272 + # We need to append flags for gcc-6 support
273 + if [[ $(gcc-major-version) -ge 6 ]]; then
274 + append-cxxflags -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2
275 + fi
276 +
277 + # Go a little faster; use less RAM
278 + append-flags "$MAKEEDIT_FLAGS"
279 +
280 + # Use the MOZILLA_FIVE_HOME for the rpath
281 + append-ldflags -Wl,-rpath="${MOZILLA_FIVE_HOME}",--enable-new-dtags
282 + # Set MOZILLA_FIVE_HOME in mozconfig
283 + mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
284 +
285 + ####################################
286 + #
287 + # mozconfig setup
288 + #
289 + ####################################
290 +
291 + mozconfig_annotate disable_update_strip \
292 + --disable-updater \
293 + --disable-strip \
294 + --disable-install-strip
295 +
296 + # jemalloc won't build with older glibc
297 + ! has_version ">=sys-libs/glibc-2.4" && mozconfig_annotate "we have old glibc" --disable-jemalloc
298 +}
299 +
300 +# @FUNCTION: mozconfig_final
301 +# @DESCRIPTION:
302 +# Apply EXTRA_ECONF values to .mozconfig
303 +# Display a table describing all configuration options paired
304 +# with reasons, then clean up extensions list.
305 +# This should be called in src_configure at the end of all other mozconfig_* functions.
306 +mozconfig_final() {
307 + declare ac opt hash reason
308 +
309 + # Apply EXTRA_ECONF entries to .mozconfig
310 + if [[ -n ${EXTRA_ECONF} ]]; then
311 + IFS=\! read -a ac <<<${EXTRA_ECONF// --/\!}
312 + for opt in "${ac[@]}"; do
313 + mozconfig_annotate "EXTRA_ECONF" --${opt#--}
314 + done
315 + fi
316 +
317 + echo
318 + echo "=========================================================="
319 + echo "Building ${PF} with the following configuration"
320 + grep ^ac_add_options .mozconfig | while read ac opt hash reason; do
321 + [[ -z ${hash} || ${hash} == \# ]] \
322 + || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}"
323 + printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}"
324 + done
325 + echo "=========================================================="
326 + echo
327 +
328 + # Resolve multiple --enable-extensions down to one
329 + declare exts=$(sed -n 's/^ac_add_options --enable-extensions=\([^ ]*\).*/\1/p' \
330 + .mozconfig | xargs)
331 + sed -i '/^ac_add_options --enable-extensions/d' .mozconfig
332 + echo "ac_add_options --enable-extensions=${exts// /,}" >> .mozconfig
333 +}
334 +
335 +_MOZCORECONF=1
336 +fi