/[gentoo-alt]/trunk/prefix/eclass/mozcoreconf.eclass
Gentoo

Contents of /trunk/prefix/eclass/mozcoreconf.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (hide annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 3 months ago) by kito
File size: 7530 byte(s)
Initial eclass import from gentoo-x86
1 kito 982 # Copyright 1999-2004 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: /var/cvsroot/gentoo-x86/eclass/mozcoreconf.eclass,v 1.5 2006/02/01 21:41:58 anarchy 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
9    
10     RDEPEND="|| ( ( x11-libs/libXrender
11     x11-libs/libXt
12     x11-libs/libXmu
13     )
14     virtual/x11
15     )
16     >=sys-libs/zlib-1.1.4"
17    
18     DEPEND="${RDEPEND}
19     dev-util/pkgconfig"
20    
21     # Set by configure (plus USE_AUTOCONF=1), but useful for NSPR
22     export MOZILLA_CLIENT=1
23     export BUILD_OPT=1
24     export NO_STATIC_LIB=1
25     export USE_PTHREADS=1
26    
27     mozconfig_init() {
28     declare enable_optimize pango_version myext x
29     declare MOZ=$([[ ${PN} == mozilla || ${PN} == gecko-sdk ]] && echo true || echo false)
30     declare FF=$([[ ${PN} == *firefox ]] && echo true || echo false)
31     declare TB=$([[ ${PN} == *thunderbird ]] && echo true || echo false)
32     declare SB=$([[ ${PN} == *sunbird ]] && echo true || echo false)
33     declare EM=$([[ ${PN} == enigmail ]] && echo true || echo false)
34    
35     ####################################
36     #
37     # Setup the initial .mozconfig
38     # See http://www.mozilla.org/build/configure-build.html
39     #
40     ####################################
41    
42     case ${PN} in
43     mozilla|gecko-sdk)
44     # The other builds have an initial --enable-extensions in their
45     # .mozconfig. The "default" set in configure applies to mozilla
46     # specifically.
47     : >.mozconfig || die "initial mozconfig creation failed"
48     mozconfig_annotate "" --enable-extensions=default ;;
49     *firefox)
50     cp browser/config/mozconfig .mozconfig \
51     || die "cp browser/config/mozconfig failed" ;;
52     enigmail)
53     cp mail/config/mozconfig .mozconfig \
54     || die "cp mail/config/mozconfig failed" ;;
55     *sunbird)
56     cp calendar/sunbird/config/mozconfig .mozconfig \
57     || die "cp calendar/sunbird/config/mozconfig failed" ;;
58     *thunderbird)
59     cp mail/config/mozconfig .mozconfig \
60     || die "cp mail/config/mozconfig failed" ;;
61     esac
62    
63     ####################################
64     #
65     # CFLAGS setup and ARCH support
66     #
67     ####################################
68    
69     # Set optimization level based on CFLAGS
70     if is-flag -O0; then
71     mozconfig_annotate "from CFLAGS" --enable-optimize=-O0
72     elif [[ ${ARCH} == hppa ]]; then
73     mozconfig_annotate "more than -O0 causes segfaults on hppa" --enable-optimize=-O0
74     elif [[ ${ARCH} == alpha || ${ARCH} == ia64 || ${ARCH} == ppc64 ]]; then
75     mozconfig_annotate "more than -O1 causes segfaults on 64-bit (bug 33767)" \
76     --enable-optimize=-O1
77     elif is-flag -O1; then
78     mozconfig_annotate "from CFLAGS" --enable-optimize=-O1
79     else
80     mozconfig_annotate "mozilla fallback" --enable-optimize=-O2
81     fi
82    
83     # Now strip optimization from CFLAGS so it doesn't end up in the
84     # compile string
85     filter-flags '-O*'
86    
87     # Strip over-aggressive CFLAGS - Mozilla supplies its own
88     # fine-tuned CFLAGS and shouldn't be interfered with.. Do this
89     # AFTER setting optimization above since strip-flags only allows
90     # -O -O1 and -O2
91     strip-flags
92    
93     # Additional ARCH support
94     case "${ARCH}" in
95     alpha)
96     # Historically we have needed to add -fPIC manually for 64-bit.
97     # Additionally, alpha should *always* build with -mieee for correct math
98     # operation
99     append-flags -fPIC -mieee
100     ;;
101    
102     amd64|ia64)
103     # Historically we have needed to add this manually for 64-bit
104     append-flags -fPIC
105     ;;
106    
107     ppc64)
108     append-flags -fPIC -mminimal-toc
109     ;;
110    
111     ppc)
112     # Fix to avoid gcc-3.3.x micompilation issues.
113     if [[ $(gcc-major-version).$(gcc-minor-version) == 3.3 ]]; then
114     append-flags -fno-strict-aliasing
115     fi
116     ;;
117    
118     sparc)
119     # Sparc support ...
120     replace-sparc64-flags
121     ;;
122    
123     x86)
124     if [[ $(gcc-major-version) -eq 3 ]]; then
125     # gcc-3 prior to 3.2.3 doesn't work well for pentium4
126     # see bug 25332
127     if [[ $(gcc-minor-version) -lt 2 ||
128     ( $(gcc-minor-version) -eq 2 && $(gcc-micro-version) -lt 3 ) ]]
129     then
130     replace-flags -march=pentium4 -march=pentium3
131     filter-flags -msse2
132     fi
133     fi
134     ;;
135     esac
136    
137     if [[ $(gcc-major-version) -eq 3 ]]; then
138     # Enable us to use flash, etc plugins compiled with gcc-2.95.3
139     mozconfig_annotate "building with >=gcc-3" --enable-old-abi-compat-wrappers
140    
141     # Needed to build without warnings on gcc-3
142     CXXFLAGS="${CXXFLAGS} -Wno-deprecated"
143     fi
144    
145     # Go a little faster; use less RAM
146     append-flags "$MAKEEDIT_FLAGS"
147    
148     ####################################
149     #
150     # mozconfig setup
151     #
152     ####################################
153    
154     mozconfig_annotate gentoo \
155     --disable-installer \
156     --disable-pedantic \
157     --enable-crypto \
158     --with-system-jpeg \
159     --with-system-png \
160     --with-system-zlib \
161     --disable-updater \
162     --enable-single-profile \
163     --disable-profilesharing \
164     --disable-profilelocking \
165     --enable-default-toolkit=gtk2 \
166     --enable-pango \
167     --enable-svg \
168     --enable-svg-renderer=cairo \
169     --enable-system-cairo
170    
171     # Here is a strange one...
172     if is-flag '-mcpu=ultrasparc*' || is-flag '-mtune=ultrasparc*'; then
173     mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc
174     fi
175     }
176    
177     # Simulate the silly csh makemake script
178     makemake() {
179     typeset m topdir
180     for m in $(find . -name Makefile.in); do
181     topdir=$(echo "$m" | sed -r 's:[^/]+:..:g')
182     sed -e "s:@srcdir@:.:g" -e "s:@top_srcdir@:${topdir}:g" \
183     < ${m} > ${m%.in} || die "sed ${m} failed"
184     done
185     }
186    
187     # mozconfig_annotate: add an annotated line to .mozconfig
188     #
189     # Example:
190     # mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc
191     # => ac_add_options --enable-js-ultrasparc # building on ultrasparc
192     mozconfig_annotate() {
193     declare reason=$1 x ; shift
194     [[ $# -gt 0 ]] || die "mozconfig_annotate missing flags for ${reason}\!"
195     for x in ${*}; do
196     echo "ac_add_options ${x} # ${reason}" >>.mozconfig
197     done
198     }
199    
200     # mozconfig_use_enable: add a line to .mozconfig based on a USE-flag
201     #
202     # Example:
203     # mozconfig_use_enable truetype freetype2
204     # => ac_add_options --enable-freetype2 # +truetype
205     mozconfig_use_enable() {
206     declare flag=$(use_enable "$@")
207     mozconfig_annotate "$(useq $1 && echo +$1 || echo -$1)" "${flag}"
208     }
209    
210     # mozconfig_use_with: add a line to .mozconfig based on a USE-flag
211     #
212     # Example:
213     # mozconfig_use_with kerberos gss-api /usr/$(get_libdir)
214     # => ac_add_options --with-gss-api=/usr/lib # +kerberos
215     mozconfig_use_with() {
216     declare flag=$(use_with "$@")
217     mozconfig_annotate "$(useq $1 && echo +$1 || echo -$1)" "${flag}"
218     }
219    
220     # mozconfig_use_extension: enable or disable an extension based on a USE-flag
221     #
222     # Example:
223     # mozconfig_use_extension gnome gnomevfs
224     # => ac_add_options --enable-extensions=gnomevfs
225     mozconfig_use_extension() {
226     declare minus=$(useq $1 || echo -)
227     mozconfig_annotate "${minus:-+}$1" --enable-extensions=${minus}${2}
228     }
229    
230     # mozconfig_final: display a table describing all configuration options paired
231     # with reasons, then clean up extensions list
232     mozconfig_final() {
233     declare ac opt hash reason
234     echo
235     echo "=========================================================="
236     echo "Building ${PF} with the following configuration"
237     grep ^ac_add_options .mozconfig | while read ac opt hash reason; do
238     [[ -z ${hash} || ${hash} == \# ]] \
239     || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}"
240     printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}"
241     done
242     echo "=========================================================="
243     echo
244    
245     # Resolve multiple --enable-extensions down to one
246     declare exts=$(sed -n 's/^ac_add_options --enable-extensions=\([^ ]*\).*/\1/p' \
247     .mozconfig | xargs)
248     sed -i '/^ac_add_options --enable-extensions/d' .mozconfig
249     echo "ac_add_options --enable-extensions=${exts// /,}" >> .mozconfig
250     }

  ViewVC Help
Powered by ViewVC 1.1.20