PKGBUILDs/n64-toolkit/PKGBUILD.gcc
Connor Olding 659dd742d3 update toolchain versions
confirmed to build but haven't tried using them yet.
haven't yet updated newlib to 3.0 because it's the
only non-GNU dependency, so i thought
it might be the most likely to cause breakage.
that'll be next to try.
2018-03-22 05:17:14 +01:00

121 lines
3.5 KiB
Plaintext

_target=mips64
_prefix="/opt/n64-toolchain-slim"
_mpfr=mpfr-4.0.1
_gmp=gmp-6.1.2
_mpc=mpc-1.1.0
_isl=isl-0.18
pkgname=n64-toolkit-gcc
pkgver=7.3.0
pkgrel=1
_gcc="gcc-$pkgver"
pkgdesc="The GNU Compiler Collection (${_target})"
arch=('any')
license=('GPL' 'LGPL' 'FDL')
url='http://www.gnu.org/software/gcc/'
depends=('zlib' "n64-toolkit-binutils" "n64-toolkit-newlib") # 'libmpc'
makedepends=('gmp' 'mpfr')
conflicts=('n64-toolkit-bootstrap')
provides=('n64-toolkit-bootstrap')
replaces=('n64-toolkit-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")
md5sums=('747d5010b7c6938b480bc6e4d7c4be9a'
'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 -ffunction-sections -fdata-sections \
-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" \
--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-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"
}