/[gentoo-x86]/eclass/mozcoreconf-2.eclass
Gentoo

Contents of /eclass/mozcoreconf-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (show annotations) (download)
Mon Mar 25 13:08:39 2013 UTC (18 months, 4 weeks ago) by anarchy
Branch: MAIN
Changes since 1.28: +2 -2 lines
Fix typo is mozcoreconf-2.eclass, bug #462994

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/mozcoreconf-2.eclass,v 1.28 2013/03/24 19:08:58 anarchy Exp $
4 #
5 # mozcoreconf.eclass : core options for mozilla
6 # inherit mozconfig-2 if you need USE flags
7
8 PYTHON_COMPAT=( python2_7 )
9 PYTHON_REQ_USE='threads,sqlite'
10
11 inherit multilib flag-o-matic python-any-r1 versionator
12
13 IUSE="${IUSE} custom-cflags custom-optimization"
14
15 RDEPEND="x11-libs/libXrender
16 x11-libs/libXt
17 >=sys-libs/zlib-1.1.4"
18
19 DEPEND="${RDEPEND}
20 virtual/pkgconfig
21 ${PYTHON_DEPS}"
22
23 # mozconfig_annotate: add an annotated line to .mozconfig
24 #
25 # Example:
26 # mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc
27 # => ac_add_options --enable-js-ultrasparc # building on ultrasparc
28 mozconfig_annotate() {
29 declare reason=$1 x ; shift
30 [[ $# -gt 0 ]] || die "mozconfig_annotate missing flags for ${reason}\!"
31 for x in ${*}; do
32 echo "ac_add_options ${x} # ${reason}" >>.mozconfig
33 done
34 }
35
36 # mozconfig_use_enable: add a line to .mozconfig based on a USE-flag
37 #
38 # Example:
39 # mozconfig_use_enable truetype freetype2
40 # => ac_add_options --enable-freetype2 # +truetype
41 mozconfig_use_enable() {
42 declare flag=$(use_enable "$@")
43 mozconfig_annotate "$(use $1 && echo +$1 || echo -$1)" "${flag}"
44 }
45
46 # mozconfig_use_with: add a line to .mozconfig based on a USE-flag
47 #
48 # Example:
49 # mozconfig_use_with kerberos gss-api /usr/$(get_libdir)
50 # => ac_add_options --with-gss-api=/usr/lib # +kerberos
51 mozconfig_use_with() {
52 declare flag=$(use_with "$@")
53 mozconfig_annotate "$(use $1 && echo +$1 || echo -$1)" "${flag}"
54 }
55
56 # mozconfig_use_extension: enable or disable an extension based on a USE-flag
57 #
58 # Example:
59 # mozconfig_use_extension gnome gnomevfs
60 # => ac_add_options --enable-extensions=gnomevfs
61 mozconfig_use_extension() {
62 declare minus=$(use $1 || echo -)
63 mozconfig_annotate "${minus:-+}$1" --enable-extensions=${minus}${2}
64 }
65
66 mozversion_is_new_enough() {
67 case ${PN} in
68 firefox|thunderbird)
69 if [[ $(get_version_component_range 1) -ge 17 ]] ; then
70 return 0
71 fi
72 ;;
73 seamonkey)
74 if [[ $(get_version_component_range 1) -eq 2 ]] && [[ $(get_version_component_range 2) -ge 14 ]] ; then
75 return 0
76 fi
77 ;;
78 esac
79
80 return 1
81 }
82
83 moz_pkgsetup() {
84 # Ensure we use C locale when building
85 export LANG="C"
86 export LC_ALL="C"
87 export LC_MESSAGES="C"
88 export LC_CTYPE="C"
89
90 # Ensure that we have a sane build enviroment
91 export MOZILLA_CLIENT=1
92 export BUILD_OPT=1
93 export NO_STATIC_LIB=1
94 export USE_PTHREADS=1
95 export ALDFLAGS=${LDFLAGS}
96
97 # nested configure scripts in mozilla products generate unrecognized options
98 # false positives when toplevel configure passes downwards.
99 export QA_CONFIGURE_OPTIONS=".*"
100
101 if [[ $(gcc-major-version) -eq 3 ]]; then
102 ewarn "Unsupported compiler detected, DO NOT file bugs for"
103 ewarn "outdated compilers. Bugs opened with gcc-3 will be closed"
104 ewarn "invalid."
105 fi
106
107 python-any-r1_pkg_setup
108 }
109
110 mozconfig_init() {
111 declare enable_optimize pango_version myext x
112 declare XUL=$([[ ${PN} == xulrunner ]] && echo true || echo false)
113 declare FF=$([[ ${PN} == firefox ]] && echo true || echo false)
114 declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false)
115 declare TB=$([[ ${PN} == thunderbird ]] && echo true || echo false)
116
117 ####################################
118 #
119 # Setup the initial .mozconfig
120 # See http://www.mozilla.org/build/configure-build.html
121 #
122 ####################################
123
124 case ${PN} in
125 *xulrunner)
126 cp xulrunner/config/mozconfig .mozconfig \
127 || die "cp xulrunner/config/mozconfig failed" ;;
128 *firefox)
129 cp browser/config/mozconfig .mozconfig \
130 || die "cp browser/config/mozconfig failed" ;;
131 seamonkey)
132 # Must create the initial mozconfig to enable application
133 : >.mozconfig || die "initial mozconfig creation failed"
134 mozconfig_annotate "" --enable-application=suite ;;
135 *thunderbird)
136 # Must create the initial mozconfig to enable application
137 : >.mozconfig || die "initial mozconfig creation failed"
138 mozconfig_annotate "" --enable-application=mail ;;
139 esac
140
141 ####################################
142 #
143 # CFLAGS setup and ARCH support
144 #
145 ####################################
146
147 # Set optimization level
148 if [[ ${ARCH} == hppa ]]; then
149 mozconfig_annotate "more than -O0 causes a segfault on hppa" --enable-optimize=-O0
150 elif [[ ${ARCH} == x86 ]]; then
151 mozconfig_annotate "less then -O2 causes a segfault on x86" --enable-optimize=-O2
152 elif use custom-optimization || [[ ${ARCH} =~ (alpha|ia64) ]]; then
153 # Set optimization level based on CFLAGS
154 if is-flag -O0; then
155 mozconfig_annotate "from CFLAGS" --enable-optimize=-O0
156 elif [[ ${ARCH} == ppc ]] && has_version '>=sys-libs/glibc-2.8'; then
157 mozconfig_annotate "more than -O1 segfaults on ppc with glibc-2.8" --enable-optimize=-O1
158 elif is-flag -O3; then
159 mozconfig_annotate "from CFLAGS" --enable-optimize=-O3
160 elif is-flag -O1; then
161 mozconfig_annotate "from CFLAGS" --enable-optimize=-O1
162 elif is-flag -Os; then
163 mozconfig_annotate "from CFLAGS" --enable-optimize=-Os
164 else
165 mozconfig_annotate "Gentoo's default optimization" --enable-optimize=-O2
166 fi
167 else
168 # Enable Mozilla's default
169 mozconfig_annotate "mozilla default" --enable-optimize
170 fi
171
172 # Strip optimization so it does not end up in compile string
173 filter-flags '-O*'
174
175 # Strip over-aggressive CFLAGS
176 use custom-cflags || strip-flags
177
178 # Additional ARCH support
179 case "${ARCH}" in
180 alpha)
181 # Historically we have needed to add -fPIC manually for 64-bit.
182 # Additionally, alpha should *always* build with -mieee for correct math
183 # operation
184 append-flags -fPIC -mieee
185 ;;
186
187 ia64)
188 # Historically we have needed to add this manually for 64-bit
189 append-flags -fPIC
190 ;;
191
192 ppc64)
193 append-flags -fPIC -mminimal-toc
194 ;;
195 esac
196
197 # Go a little faster; use less RAM
198 append-flags "$MAKEEDIT_FLAGS"
199
200 ####################################
201 #
202 # mozconfig setup
203 #
204 ####################################
205
206 mozconfig_annotate system_libs \
207 --with-system-jpeg \
208 --with-system-zlib \
209 --enable-pango \
210 --enable-system-cairo
211 if ! $(mozversion_is_new_enough) ; then
212 mozconfig_annotate system-libs --enable-svg
213 fi
214
215 mozconfig_annotate disable_update_strip \
216 --disable-pedantic \
217 --disable-updater \
218 --disable-strip \
219 --disable-install-strip
220 if ! $(mozversion_is_new_enough) ; then
221 mozconfig_annotate disable_update_strip \
222 --disable-installer \
223 --disable-strip-libs
224 fi
225
226 if [[ ${PN} != seamonkey ]]; then
227 mozconfig_annotate basic_profile \
228 --disable-profilelocking
229 if ! $(mozversion_is_new_enough) ; then
230 mozconfig_annotate basic_profile \
231 --enable-single-profile \
232 --disable-profilesharing
233 fi
234 fi
235
236 # Here is a strange one...
237 if is-flag '-mcpu=ultrasparc*' || is-flag '-mtune=ultrasparc*'; then
238 mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc
239 fi
240
241 # Currently --enable-elf-dynstr-gc only works for x86,
242 # thanks to Jason Wever <weeve@gentoo.org> for the fix.
243 if use x86 && [[ ${enable_optimize} != -O0 ]]; then
244 mozconfig_annotate "${ARCH} optimized build" --enable-elf-dynstr-gc
245 fi
246
247 # jemalloc won't build with older glibc
248 ! has_version ">=sys-libs/glibc-2.4" && mozconfig_annotate "we have old glibc" --disable-jemalloc
249 }
250
251 # mozconfig_final: display a table describing all configuration options paired
252 # with reasons, then clean up extensions list
253 mozconfig_final() {
254 declare ac opt hash reason
255 echo
256 echo "=========================================================="
257 echo "Building ${PF} with the following configuration"
258 grep ^ac_add_options .mozconfig | while read ac opt hash reason; do
259 [[ -z ${hash} || ${hash} == \# ]] \
260 || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}"
261 printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}"
262 done
263 echo "=========================================================="
264 echo
265
266 # Resolve multiple --enable-extensions down to one
267 declare exts=$(sed -n 's/^ac_add_options --enable-extensions=\([^ ]*\).*/\1/p' \
268 .mozconfig | xargs)
269 sed -i '/^ac_add_options --enable-extensions/d' .mozconfig
270 echo "ac_add_options --enable-extensions=${exts// /,}" >> .mozconfig
271 }

  ViewVC Help
Powered by ViewVC 1.1.20