/[gentoo-x86]/sys-devel/gcc/gcc-3.2.2.ebuild
Gentoo

Contents of /sys-devel/gcc/gcc-3.2.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Tue Feb 25 13:50:16 2003 UTC (11 years, 10 months ago) by dragon
Branch: MAIN
Changes since 1.10: +2 -2 lines
Fix breakage for mips.

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2.ebuild,v 1.10 2003/02/24 20:35:36 dragon Exp $
4
5 IUSE="static nls bootstrap java build"
6
7 inherit eutils flag-o-matic libtool
8
9 # Compile problems with these (bug #6641 among others)...
10 filter-flags "-fno-exceptions -fomit-frame-pointer"
11
12 # Recently there has been a lot of stability problem in Gentoo-land. Many
13 # things can be the cause to this, but I believe that it is due to gcc3
14 # still having issues with optimizations, or with it not filtering bad
15 # combinations (protecting the user maybe from himeself) yet.
16 #
17 # This can clearly be seen in large builds like glibc, where too aggressive
18 # CFLAGS cause the tests to fail miserbly.
19 #
20 # Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
21 # knows what he is talking about:
22 #
23 # People really shouldn't force code-specific options on... It's a
24 # bad idea. The -march options aren't just to look pretty. They enable
25 # options that are sensible (and include sse,mmx,3dnow when apropriate).
26 #
27 # The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
28 # you do not like it, comment it, but do not bugreport if you run into
29 # problems.
30 #
31 # <azarah@gentoo.org> (13 Oct 2002)
32 strip-flags
33
34 # Theoretical cross compiler support
35 [ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
36
37 LOC="/usr"
38 MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
39 MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
40
41 LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
42 BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
43 DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
44 # Dont install in /usr/include/g++-v3/, but in gcc internal directory.
45 # We will handle /usr/include/g++-v3/ with gcc-config ...
46 STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
47
48 # Patch tarball support ...
49 #PATCH_VER="1.0"
50 PATCH_VER=""
51
52 # Snapshot support ...
53 #SNAPSHOT="2002-08-12"
54 SNAPSHOT=""
55
56 # Branch update support ...
57 MAIN_BRANCH="${PV}" # Tarball, etc used ...
58 #BRANCH_UPDATE="20021208"
59 BRANCH_UPDATE=""
60
61 if [ -z "${SNAPSHOT}" ]
62 then
63 S="${WORKDIR}/${PN}-${MAIN_BRANCH}"
64 SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${PN}-${MAIN_BRANCH}.tar.bz2"
65
66 if [ -n "${PATCH_VER}" ]
67 then
68 SRC_URI="${SRC_URI}
69 mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
70 fi
71
72 if [ -n "${BRANCH_UPDATE}" ]
73 then
74 SRC_URI="${SRC_URI}
75 mirror://gentoo/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2"
76 fi
77 else
78 S="${WORKDIR}/gcc-${SNAPSHOT//-}"
79 SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
80 fi
81 #SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
82
83 DESCRIPTION="The GNU Compiler Collection. Includes C/C++ and java compilers"
84 HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
85
86 LICENSE="GPL-2 LGPL-2.1"
87 KEYWORDS="x86 ~ppc ~sparc alpha hppa arm mips"
88
89 # Ok, this is a hairy one again, but lets assume that we
90 # are not cross compiling, than we want SLOT to only contain
91 # $PV, as people upgrading to new gcc layout will not have
92 # their old gcc unmerged ...
93 if [ "${CHOST}" == "${CCHOST}" ]
94 then
95 SLOT="${MY_PV}"
96 else
97 SLOT="${CCHOST}-${MY_PV}"
98 fi
99
100 DEPEND="virtual/glibc
101 mips? >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18
102 >=sys-devel/gcc-config-1.3.1
103 !build? ( >=sys-libs/ncurses-5.2-r2
104 nls? ( sys-devel/gettext ) )"
105
106 RDEPEND="virtual/glibc
107 >=sys-devel/gcc-config-1.3.1
108 >=sys-libs/zlib-1.1.4
109 >=sys-apps/texinfo-4.2-r4
110 !build? ( >=sys-libs/ncurses-5.2-r2 )"
111
112 PDEPEND="sys-devel/gcc-config"
113
114
115 # Hack used to patch Makefiles to install into the build dir
116 FAKE_ROOT=""
117
118 src_unpack() {
119 if [ -z "${SNAPSHOT}" ]
120 then
121 unpack ${PN}-${MAIN_BRANCH}.tar.bz2
122
123 if [ -n "${PATCH_VER}" ]
124 then
125 unpack ${P}-patches-${PATCH_VER}.tar.bz2
126 fi
127 else
128 unpack gcc-${SNAPSHOT//-}.tar.bz2
129 fi
130
131 cd ${S}
132 # Fixup libtool to correctly generate .la files with portage
133 elibtoolize --portage --shallow
134
135 echo
136
137 # Branch update ...
138 if [ -n "${BRANCH_UPDATE}" ]
139 then
140 epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2
141 fi
142
143 # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
144 if [ -n "${PATCH_VER}" ]
145 then
146 epatch ${WORKDIR}/patch
147 fi
148
149 # Patches from Redhat ...
150 epatch ${FILESDIR}/3.2.1/gcc32-ada-make.patch
151 epatch ${FILESDIR}/3.2.1/gcc32-shared-pthread.patch
152 use sparc && epatch ${FILESDIR}/3.2.1/gcc32-sparc32-hack.patch
153
154 # Patches from Mandrake/Suse ...
155 epatch ${FILESDIR}/3.2.1/gcc31-loop-load-final-value.patch
156 epatch ${FILESDIR}/3.2.1/gcc32-pr8213.patch
157 epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch
158 epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch
159
160 # Patches from debian-arm
161 if [ "${ARCH}" = "arm" ]; then
162 epatch ${FILESDIR}/3.2.1/gcc32-arm-disable-mathf.patch
163 epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch
164 fi
165
166 # Install our pre generated manpages if we do not have perl ...
167 # if [ ! -x /usr/bin/perl ]
168 # then
169 # cd ${S}; unpack ${P}-manpages.tar.bz2
170 # fi
171
172 # Currently if any path is changed via the configure script, it breaks
173 # installing into ${D}. We should not patch it in src_install() with
174 # absolute paths, as some modules then gets rebuild with the wrong
175 # paths. Thus we use $FAKE_ROOT.
176 einfo "Fixing Makefiles..."
177 cd ${S}
178 for x in $(find . -name Makefile.in)
179 do
180 # Fix --datadir=
181 cp ${x} ${x}.orig
182 sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
183 ${x}.orig > ${x}
184
185 # Fix --bindir=
186 cp ${x} ${x}.orig
187 sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
188 ${x}.orig > ${x}
189
190 # Fix --includedir=
191 cp ${x} ${x}.orig
192 sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
193 ${x}.orig > ${x}
194
195 # Fix --with-gxx-include-dir=
196 cp ${x} ${x}.orig
197 sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
198 -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
199 ${x}.orig > ${x}
200
201 # Where java security stuff should be installed
202 cp ${x} ${x}.orig
203 sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
204 ${x}.orig > ${x}
205
206 rm -f ${x}.orig
207 done
208
209 # This next bit is for updating libtool linker scripts ...
210 OLD_GCC_VERSION="`gcc -dumpversion`"
211
212 if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
213 then
214 echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
215 fi
216 }
217
218 src_compile() {
219 local myconf=""
220 local gcc_lang=""
221
222 if [ -z "`use build`" ]
223 then
224 myconf="${myconf} --enable-shared"
225 gcc_lang="c,c++,ada,f77,objc"
226 else
227 gcc_lang="c"
228 fi
229 if [ -z "`use nls`" ] || [ "`use build`" ]
230 then
231 myconf="${myconf} --disable-nls"
232 else
233 myconf="${myconf} --enable-nls --without-included-gettext"
234 fi
235 if [ -n "`use java`" ] && [ -z "`use build`" ]
236 then
237 gcc_lang="${gcc_lang},java"
238 fi
239
240 # In general gcc does not like optimization, and add -O2 where
241 # it is safe.
242 export CFLAGS="${CFLAGS//-O?}"
243 export CXXFLAGS="${CXXFLAGS//-O?}"
244
245 # Build in a separate build tree
246 mkdir -p ${WORKDIR}/build
247 cd ${WORKDIR}/build
248
249 einfo "Configuring GCC..."
250 addwrite "/dev/zero"
251 ${S}/configure --prefix=${LOC} \
252 --bindir=${BINPATH} \
253 --includedir=${LIBPATH}/include \
254 --datadir=${DATAPATH} \
255 --mandir=${DATAPATH}/man \
256 --infodir=${DATAPATH}/info \
257 --enable-shared \
258 --host=${CHOST} \
259 --target=${CCHOST} \
260 --with-system-zlib \
261 --enable-languages=${gcc_lang} \
262 --enable-threads=posix \
263 --enable-long-long \
264 --disable-checking \
265 --enable-cstdio=stdio \
266 --enable-clocale=generic \
267 --enable-__cxa_atexit \
268 --enable-version-specific-runtime-libs \
269 --with-gxx-include-dir=${STDCXX_INCDIR} \
270 --with-local-prefix=${LOC}/local \
271 ${myconf} || die
272
273 touch ${S}/gcc/c-gperf.h
274
275 # Do not make manpages if we do not have perl ...
276 if [ ! -x /usr/bin/perl ]
277 then
278 find ${S} -name '*.[17]' -exec touch {} \; || :
279 fi
280
281 # Setup -j in MAKEOPTS
282 get_number_of_jobs
283
284 einfo "Building GCC..."
285 if [ -z "`use static`" ]
286 then
287 # Fix for our libtool-portage.patch
288 S="${WORKDIR}/build" \
289 emake bootstrap-lean \
290 LIBPATH="${LIBPATH}" \
291 BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
292 # Above FLAGS optimize and speedup build, thanks
293 # to Jeff Garzik <jgarzik@mandrakesoft.com>
294 else
295 S="${WORKDIR}/build" \
296 emake LDFLAGS=-static bootstrap \
297 LIBPATH="${LIBPATH}" \
298 BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
299 fi
300 }
301
302 src_install() {
303 # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
304 # this can break the build.
305 for x in cd ${WORKDIR}/build/gcc/include/*
306 do
307 if [ -L ${x} ]
308 then
309 rm -f ${x}
310 fi
311 done
312
313 einfo "Installing GCC..."
314 # Do the 'make install' from the build directory
315 cd ${WORKDIR}/build
316 S="${WORKDIR}/build" \
317 make prefix=${D}${LOC} \
318 bindir=${D}${BINPATH} \
319 includedir=${D}${LIBPATH}/include \
320 datadir=${D}${DATAPATH} \
321 mandir=${D}${DATAPATH}/man \
322 infodir=${D}${DATAPATH}/info \
323 LIBPATH="${LIBPATH}" \
324 FAKE_ROOT="${D}" \
325 install || die
326
327 [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
328
329 dodir /lib /usr/bin
330 dodir /etc/env.d/gcc
331 echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
332 echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
333 echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
334 echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
335 echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
336 echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
337 # Also set CC and CXX
338 echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
339 echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
340
341 # Install wrappers
342 # Handled by gcc-config now ...
343 # exeinto /lib
344 # doexe ${FILESDIR}/cpp
345 # exeinto /usr/bin
346 # doexe ${FILESDIR}/cc
347
348 # This should be invalidated by the linker scripts we have as the latest
349 # fix for bug #4411
350 #
351 # # gcc-3.1 have a problem with the ordering of Search Directories. For
352 # # instance, if you have libreadline.so in /lib, and libreadline.a in
353 # # /usr/lib, then it will link with libreadline.a instead of .so. As far
354 # # as I can see from the source, /lib should be searched before /usr/lib,
355 # # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
356 # # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
357 # # bugzilla bug #4411
358 # #
359 # # Azarah - 3 Jul 2002
360 # #
361 # cd ${D}${LIBPATH}
362 # dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
363 # ${LIBPATH}/specs
364
365 # Make sure we dont have stuff lying around that
366 # can nuke multiple versions of gcc
367 if [ -z "`use build`" ]
368 then
369 cd ${D}${LIBPATH}
370
371 # Tell libtool files where real libraries are
372 for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
373 do
374 if [ -f ${LA} ]
375 then
376 sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
377 mv ${LA}.hacked ${LA}
378 mv ${LA} ${D}${LIBPATH}
379 fi
380 done
381
382 # Move all the libraries to version specific libdir.
383 for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
384 do
385 [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
386 done
387
388 # Move Java headers to compiler-specific dir
389 for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
390 do
391 [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
392 done
393 for x in gcj gnu java javax org
394 do
395 if [ -d ${D}${LOC}/include/${x} ]
396 then
397 dodir /${LIBPATH}/include/${x}
398 mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
399 rm -rf ${D}${LOC}/include/${x}
400 fi
401 done
402
403 # Move libgcj.spec to compiler-specific directories
404 [ -f ${D}${LOC}/lib/libgcj.spec ] && \
405 mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
406
407 # Rename jar because it could clash with Kaffe's jar if this gcc is
408 # primary compiler (aka don't have the -<version> extension)
409 cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
410 [ -f jar ] && mv -f jar gcj-jar
411
412 # Move <cxxabi.h> to compiler-specific directories
413 [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
414 mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
415
416 # These should be symlinks
417 cd ${D}${BINPATH}
418 rm -f ${CCHOST}-{gcc,g++,c++,g77}
419 [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
420 [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
421 [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
422 [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
423 fi
424
425 # This one comes with binutils
426 if [ -f ${D}${LOC}/lib/libiberty.a ]
427 then
428 rm -f ${D}${LOC}/lib/libiberty.a
429 fi
430
431 cd ${S}
432 if [ -z "`use build`" ]
433 then
434 cd ${S}
435 docinto /${CCHOST}
436 dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
437 docinto ${CCHOST}/html
438 dohtml *.html
439 cd ${S}/boehm-gc
440 docinto ${CCHOST}/boehm-gc
441 dodoc ChangeLog doc/{README*,barrett_diagram}
442 docinto ${CCHOST}/boehm-gc/html
443 dohtml doc/*.html
444 cd ${S}/gcc
445 docinto ${CCHOST}/gcc
446 dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
447 cd ${S}/libf2c
448 docinto ${CCHOST}/libf2c
449 dodoc ChangeLog README TODO *.netlib
450 cd ${S}/libffi
451 docinto ${CCHOST}/libffi
452 dodoc ChangeLog* LICENSE README
453 cd ${S}/libiberty
454 docinto ${CCHOST}/libiberty
455 dodoc ChangeLog COPYING.LIB README
456 cd ${S}/libobjc
457 docinto ${CCHOST}/libobjc
458 dodoc ChangeLog README* THREADS*
459 cd ${S}/libstdc++-v3
460 docinto ${CCHOST}/libstdc++-v3
461 dodoc ChangeLog* README
462 docinto ${CCHOST}/libstdc++-v3/html
463 dohtml -r -a css,diff,html,txt,xml docs/html/*
464 cp -f docs/html/17_intro/[A-Z]* \
465 ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
466
467 if [ -n "`use java`" ]
468 then
469 cd ${S}/fastjar
470 docinto ${CCHOST}/fastjar
471 dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
472 cd ${S}/libjava
473 docinto ${CCHOST}/libjava
474 dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
475 fi
476 else
477 rm -rf ${D}/usr/share/{man,info}
478 fi
479
480 # Fix ncurses b0rking
481 find ${D}/ -name '*curses.h' -exec rm -f {} \;
482 }
483
484 pkg_postinst() {
485
486 if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" == "${CCHOST}" ]
487 then
488 gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
489 fi
490
491 # Update libtool linker scripts to reference new gcc version ...
492 if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
493 then
494 OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
495
496 cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
497 chmod +x ${T}/fix_libtool_files.sh
498 ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
499 fi
500
501 # Fix ncurses b0rking (if r5 isn't unmerged)
502 find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
503 }

  ViewVC Help
Powered by ViewVC 1.1.20