_target=mips64 _tuple=$_target-elf-ultra64 _prefix=/opt/$_tuple pkgname=$_tuple-bootstrap pkgver=8.2.0 pkgrel=1 _gcc=gcc-$pkgver _mpfr=mpfr-4.0.1 _gmp=gmp-6.1.2 _mpc=mpc-1.1.0 _isl=isl-0.18 pkgdesc="The GNU Compiler Collection. Stage 1 for toolchain building ($_target)" arch=('any') license=('GPL' 'LGPL' 'FDL') url='http://www.gnu.org/software/gcc/' depends=('zlib' "$_tuple-binutils") makedepends=('gmp' 'mpfr') source=("ftp://gcc.gnu.org/pub/gcc/releases/$_gcc/$_gcc.tar.gz" "ftp://ftp.gnu.org/gnu/mpfr/$_mpfr.tar.bz2" "ftp://ftp.gnu.org/gnu/gmp/$_gmp.tar.bz2" "ftp://ftp.gnu.org/gnu/mpc/$_mpc.tar.gz" "ftp://gcc.gnu.org/pub/gcc/infrastructure/$_isl.tar.bz2") md5sums=('ee04f0c22a941f5f17d93809387f2729' '8c21d8ac7460493b2b9f3ef3cc610454' '8ddbb26dc3bd4e2302984debba1406a5' '4125404e41e482ec68282a2e687f6c73' '11436d6b205e516635b666090b94ab32') options=('!emptydirs' '!strip') prepare() { cd "$srcdir/$_isl" # Fix trailing comma which errors with -pedantic for host GCC <= 4.3 sed -i 's/isl_stat_ok = 0,/isl_stat_ok = 0/' "include/isl/ctx.h" cd "$srcdir/$_gcc" rm -rf mpfr gmp mpc isl ln -sf "$srcdir/$_mpfr" mpfr ln -sf "$srcdir/$_gmp" gmp ln -sf "$srcdir/$_mpc" mpc ln -sf "$srcdir/$_isl" isl # Hack - see native package for details sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure } build() { # the programs we're compiling are really picky about flags. # it's best to keep it simple. export CFLAGS="-O2" export CXXFLAGS="-O2" export CPPFLAGS="" export LDFLAGS="" export CFLAGS_FOR_TARGET="-O2 -G0 \ -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables" export CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET -fno-rtti" cd "$srcdir" [ -d "build-bootstrap-gcc" ] || mkdir "build-bootstrap-gcc" cd "build-bootstrap-gcc" local _build= if [ -n "$MINGW_CHOST" ]; then _build="--build=$MINGW_CHOST --host=$MINGW_CHOST" fi "../$_gcc/configure" $_build --target=$_target --prefix="$_prefix" \ --disable-__cxa_atexit \ --disable-decimal-float \ --disable-gold \ --disable-initfini-array \ --disable-libada \ --disable-libatomic \ --disable-libgcj \ --disable-libgomp \ --disable-libitm \ --disable-libquadmath \ --disable-libquadmath-support \ --disable-libsanitizer \ --disable-libssp \ --disable-libunwind-exceptions \ --disable-libvtv \ --disable-multiarch \ --disable-multilib \ --disable-nls \ --disable-plugin \ --disable-shared \ --disable-threads \ --disable-tls \ --disable-werror \ --enable-languages=c,c++,lto \ --enable-static \ --enable-target-optspace \ --with-abi=32 \ --with-arch=vr4300 \ --with-newlib \ --with-tune=vr4300 \ --without-headers \ --without-included-gettext \ make all-gcc } package() { local PREFIX="$pkgdir$_prefix" cd "$srcdir/build-bootstrap-gcc" make DESTDIR="$pkgdir" install-gcc -j1 # strip target binaries find "$PREFIX/lib" \( -name "*.a" -or -name "*.o" \) -exec $_target-objcopy \ -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc \ '{}' \; # strip host binaries find "$PREFIX/bin" "$PREFIX/lib/gcc/$_target/${_gcc/gcc-/}" \ -type f -and \( -executable \) -exec strip '{}' \; rm -r "$PREFIX/share/info" }