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

Contents of /eclass/mozcoreconf-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (show annotations) (download)
Wed Jan 16 19:02:10 2013 UTC (19 months, 2 weeks ago) by mgorny
Branch: MAIN
Changes since 1.26: +9 -6 lines
Migrate Mozilla packages to python-any-r1 for build-time Python dep.

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

  ViewVC Help
Powered by ViewVC 1.1.20