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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20