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

Contents of /eclass/mozcoreconf-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (hide annotations) (download)
Wed May 2 18:31:42 2012 UTC (2 years, 5 months ago) by jdhore
Branch: MAIN
Changes since 1.22: +3 -3 lines
dev-util/pkgconfig -> virtual/pkgconfig

1 jdhore 1.23 # Copyright 1999-2012 Gentoo Foundation
2 armin76 1.1 # Distributed under the terms of the GNU General Public License v2
3 jdhore 1.23 # $Header: /var/cvsroot/gentoo-x86/eclass/mozcoreconf-2.eclass,v 1.22 2011/08/29 01:28:10 vapier Exp $
4 armin76 1.1 #
5     # mozcoreconf.eclass : core options for mozilla
6     # inherit mozconfig-2 if you need USE flags
7    
8 nirbheek 1.18 inherit multilib flag-o-matic python
9 armin76 1.1
10 anarchy 1.20 IUSE="${IUSE} custom-cflags custom-optimization"
11 armin76 1.6
12 armin76 1.1 RDEPEND="x11-libs/libXrender
13     x11-libs/libXt
14     x11-libs/libXmu
15     >=sys-libs/zlib-1.1.4"
16    
17     DEPEND="${RDEPEND}
18 jdhore 1.23 virtual/pkgconfig
19 nirbheek 1.18 =dev-lang/python-2*[threads]"
20 armin76 1.1
21 nirbheek 1.18 # 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 ssuominen 1.21 mozconfig_annotate "$(use $1 && echo +$1 || echo -$1)" "${flag}"
42 nirbheek 1.18 }
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 ssuominen 1.21 mozconfig_annotate "$(use $1 && echo +$1 || echo -$1)" "${flag}"
52 nirbheek 1.18 }
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 ssuominen 1.21 declare minus=$(use $1 || echo -)
61 nirbheek 1.18 mozconfig_annotate "${minus:-+}$1" --enable-extensions=${minus}${2}
62     }
63    
64     moz_pkgsetup() {
65     # Ensure we use C locale when building
66     export LANG="C"
67     export LC_ALL="C"
68     export LC_MESSAGES="C"
69     export LC_CTYPE="C"
70    
71     # Ensure that we have a sane build enviroment
72     export MOZILLA_CLIENT=1
73     export BUILD_OPT=1
74     export NO_STATIC_LIB=1
75     export USE_PTHREADS=1
76     export ALDFLAGS=${LDFLAGS}
77    
78     python_set_active_version 2
79     }
80 armin76 1.1
81     mozconfig_init() {
82     declare enable_optimize pango_version myext x
83 nirbheek 1.18 declare XUL=$([[ ${PN} == xulrunner ]] && echo true || echo false)
84     declare FF=$([[ ${PN} == firefox ]] && echo true || echo false)
85     declare IC=$([[ ${PN} == icecat ]] && echo true || echo false)
86     declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false)
87     declare TB=$([[ ${PN} == thunderbird ]] && echo true || echo false)
88 armin76 1.1 declare EM=$([[ ${PN} == enigmail ]] && echo true || echo false)
89 nirbheek 1.18
90 armin76 1.1
91     ####################################
92     #
93     # Setup the initial .mozconfig
94     # See http://www.mozilla.org/build/configure-build.html
95     #
96     ####################################
97    
98     case ${PN} in
99 nirbheek 1.18 *xulrunner)
100     cp xulrunner/config/mozconfig .mozconfig \
101     || die "cp xulrunner/config/mozconfig failed" ;;
102 armin76 1.1 *firefox)
103     cp browser/config/mozconfig .mozconfig \
104     || die "cp browser/config/mozconfig failed" ;;
105 nirbheek 1.18 *icecat)
106     cp browser/config/mozconfig .mozconfig \
107     || die "cp browser/config/mozconfig failed" ;;
108     seamonkey)
109     # Must create the initial mozconfig to enable application
110     : >.mozconfig || die "initial mozconfig creation failed"
111     mozconfig_annotate "" --enable-application=suite ;;
112     *thunderbird)
113     # Must create the initial mozconfig to enable application
114     : >.mozconfig || die "initial mozconfig creation failed"
115     mozconfig_annotate "" --enable-application=mail ;;
116 armin76 1.1 enigmail)
117     cp mail/config/mozconfig .mozconfig \
118     || die "cp mail/config/mozconfig failed" ;;
119     esac
120    
121     ####################################
122     #
123     # CFLAGS setup and ARCH support
124     #
125     ####################################
126    
127 armin76 1.6 # Set optimization level
128 jer 1.19 if [[ ${ARCH} == hppa ]]; then
129     mozconfig_annotate "more than -O0 causes a segfault on hppa" --enable-optimize=-O0
130     elif [[ ${ARCH} == x86 ]]; then
131 anarchy 1.14 mozconfig_annotate "less then -O2 causes a segfault on x86" --enable-optimize=-O2
132 nirbheek 1.16 elif use custom-optimization || [[ ${ARCH} =~ (alpha|ia64) ]]; then
133 armin76 1.6 # Set optimization level based on CFLAGS
134     if is-flag -O0; then
135     mozconfig_annotate "from CFLAGS" --enable-optimize=-O0
136     elif [[ ${ARCH} == ppc ]] && has_version '>=sys-libs/glibc-2.8'; then
137     mozconfig_annotate "more than -O1 segfaults on ppc with glibc-2.8" --enable-optimize=-O1
138     elif is-flag -O1; then
139     mozconfig_annotate "from CFLAGS" --enable-optimize=-O1
140     elif is-flag -Os; then
141     mozconfig_annotate "from CFLAGS" --enable-optimize=-Os
142 armin76 1.7 else
143     mozconfig_annotate "Gentoo's default optimization" --enable-optimize=-O2
144 armin76 1.6 fi
145 armin76 1.1 else
146 armin76 1.6 # Enable Mozilla's default
147     mozconfig_annotate "mozilla default" --enable-optimize
148 armin76 1.1 fi
149    
150 nirbheek 1.18 # Strip optimization so it does not end up in compile string
151 armin76 1.1 filter-flags '-O*'
152    
153 vapier 1.22 # Strip over-aggressive CFLAGS
154 anarchy 1.20 use custom-cflags || strip-flags
155 armin76 1.1
156     # Additional ARCH support
157     case "${ARCH}" in
158     alpha)
159     # Historically we have needed to add -fPIC manually for 64-bit.
160     # Additionally, alpha should *always* build with -mieee for correct math
161     # operation
162     append-flags -fPIC -mieee
163     ;;
164    
165 anarchy 1.17 ia64)
166 armin76 1.1 # Historically we have needed to add this manually for 64-bit
167     append-flags -fPIC
168     ;;
169    
170     ppc64)
171     append-flags -fPIC -mminimal-toc
172     ;;
173    
174     ppc)
175     # Fix to avoid gcc-3.3.x micompilation issues.
176     if [[ $(gcc-major-version).$(gcc-minor-version) == 3.3 ]]; then
177     append-flags -fno-strict-aliasing
178     fi
179     ;;
180    
181     x86)
182     if [[ $(gcc-major-version) -eq 3 ]]; then
183     # gcc-3 prior to 3.2.3 doesn't work well for pentium4
184     # see bug 25332
185     if [[ $(gcc-minor-version) -lt 2 ||
186     ( $(gcc-minor-version) -eq 2 && $(gcc-micro-version) -lt 3 ) ]]
187     then
188     replace-flags -march=pentium4 -march=pentium3
189     filter-flags -msse2
190     fi
191     fi
192     ;;
193     esac
194    
195     if [[ $(gcc-major-version) -eq 3 ]]; then
196     # Enable us to use flash, etc plugins compiled with gcc-2.95.3
197     mozconfig_annotate "building with >=gcc-3" --enable-old-abi-compat-wrappers
198    
199     # Needed to build without warnings on gcc-3
200     CXXFLAGS="${CXXFLAGS} -Wno-deprecated"
201     fi
202    
203     # Go a little faster; use less RAM
204     append-flags "$MAKEEDIT_FLAGS"
205    
206     ####################################
207     #
208     # mozconfig setup
209     #
210     ####################################
211    
212 nirbheek 1.18 mozconfig_annotate system_libs \
213 armin76 1.1 --with-system-jpeg \
214     --with-system-zlib \
215     --enable-pango \
216     --enable-svg \
217 nirbheek 1.18 --enable-system-cairo
218     # Requires libpng with apng support
219     #--with-system-png \
220    
221     mozconfig_annotate disable_update_strip \
222     --disable-installer \
223     --disable-pedantic \
224     --disable-updater \
225 armin76 1.1 --disable-strip \
226 armin76 1.2 --disable-strip-libs \
227 nirbheek 1.18 --disable-install-strip
228    
229 armin76 1.1
230    
231     if [[ ${PN} != seamonkey ]]; then
232 nirbheek 1.18 mozconfig_annotate basic_profile \
233 armin76 1.1 --enable-single-profile \
234     --disable-profilesharing \
235     --disable-profilelocking
236     fi
237    
238     # Here is a strange one...
239     if is-flag '-mcpu=ultrasparc*' || is-flag '-mtune=ultrasparc*'; then
240     mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc
241     fi
242 armin76 1.3
243 nirbheek 1.18 # Currently --enable-elf-dynstr-gc only works for x86,
244     # thanks to Jason Wever <weeve@gentoo.org> for the fix.
245     if use x86 && [[ ${enable_optimize} != -O0 ]]; then
246     mozconfig_annotate "${ARCH} optimized build" --enable-elf-dynstr-gc
247     fi
248    
249 armin76 1.3 # jemalloc won't build with older glibc
250     ! has_version ">=sys-libs/glibc-2.4" && mozconfig_annotate "we have old glibc" --disable-jemalloc
251 armin76 1.1 }
252    
253     makemake2() {
254     for m in $(find ../ -name Makefile.in); do
255     topdir=$(echo "$m" | sed -r 's:[^/]+:..:g')
256     sed -e "s:@srcdir@:.:g" -e "s:@top_srcdir@:${topdir}:g" \
257     < ${m} > ${m%.in} || die "sed ${m} failed"
258     done
259     }
260    
261     # mozconfig_final: display a table describing all configuration options paired
262     # with reasons, then clean up extensions list
263     mozconfig_final() {
264     declare ac opt hash reason
265     echo
266     echo "=========================================================="
267     echo "Building ${PF} with the following configuration"
268     grep ^ac_add_options .mozconfig | while read ac opt hash reason; do
269     [[ -z ${hash} || ${hash} == \# ]] \
270     || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}"
271     printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}"
272     done
273     echo "=========================================================="
274     echo
275    
276     # Resolve multiple --enable-extensions down to one
277     declare exts=$(sed -n 's/^ac_add_options --enable-extensions=\([^ ]*\).*/\1/p' \
278     .mozconfig | xargs)
279     sed -i '/^ac_add_options --enable-extensions/d' .mozconfig
280     echo "ac_add_options --enable-extensions=${exts// /,}" >> .mozconfig
281     }

  ViewVC Help
Powered by ViewVC 1.1.20