/[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.1 Revision 1.1.1.1
1# Copyright 1999-2002 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.1 2003/02/05 23:54:47 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/Attic/gcc-3.2.2.ebuild,v 1.1.1.1 2005/11/30 09:53:42 chriswhite 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"
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 >=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 23
118src_unpack() { 24src_unpack() {
119 if [ -z "${SNAPSHOT}" ] 25 gcc_src_unpack
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 26
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 27 epatch "${FILESDIR}"/3.2.2/gcc32-pr7768.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 28 epatch "${FILESDIR}"/3.2.2/gcc32-pr8213.patch
157 epatch ${FILESDIR}/3.2.1/gcc32-strip-dotdot.patch 29 epatch "${FILESDIR}"/3.2.2/gcc-3.2.2-cross-compile.patch
158 epatch ${FILESDIR}/3.2.1/gcc32-athlon-alignment.patch 30 epatch "${FILESDIR}"/3.2.2/gcc-3.2.2-no-COPYING-cross-compile.patch
159
160 # Install our pre generated manpages if we do not have perl ...
161# if [ ! -x /usr/bin/perl ]
162# then
163# cd ${S}; unpack ${P}-manpages.tar.bz2
164# fi
165
166 # Currently if any path is changed via the configure script, it breaks
167 # installing into ${D}. We should not patch it in src_install() with
168 # absolute paths, as some modules then gets rebuild with the wrong
169 # paths. Thus we use $FAKE_ROOT.
170 einfo "Fixing Makefiles..."
171 cd ${S}
172 for x in $(find . -name Makefile.in)
173 do
174 # Fix --datadir=
175 cp ${x} ${x}.orig
176 sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
177 ${x}.orig > ${x}
178
179 # Fix --bindir=
180 cp ${x} ${x}.orig
181 sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
182 ${x}.orig > ${x}
183
184 # Fix --includedir=
185 cp ${x} ${x}.orig
186 sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
187 ${x}.orig > ${x}
188
189 # Fix --with-gxx-include-dir=
190 cp ${x} ${x}.orig
191 sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
192 -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
193 ${x}.orig > ${x}
194
195 # Where java security stuff should be installed
196 cp ${x} ${x}.orig
197 sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
198 ${x}.orig > ${x}
199
200 rm -f ${x}.orig
201 done
202
203 # This next bit is for updating libtool linker scripts ...
204 OLD_GCC_VERSION="`gcc -dumpversion`"
205
206 if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
207 then
208 echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
209 fi
210} 31}
211
212src_compile() {
213 local myconf=""
214 local gcc_lang=""
215
216 if [ -z "`use build`" ]
217 then
218 myconf="${myconf} --enable-shared"
219 gcc_lang="c,c++,ada,f77,objc"
220 else
221 gcc_lang="c"
222 fi
223 if [ -z "`use nls`" ] || [ "`use build`" ]
224 then
225 myconf="${myconf} --disable-nls"
226 else
227 myconf="${myconf} --enable-nls --without-included-gettext"
228 fi
229 if [ -n "`use java`" ] && [ -z "`use build`" ]
230 then
231 gcc_lang="${gcc_lang},java"
232 fi
233
234 # In general gcc does not like optimization, and add -O2 where
235 # it is safe.
236 export CFLAGS="${CFLAGS//-O?}"
237 export CXXFLAGS="${CXXFLAGS//-O?}"
238
239 # Build in a separate build tree
240 mkdir -p ${WORKDIR}/build
241 cd ${WORKDIR}/build
242
243 einfo "Configuring GCC..."
244 addwrite "/dev/zero"
245 ${S}/configure --prefix=${LOC} \
246 --bindir=${BINPATH} \
247 --includedir=${LIBPATH}/include \
248 --datadir=${DATAPATH} \
249 --mandir=${DATAPATH}/man \
250 --infodir=${DATAPATH}/info \
251 --enable-shared \
252 --host=${CHOST} \
253 --target=${CCHOST} \
254 --with-system-zlib \
255 --enable-languages=${gcc_lang} \
256 --enable-threads=posix \
257 --enable-long-long \
258 --disable-checking \
259 --enable-cstdio=stdio \
260 --enable-clocale=generic \
261 --enable-__cxa_atexit \
262 --enable-version-specific-runtime-libs \
263 --with-gxx-include-dir=${STDCXX_INCDIR} \
264 --with-local-prefix=${LOC}/local \
265 ${myconf} || die
266
267 touch ${S}/gcc/c-gperf.h
268
269 # Do not make manpages if we do not have perl ...
270 if [ ! -x /usr/bin/perl ]
271 then
272 find ${S} -name '*.[17]' -exec touch {} \; || :
273 fi
274
275 # Setup -j in MAKEOPTS
276 get_number_of_jobs
277
278 einfo "Building GCC..."
279 if [ -z "`use static`" ]
280 then
281 # Fix for our libtool-portage.patch
282 S="${WORKDIR}/build" \
283 emake bootstrap-lean \
284 LIBPATH="${LIBPATH}" \
285 BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
286 # Above FLAGS optimize and speedup build, thanks
287 # to Jeff Garzik <jgarzik@mandrakesoft.com>
288 else
289 S="${WORKDIR}/build" \
290 emake LDFLAGS=-static bootstrap \
291 LIBPATH="${LIBPATH}" \
292 BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
293 fi
294}
295
296src_install() {
297 # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
298 # this can break the build.
299 for x in cd ${WORKDIR}/build/gcc/include/*
300 do
301 if [ -L ${x} ]
302 then
303 rm -f ${x}
304 fi
305 done
306
307 einfo "Installing GCC..."
308 # Do the 'make install' from the build directory
309 cd ${WORKDIR}/build
310 S="${WORKDIR}/build" \
311 make prefix=${D}${LOC} \
312 bindir=${D}${BINPATH} \
313 includedir=${D}${LIBPATH}/include \
314 datadir=${D}${DATAPATH} \
315 mandir=${D}${DATAPATH}/man \
316 infodir=${D}${DATAPATH}/info \
317 LIBPATH="${LIBPATH}" \
318 FAKE_ROOT="${D}" \
319 install || die
320
321 [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
322
323 dodir /lib /usr/bin
324 dodir /etc/env.d/gcc
325 echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
326 echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
327 echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
328 echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
329 echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
330 echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
331 # Also set CC and CXX
332 echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
333 echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
334
335 # Install wrappers
336# Handled by gcc-config now ...
337# exeinto /lib
338# doexe ${FILESDIR}/cpp
339# exeinto /usr/bin
340# doexe ${FILESDIR}/cc
341
342# This should be invalidated by the linker scripts we have as the latest
343# fix for bug #4411
344#
345# # gcc-3.1 have a problem with the ordering of Search Directories. For
346# # instance, if you have libreadline.so in /lib, and libreadline.a in
347# # /usr/lib, then it will link with libreadline.a instead of .so. As far
348# # as I can see from the source, /lib should be searched before /usr/lib,
349# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
350# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
351# # bugzilla bug #4411
352# #
353# # Azarah - 3 Jul 2002
354# #
355# cd ${D}${LIBPATH}
356# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
357# ${LIBPATH}/specs
358
359 # Make sure we dont have stuff lying around that
360 # can nuke multiple versions of gcc
361 if [ -z "`use build`" ]
362 then
363 cd ${D}${LIBPATH}
364
365 # Tell libtool files where real libraries are
366 for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
367 do
368 if [ -f ${LA} ]
369 then
370 sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
371 mv ${LA}.hacked ${LA}
372 mv ${LA} ${D}${LIBPATH}
373 fi
374 done
375
376 # Move all the libraries to version specific libdir.
377 for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
378 do
379 [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
380 done
381
382 # Move Java headers to compiler-specific dir
383 for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
384 do
385 [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
386 done
387 for x in gcj gnu java javax org
388 do
389 if [ -d ${D}${LOC}/include/${x} ]
390 then
391 dodir /${LIBPATH}/include/${x}
392 mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
393 rm -rf ${D}${LOC}/include/${x}
394 fi
395 done
396
397 # Move libgcj.spec to compiler-specific directories
398 [ -f ${D}${LOC}/lib/libgcj.spec ] && \
399 mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
400
401 # Rename jar because it could clash with Kaffe's jar if this gcc is
402 # primary compiler (aka don't have the -<version> extension)
403 cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
404 [ -f jar ] && mv -f jar gcj-jar
405
406 # Move <cxxabi.h> to compiler-specific directories
407 [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
408 mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
409
410 # These should be symlinks
411 cd ${D}${BINPATH}
412 rm -f ${CCHOST}-{gcc,g++,c++,g77}
413 [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
414 [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
415 [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
416 [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
417 fi
418
419 # This one comes with binutils
420 if [ -f ${D}${LOC}/lib/libiberty.a ]
421 then
422 rm -f ${D}${LOC}/lib/libiberty.a
423 fi
424
425 cd ${S}
426 if [ -z "`use build`" ]
427 then
428 cd ${S}
429 docinto /${CCHOST}
430 dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
431 docinto ${CCHOST}/html
432 dohtml *.html
433 cd ${S}/boehm-gc
434 docinto ${CCHOST}/boehm-gc
435 dodoc ChangeLog doc/{README*,barrett_diagram}
436 docinto ${CCHOST}/boehm-gc/html
437 dohtml doc/*.html
438 cd ${S}/gcc
439 docinto ${CCHOST}/gcc
440 dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
441 cd ${S}/libf2c
442 docinto ${CCHOST}/libf2c
443 dodoc ChangeLog README TODO *.netlib
444 cd ${S}/libffi
445 docinto ${CCHOST}/libffi
446 dodoc ChangeLog* LICENSE README
447 cd ${S}/libiberty
448 docinto ${CCHOST}/libiberty
449 dodoc ChangeLog COPYING.LIB README
450 cd ${S}/libobjc
451 docinto ${CCHOST}/libobjc
452 dodoc ChangeLog README* THREADS*
453 cd ${S}/libstdc++-v3
454 docinto ${CCHOST}/libstdc++-v3
455 dodoc ChangeLog* README
456 docinto ${CCHOST}/libstdc++-v3/html
457 dohtml -r -a css,diff,html,txt,xml docs/html/*
458 cp -f docs/html/17_intro/[A-Z]* \
459 ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
460
461 if [ -n "`use java`" ]
462 then
463 cd ${S}/fastjar
464 docinto ${CCHOST}/fastjar
465 dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
466 cd ${S}/libjava
467 docinto ${CCHOST}/libjava
468 dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
469 fi
470 else
471 rm -rf ${D}/usr/share/{man,info}
472 fi
473
474 # Fix ncurses b0rking
475 find ${D}/ -name '*curses.h' -exec rm -f {} \;
476}
477
478pkg_postinst() {
479
480 if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" == "${CCHOST}" ]
481 then
482 gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
483 fi
484
485 # Update libtool linker scripts to reference new gcc version ...
486 if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
487 then
488 OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
489
490 cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
491 chmod +x ${T}/fix_libtool_files.sh
492 ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
493 fi
494
495 # Fix ncurses b0rking (if r5 isn't unmerged)
496 find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
497}
498

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.1.1

  ViewVC Help
Powered by ViewVC 1.1.20