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

Contents of /eclass/mozcoreconf-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (show annotations) (download)
Mon Dec 10 16:47:55 2012 UTC (16 months, 1 week ago) by polynomial-c
Branch: MAIN
Changes since 1.24: +4 -3 lines
Added changes to mozcoreconf-2.eclass on request by Anarchy.

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

  ViewVC Help
Powered by ViewVC 1.1.20