diff options
author | Emil Renner Berthing | 2017-09-10 13:58:34 +0200 |
---|---|---|
committer | Emil Renner Berthing | 2017-09-10 13:58:34 +0200 |
commit | a5a2dc33890d4375ac726db540e550b929c8f9a8 (patch) | |
tree | 20f4b2583a042d85b9fb65e81a0ddcb2ac1d2ed7 /PKGBUILD | |
download | aur-a5a2dc33890d4375ac726db540e550b929c8f9a8.tar.gz |
initial commit
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..fdd2c3d5c309 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,108 @@ +# Maintainer: Emil Renner Berthing <aur@esmil.dk> + +_target=riscv64-unknown-elf +pkgname=$_target-gcc +pkgver=7.2.0 +_islver=0.18 +_newlibver=2.5.0.20170818 +pkgrel=1 +#_snapshot=7-20170504 +pkgdesc='The GNU Compiler Collection - cross compiler for 32bit and 64bit RISC-V bare-metal' +arch=('i686' 'x86_64') +url='http://gcc.gnu.org/' +license=(GPL LGPL FDL) +depends=("$_target-binutils" 'zlib' 'libmpc') +options=(!emptydirs !strip) +source=("https://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.xz" + "http://isl.gforge.inria.fr/isl-$_islver.tar.bz2" + "https://sourceware.org/pub/newlib/newlib-2.5.0.20170818.tar.gz") +sha256sums=('1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a' + '6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b' + '7766f1a1411170e7844c7477ee82b26d35f7136b01f4cc3dea0e759551d4abbb') + +if [[ -n "$_snapshot" ]]; then + _basedir=gcc-$_snapshot +else + _basedir=gcc-$pkgver +fi + +prepare() { + cd $_basedir + + # link isl for in-tree builds + ln -s ../isl-$_islver isl + + # link newlib for in-tree builds + for i in newlib libgloss; do + ln -s ../newlib-$_newlibver/$i + done + + echo $pkgver > gcc/BASE-VER + + # hack! - some configure tests for header files using "$CPP $CPPFLAGS" + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure + + mkdir "$srcdir/build" +} + +build() { + cd "$srcdir/build" + + export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections' + export CXXFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections' + + "$srcdir/$_basedir/configure" \ + --target=$_target \ + --prefix=/usr \ + --with-sysroot=/usr/$_target \ + --with-native-system-header-dir=/include \ + --libexecdir=/usr/lib \ + --enable-languages=c,c++ \ + --enable-plugins \ + --disable-decimal-float \ + --disable-libffi \ + --disable-libgomp \ + --disable-libmudflap \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libstdcxx-pch \ + --disable-nls \ + --disable-shared \ + --disable-threads \ + --disable-tls \ + --with-gnu-as \ + --with-gnu-ld \ + --with-system-zlib \ + --with-newlib \ + --with-headers=/usr/$_target/include \ + --with-python-dir=share/gcc-$_target \ + --with-gmp \ + --with-mpfr \ + --with-mpc \ + --with-isl \ + --with-libelf \ + --enable-gnu-indirect-function \ + --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \ + --with-pkgversion='Arch Repository' \ + --with-bugurl='https://bugs.archlinux.org/' + + make INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0' +} + +package() { + cd "$srcdir/build" + make -j1 DESTDIR="$pkgdir" install + + # strip target binaries + find "$pkgdir/usr/lib/gcc/$_target/$pkgver" "$pkgdir/usr/$_target/lib" -type f -and \( -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 "$pkgdir/usr/bin/" "$pkgdir/usr/lib/gcc/$_target/$pkgver" -type f -and \( -executable \) -exec strip '{}' \; + + # Remove files that conflict with host gcc package + rm -r "$pkgdir"/usr/share/man/man7 + rm -r "$pkgdir"/usr/share/info + rm "$pkgdir"/usr/lib/libcc1.* +} + +# vim: set ts=2 sw=2 et: |