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: zlib libmpc
10 source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-$version/$name-$version.tar.xz
11 $name-nocheck-fixincludes.patch)
17 patch -p1 -i $SRC/$name-nocheck-fixincludes.patch
18 sed -i 's|REVISION|REVISION " (CRUX-ARM)"|' $name/version.c
19 # apply a sed substitution that will suppress the installation of libiberty.a
20 sed 's|install_to_$(INSTALL_DEST) ||' -i libiberty/Makefile.in
25 export CXXFLAGS="-O2 -pipe"
26 LDFLAGS="-Wl,-rpath-link,$CROSSTOOLS/$CTARGET/lib" \
27 ../$name-$version/configure --build=$CHOST \
32 --libexecdir=/usr/lib \
33 --enable-languages=c,c++ \
34 --disable-libstdcxx-pch \
35 --enable-threads=posix \
36 --enable-__cxa_atexit \
37 --enable-clocale=gnu \
43 --with-pkgversion="CRUX-ARM"
45 # prevent GCC from looking in the wrong directories for headers and libraries
46 sed "/^HOST_\(GMP\|PPL\|CLOOG\)\(LIBS\|INC\)/s:-[IL]/\(lib\|include\)::" -i Makefile
50 # prevent libtool from adding host lib paths for relink at install
51 # based on patch submitted by Vincent Cadet for libtool bug #21455
52 # see https://lists.gnu.org/archive/html/bug-libtool/2015-09/msg00012.html
53 for lt_file in $(find $SRC/build/$CTARGET -name libtool) ; do
54 sed -i 's/\(add_dir=\"\)\$add_dir \(-L\$inst_prefix_dir\$libdir\"\)/\1\2/' $lt_file
57 make -j1 DESTDIR=$PKG install
60 ln -sf ../usr/bin/cpp $PKG/lib/cpp
61 ln -sf gcc $PKG/usr/bin/cc
62 ln -sf g++ $PKG/usr/bin/c++
64 mv $PKG/usr/lib/gcc/*/$version/include-fixed/{limits.h,syslimits.h} $PKG/usr/lib/gcc/*/$version/include/
66 rm $PKG/usr/lib/libstdc++.so.6.0.24-gdb.py
68 rm -r $PKG/usr/lib/gcc/*/$version/{install-tools,include-fixed}
70 sed -i "s|-L$SRC[^ ]* ||g" $PKG/usr/lib/{libstdc++.la,libsupc++.la}