summaryrefslogtreecommitdiff
path: root/libre/sh-elf-gcc
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2018-04-09 14:43:48 -0300
committerDavid P <megver83@parabola.nu>2018-04-09 14:43:48 -0300
commit2f5136e5f40d69bd0115d898fda48d0ed9159c40 (patch)
tree2c1f3266d1b90a7150e0aee124ecb1223360f4bb /libre/sh-elf-gcc
parent14611d71231ab4b751fe634c21cfe8b726ca2612 (diff)
Add libre/sh-elf-{gcc,binutils,newlib}
Diffstat (limited to 'libre/sh-elf-gcc')
-rw-r--r--libre/sh-elf-gcc/PKGBUILD122
1 files changed, 122 insertions, 0 deletions
diff --git a/libre/sh-elf-gcc/PKGBUILD b/libre/sh-elf-gcc/PKGBUILD
new file mode 100644
index 000000000..fe43c3e3a
--- /dev/null
+++ b/libre/sh-elf-gcc/PKGBUILD
@@ -0,0 +1,122 @@
+# Maintainer: David P. <megver83@parabola.nu>
+
+_target=sh-elf
+pkgname=$_target-gcc
+pkgver=7.3.1
+_islver=0.18
+pkgrel=2
+_snapshot=7-20180125
+pkgdesc="The GNU Compiler Collection - cross compiler for $_target target"
+arch=('x86_64' 'i686' 'armv7h')
+url='http://gcc.gnu.org/'
+license=(GPL LGPL FDL)
+depends=($_target-binutils libmpc zlib)
+makedepends=(gmp mpfr $_target-newlib)
+optdepends=("$_target-newlib: Standard C library ($_target target)")
+options=(!emptydirs !strip)
+source=(#https://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
+ https://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.xz
+ http://isl.gforge.inria.fr/isl-$_islver.tar.bz2)
+sha512sums=('87558e9cf6d44df0c45e2bde8ef4d4a8b77716382ae0cd787b80bb4650a0a033d2b815a3b3eaa1798a16d66afca0d38c83a268bed0b26bdf013a483f04923298'
+ '85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94')
+
+if [ -n "$_snapshot" ]; then
+ _basedir=gcc-$_snapshot
+else
+ _basedir=gcc-$pkgver
+fi
+
+prepare() {
+ cd $_basedir
+
+ # link isl for in-tree builds
+ ln -sf ../isl-$_islver isl
+
+ echo $pkgver > gcc/BASE-VER
+
+ # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
+ sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" "$srcdir"/$_basedir/{libiberty,gcc}/configure
+
+ mkdir $srcdir/build-{gcc,gcc-nano}
+}
+
+_build_gcc() {
+ $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' \
+ --without-pkgversion \
+ --with-bugurl='https://labs.parabola.nu/' \
+ --with-multilib
+
+ make INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
+}
+
+build() {
+ cd $srcdir/build-gcc
+ export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
+ export CXXFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
+ _build_gcc
+
+ # Build libstdc++ without exceptions support (the 'nano' variant)
+ cd $srcdir/build-gcc-nano
+ export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections -fno-exceptions'
+ export CXXFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections -fno-exceptions'
+ _build_gcc
+}
+
+package() {
+ cd $srcdir/build-gcc
+ make DESTDIR="$pkgdir" install -j1
+
+ cd $srcdir/build-gcc-nano
+ make DESTDIR="$pkgdir.nano" install -j1
+ # we need only libstdc nano files
+ multilibs=( $($pkgdir/usr/bin/$_target-gcc -print-multi-lib 2>/dev/null) )
+ for multilib in "${multilibs[@]}"; do
+ dir="${multilib%%;*}"
+ from_dir=$pkgdir.nano/usr/$_target/lib/$dir
+ to_dir=$pkgdir/usr/$_target/lib/$dir
+ cp -f $from_dir/libstdc++.a $to_dir/libstdc++_nano.a
+ cp -f $from_dir/libsupc++.a $to_dir/libsupc++_nano.a
+ done
+
+ # 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.*
+}