From c397a1c220fe795adcc9e5209a53ad02109f59a6 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 17 Feb 2013 23:44:57 -0600 Subject: [PATCH] Add gcc-go support --- core/gcc/PKGBUILD | 38 ++++++++++++++++++++++------ core/gcc/gcc-4.7.1-libgo-write.patch | 12 +++++++++ core/gcc/gcc-go.install | 20 +++++++++++++++ 3 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 core/gcc/gcc-4.7.1-libgo-write.patch create mode 100644 core/gcc/gcc-go.install diff --git a/core/gcc/PKGBUILD b/core/gcc/PKGBUILD index c22c06ac2..99fb1e8e7 100644 --- a/core/gcc/PKGBUILD +++ b/core/gcc/PKGBUILD @@ -13,9 +13,9 @@ noautobuild=1 -pkgname=('gcc' 'gcc-libs' 'gcc-fortran' 'gcc-objc') +pkgname=('gcc' 'gcc-libs' 'gcc-fortran' 'gcc-objc' 'gcc-go') pkgver=4.7.2 -pkgrel=4 +pkgrel=5 #_snapshot=4.7-20120721 pkgdesc="The GNU Compiler Collection" arch=('i686' 'x86_64') @@ -26,8 +26,10 @@ checkdepends=('dejagnu') options=('!libtool' '!emptydirs' '!distcc') source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2 #ftp://gcc.gnu.org/pub/gcc/snapshots/${_snapshot}/gcc-${_snapshot}.tar.bz2 + gcc-4.7.1-libgo-write.patch armhf-triplet-trunk.diff) md5sums=('cc308a0891e778cfda7a151ab8a6e762' + '5647f5bbbb74fab3013b396da1749d2a' 'bd7330bd41845929f1e0efb3b7d0a060') if [ -n "${_snapshot}" ]; then @@ -45,6 +47,9 @@ build() { # Do not run fixincludes sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53679 + patch -p1 -i ${srcdir}/gcc-4.7.1-libgo-write.patch + echo ${pkgver} > gcc/BASE-VER # using -pipe causes spurious test-suite failures @@ -65,7 +70,7 @@ build() { --libdir=/usr/lib --libexecdir=/usr/lib \ --mandir=/usr/share/man --infodir=/usr/share/info \ --with-bugurl=https://bugs.archlinux.org/ \ - --enable-languages=c,c++,fortran,lto,objc,obj-c++ \ + --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ \ --enable-shared --enable-threads=posix \ --with-system-zlib --enable-__cxa_atexit \ --disable-libunwind-exceptions --enable-clocale=gnu \ @@ -143,17 +148,18 @@ package_gcc() mv $pkgdir{,/usr/share/gdb/auto-load}/usr/lib/libstdc++.so.6.0.17-gdb.py # unfortunately it is much, much easier to install the lot and clean-up the mess... - rm -f $pkgdir/usr/bin/{$CHOST-,}gfortran + rm -f $pkgdir/usr/bin/{{$CHOST-,}gfortran,{$CHOST-,}gccgo} rm -f $pkgdir/usr/lib/*.so* - rm -f $pkgdir/usr/lib/lib{ffi,gfortran,objc}.a + rm -f $pkgdir/usr/lib/lib{ffi,gfortran,go{,begin},objc}.a rm -f $pkgdir/usr/lib/libgfortran.spec rm -f -r $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{finclude,include/objc} rm -f $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/include/{ffi{,target}.h} - rm -f $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{cc1obj{,plus},f951} + rm -f $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{cc1obj{,plus},f951,go1} rm -f $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{libcaf_single,libgfortranbegin}.a - rm -f $pkgdir/usr/share/info/{gfortran,libgomp,libitm}.info + rm -f $pkgdir/usr/share/info/{gccgo,gfortran,libgomp,libitm}.info + rm -f -r $pkgdir/usr/lib/go rm -f $pkgdir/usr/share/locale/{de,fr}/LC_MESSAGES/libstdc++.mo - rm -f $pkgdir/usr/share/man/man1/gfortran.1 + rm -f $pkgdir/usr/share/man/man1/{gccgo,gfortran}.1 rm -f $pkgdir/usr/share/man/man3/ffi* # many packages expect this symlink @@ -237,3 +243,19 @@ package_gcc-objc() install -Dm644 ${_basedir}/COPYING.RUNTIME \ ${pkgdir}/usr/share/licenses/gcc-objc/RUNTIME.LIBRARY.EXCEPTION } + +package_gcc-go() +{ + pkgdesc="Go front-end for GCC" + depends=("gcc=$pkgver-$pkgrel") + install=gcc-go.install + + cd ${srcdir}/gcc-build + make -j1 DESTDIR=$pkgdir install-target-libgo + make -j1 -C gcc DESTDIR=$pkgdir go.install-{common,man,info} + install -Dm755 gcc/go1 $pkgdir/usr/lib/gcc/$CHOST/$pkgver/go1 + + # Install Runtime Library Exception + install -Dm644 ${_basedir}/COPYING.RUNTIME \ + ${pkgdir}/usr/share/licenses/gcc-go/RUNTIME.LIBRARY.EXCEPTION +} diff --git a/core/gcc/gcc-4.7.1-libgo-write.patch b/core/gcc/gcc-4.7.1-libgo-write.patch new file mode 100644 index 000000000..340c313a6 --- /dev/null +++ b/core/gcc/gcc-4.7.1-libgo-write.patch @@ -0,0 +1,12 @@ +diff -Naur gcc-4.7.1-orig/libgo/runtime/print.c gcc-4.7.1/libgo/runtime/print.c +--- gcc-4.7.1-orig/libgo/runtime/print.c 2012-05-26 04:22:14.000000000 +1000 ++++ gcc-4.7.1/libgo/runtime/print.c 2012-06-16 15:06:28.553138502 +1000 +@@ -17,7 +17,8 @@ + G* g = runtime_g(); + + if(g == nil || g->writebuf == nil) { +- runtime_write(2, v, n); ++ ssize_t bytesWritten = runtime_write(2, v, n); ++ (void)bytesWritten; + return; + } diff --git a/core/gcc/gcc-go.install b/core/gcc/gcc-go.install new file mode 100644 index 000000000..7dc50dee5 --- /dev/null +++ b/core/gcc/gcc-go.install @@ -0,0 +1,20 @@ +infodir=usr/share/info +filelist=(gccgo.info) + +post_install() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info $infodir/$file.gz $infodir/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null + done +}