/[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.17 - (show annotations) (download)
Tue May 27 23:41:45 2003 UTC (11 years, 1 month ago) by gmsoft
Branch: MAIN
Branch point for: RELEASE-1_4
Changes since 1.16: +3 -2 lines
Downgrading DEPEND to binutils >=2.13.90.0.16 for hppa for gcc-3.2.2 .

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

  ViewVC Help
Powered by ViewVC 1.1.20