| 1 | # Description: The GNU Compiler Collection |
| 2 | # URL: http://gcc.gnu.org |
| 3 | # Maintainer: CRUX System Team, core-ports at crux dot nu |
| 4 | # Arch Maintainer: CRUX-ARM System Team, devel at crux-arm dot nu |
| 5 | # Depends on: libgmp libmpfr |
| 6 | |
| 7 | name=gcc |
| 8 | version=4.4.2 |
| 9 | release=1 |
| 10 | source=(ftp://sources.redhat.com/pub/gcc/releases/$name-$version/$name-{core,g++}-$version.tar.bz2 |
| 11 | $name-nocheck-fixincludes.patch test-demangle.c.diff) |
| 12 | |
| 13 | |
| 14 | build() { |
| 15 | cd $name-$version |
| 16 | |
| 17 | patch -p1 -i $SRC/$name-nocheck-fixincludes.patch |
| 18 | patch -p0 -i $SRC/test-demangle.c.diff |
| 19 | sed -i 's|REVISION|REVISION " (CRUX)"|' $name/version.c |
| 20 | # apply a sed substitutio that will suppress the installation of libiberty.a |
| 21 | sed 's|install_to_$(INSTALL_DEST) ||' -i libiberty/Makefile.in |
| 22 | # avoid hardcodeds |
| 23 | sed 's|@have_mktemp_command@|yes|' -i gcc/gccbug.in |
| 24 | |
| 25 | mkdir $SRC/build |
| 26 | cd $SRC/build |
| 27 | |
| 28 | LDFLAGS="-Wl,-rpath-link,$CROSSTOOLS/$CTARGET/lib" \ |
| 29 | ../$name-$version/configure --build=$CHOST \ |
| 30 | --host=$CTARGET \ |
| 31 | --target=$CTARGET \ |
| 32 | --prefix=/usr \ |
| 33 | --libexecdir=/usr/lib \ |
| 34 | --enable-languages=c,c++ \ |
| 35 | --enable-threads=posix \ |
| 36 | --enable-shared \ |
| 37 | --enable-__cxa_atexit \ |
| 38 | --enable-clocale=gnu \ |
| 39 | --disable-nls \ |
| 40 | --disable-libstdcxx-pch \ |
| 41 | --with-x=no |
| 42 | |
| 43 | # prevent GCC from looking in the wrong directories for headers and libraries |
| 44 | sed "/^HOST_\(GMP\|PPL\|CLOOG\)\(LIBS\|INC\)/s:-[IL]/\(lib\|include\)::" -i Makefile |
| 45 | |
| 46 | make |
| 47 | make DESTDIR=$PKG install |
| 48 | |
| 49 | mkdir $PKG/lib |
| 50 | ln -sf ../usr/bin/cpp $PKG/lib/cpp |
| 51 | ln -sf gcc $PKG/usr/bin/cc |
| 52 | ln -sf g++ $PKG/usr/bin/c++ |
| 53 | mv $PKG/usr/lib/gcc/*/$version/include-fixed/{limits.h,syslimits.h} $PKG/usr/lib/gcc/*/$version/include/ |
| 54 | rm -rf $PKG/usr/info $PKG/usr/lib/libiberty.a \ |
| 55 | $PKG/usr/bin/*-linux-gnu-* \ |
| 56 | $PKG/usr/lib/gcc/*/$version/install-tools \ |
| 57 | $PKG/usr/lib/gcc/*/$version/include/README \ |
| 58 | $PKG/usr/lib/gcc/*/$version/include-fixed |
| 59 | |
| 60 | sed -i "s|-L$SRC[^ ]* ||g" $PKG/usr/lib/{libstdc++.la,libsupc++.la} |
| 61 | } |