/[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.6 - (show annotations) (download)
Sat Feb 22 07:52:32 2003 UTC (11 years, 10 months ago) by zwelch
Branch: MAIN
Changes since 1.5: +6 -1 lines
add arm patch to fix gcc from generating incorrect code

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

  ViewVC Help
Powered by ViewVC 1.1.20