_target=mips _triplet="$_target-ultra64-elf" _prefix="/opt/$_triplet" _sysroot="$_prefix/sysroot" pkgname="$_triplet-gcc" pkgver=11.2.0 pkgrel=1 _gcc="gcc-$pkgver" _mpfr=mpfr-4.1.0 _gmp=gmp-6.2.1 _mpc=mpc-1.2.1 _isl=isl-0.18 pkgdesc="The GNU Compiler Collection ($_triplet)" arch=('any') license=('GPL' 'LGPL' 'FDL') url='http://www.gnu.org/software/gcc/' depends=('zlib' "$_triplet-binutils" "$_triplet-newlib") makedepends=('gmp' 'mpfr') conflicts=("$_triplet-bootstrap") provides=("$_triplet-bootstrap") replaces=("$_triplet-bootstrap") 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") sha256sums=('f0837f1bf8244a5cc23bd96ff6366712a791cfae01df8e25b137698aca26efc1' 'feced2d430dd5a97805fa289fed3fc8ff2b094c02d05287fd6133e7f1f0ec926' 'eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c' '17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459' '6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b') 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="-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables" export CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET -fno-rtti" cd "$srcdir" [ -d "build-gcc" ] || mkdir "build-gcc" cd "build-gcc" local _build= if [ -n "$MINGW_CHOST" ]; then _build="--build=$MINGW_CHOST --host=$MINGW_CHOST" fi "../$_gcc/configure" $_build \ --target=$_target \ --prefix="$_prefix" \ --with-sysroot="$_sysroot" \ \ --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-lto \ --enable-static \ --enable-target-optspace \ --with-abi=32 \ --with-arch=vr4300 \ --with-gnu-as \ --with-gnu-ld \ --with-newlib \ --with-tune=vr4300 \ --without-headers \ --without-included-gettext \ make all } package() { local PREFIX="$pkgdir$_prefix" cd "$srcdir/build-gcc" make DESTDIR="$pkgdir" install -j1 # strip target binaries find "$PREFIX/$_target/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" }