_target=mips _triplet="$_target-ultra64-elf" _prefix="/opt/$_triplet" _sysroot="$_prefix/sysroot" pkgname="$_triplet-gcc" pkgver=11.2.0 pkgrel=3 _gcc="gcc-$pkgver" _mpfr=mpfr-4.1.0 _gmp=gmp-6.2.1 _mpc=mpc-1.2.1 _isl=isl-0.24 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') source=("ftp://gcc.gnu.org/pub/gcc/releases/$_gcc/$_gcc.tar.xz" "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" "http://isl.gforge.inria.fr/$_isl.tar.bz2") sha256sums=('d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b' 'feced2d430dd5a97805fa289fed3fc8ff2b094c02d05287fd6133e7f1f0ec926' 'eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c' '17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459' 'fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0') options=('!emptydirs' '!strip') conflicts=("$_triplet-bootstrap") provides=("$_triplet-bootstrap") replaces=("$_triplet-bootstrap") 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="-Os -G0 -fcommon -ffunction-sections -fdata-sections" export CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET" 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 \ --disable-win32-registry \ --enable-languages=c,c++,lto \ --enable-lto \ --enable-static \ --enable-target-optspace \ --with-abi=32 \ --with-arch=vr4300 \ --with-gcc \ --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/lib/gcc/$_target/$pkgver" \ "$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 # "$PREFIX/bin" # "$PREFIX/lib/gcc/$_target/$pkgver" find "$PREFIX" -type f -and \( -executable \) -exec strip '{}' \; rm -r "$PREFIX/share" }