core/gcc/PKGBUILD

258 lines
8.1 KiB
Bash
Raw Normal View History

2012-04-20 07:43:56 +08:00
# maintainer: Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
2010-03-13 23:25:19 +08:00
2011-10-08 08:02:42 +08:00
pkgname=('gcc' 'gcc-libs' 'gcc-fortran' 'gcc-objc' 'gcc-ada' 'gcc-go')
2013-04-27 02:24:28 +08:00
pkgver=4.8.0
2012-04-20 06:53:39 +08:00
pkgrel=1
2012-11-14 05:58:35 +08:00
#_snapshot=4.7-20120721
2010-03-13 23:25:19 +08:00
pkgdesc="The GNU Compiler Collection"
2012-11-14 05:58:35 +08:00
arch=('x86_64')
license=('GPL' 'LGPL' 'FDL' 'custom')
2010-03-13 23:25:19 +08:00
url="http://gcc.gnu.org"
2013-04-27 02:24:28 +08:00
makedepends=('binutils>=2.23' 'libmpc' 'cloog' 'gcc-ada' 'doxygen')
2011-10-08 08:02:42 +08:00
checkdepends=('dejagnu')
options=('!libtool' '!emptydirs')
2013-04-27 02:24:28 +08:00
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)
md5sums=('e6040024eb9e761c3bea348d1fa5abb0')
2010-06-06 18:46:28 +08:00
if [ -n "${_snapshot}" ]; then
2010-03-13 23:25:19 +08:00
_basedir="${srcdir}/gcc-${_snapshot}"
else
2013-04-27 02:24:28 +08:00
_basedir="gcc-${pkgver}"
2010-03-13 23:25:19 +08:00
fi
build() {
2013-04-27 02:24:28 +08:00
cd ${srcdir}/${_basedir}
2010-03-13 23:25:19 +08:00
# Do not run fixincludes
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
2013-04-27 02:24:28 +08:00
sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
2010-03-13 23:25:19 +08:00
echo ${pkgver} > gcc/BASE-VER
2013-04-27 02:24:28 +08:00
# using -pipe causes spurious test-suite failures
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
CFLAGS=${CFLAGS/-pipe/}
CXXFLAGS=${CXXFLAGS/-pipe/}
2010-03-13 23:25:19 +08:00
cd ${srcdir}
mkdir gcc-build && cd gcc-build
2011-10-08 08:02:42 +08:00
2013-04-27 02:24:28 +08:00
${srcdir}/${_basedir}/configure --prefix=/usr \
2010-05-16 23:08:55 +08:00
--libdir=/usr/lib --libexecdir=/usr/lib \
--mandir=/usr/share/man --infodir=/usr/share/info \
2011-10-08 08:02:42 +08:00
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ \
--enable-shared --enable-threads=posix \
--with-system-zlib --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-clocale=gnu \
2013-04-27 02:24:28 +08:00
--disable-libstdcxx-pch \
--enable-gnu-unique-object --enable-linker-build-id \
2013-04-27 02:24:28 +08:00
--enable-cloog-backend=isl --disable-cloog-version-check \
--enable-lto --enable-gold --enable-ld=default \
--enable-plugin --with-plugin-ld=ld.gold \
2013-04-27 02:24:28 +08:00
--with-linker-hash-style=gnu --disable-install-libiberty \
--disable-multilib --disable-libssp --disable-werror \
--enable-checking=release
make
2012-11-14 05:58:35 +08:00
# make documentation
cd $CHOST/libstdc++-v3
make doc-man-doxygen
2011-10-08 08:02:42 +08:00
}
2010-03-13 23:25:19 +08:00
2011-10-08 08:02:42 +08:00
check() {
2012-11-14 05:58:35 +08:00
cd ${srcdir}/gcc-build
2011-10-08 08:02:42 +08:00
# increase stack size to prevent test failures
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31827
ulimit -s 32768
# do not abort on error as some are "expected"
make -k check || true
2013-04-27 02:24:28 +08:00
${srcdir}/${_basedir}/contrib/test_summary
}
2012-11-14 05:58:35 +08:00
package_gcc-libs()
{
pkgdesc="Runtime libraries shipped by GCC"
groups=('base')
2013-04-27 02:24:28 +08:00
depends=('glibc>=2.17')
2012-11-14 05:58:35 +08:00
install=gcc-libs.install
cd ${srcdir}/gcc-build
make -j1 -C $CHOST/libgcc DESTDIR=${pkgdir} install-shared
for lib in libmudflap libgomp libstdc++-v3/src libitm; do
make -j1 -C $CHOST/$lib DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
done
2013-04-27 02:24:28 +08:00
make -j1 -C $CHOST/libsanitizer/tsan DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
2012-11-14 05:58:35 +08:00
make -j1 -C $CHOST/libstdc++-v3/po DESTDIR=${pkgdir} install
make -j1 -C $CHOST/libgomp DESTDIR=${pkgdir} install-info
make -j1 -C $CHOST/libitm DESTDIR=${pkgdir} install-info
make -j1 DESTDIR=${pkgdir} install-target-libquadmath
make -j1 DESTDIR=${pkgdir} install-target-libgfortran
make -j1 DESTDIR=${pkgdir} install-target-libobjc
# remove unnecessary files installed by install-target-{libquadmath,libgfortran,libobjc}
rm -r ${pkgdir}/usr/lib/{gcc/,libgfortran.spec}
# remove static libraries
find ${pkgdir} -name *.a -delete
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
# Install Runtime Library Exception
2013-04-27 02:24:28 +08:00
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
2010-03-13 23:25:19 +08:00
${pkgdir}/usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION
}
2012-11-14 05:58:35 +08:00
package_gcc()
{
pkgdesc="The GNU Compiler Collection - C and C++ frontends"
2013-04-27 02:24:28 +08:00
depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.23' 'libmpc' 'cloog')
2012-11-14 05:58:35 +08:00
groups=('base-devel')
install=gcc.install
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
cd ${srcdir}/gcc-build
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
make -j1 DESTDIR=${pkgdir} install
install -d $pkgdir/usr/share/gdb/auto-load/usr/lib
2013-04-27 02:24:28 +08:00
mv $pkgdir{,/usr/share/gdb/auto-load}/usr/lib/libstdc++.so.6.0.18-gdb.py
2012-11-14 05:58:35 +08:00
# unfortunately it is much, much easier to install the lot and clean-up the mess...
rm $pkgdir/usr/bin/{{$CHOST-,}gfortran,{$CHOST-,}gccgo,gnat*}
rm $pkgdir/usr/lib/*.so*
2013-04-27 02:24:28 +08:00
rm $pkgdir/usr/lib/lib{atomic,ffi,gfortran,go{,begin},iberty,objc}.a
2012-11-14 05:58:35 +08:00
rm $pkgdir/usr/lib/libgfortran.spec
rm -r $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{ada{include,lib},finclude,include/objc}
2013-04-27 02:24:28 +08:00
rm $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/include/ffi{,target}.h
2012-11-14 05:58:35 +08:00
rm $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{cc1obj{,plus},f951,gnat1,go1}
rm $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{libcaf_single,libgfortranbegin}.a
rm -r $pkgdir/usr/lib/go
2013-04-27 02:24:28 +08:00
rm $pkgdir/usr/share/info/{gccgo,gfortran,gnat*,libffi,libgomp,libquadmath,libitm}.info
2012-11-14 05:58:35 +08:00
rm $pkgdir/usr/share/locale/{de,fr}/LC_MESSAGES/libstdc++.mo
rm $pkgdir/usr/share/man/man1/{gccgo,gfortran}.1
rm $pkgdir/usr/share/man/man3/ffi*
# many packages expect this symlinks
ln -s gcc ${pkgdir}/usr/bin/cc
# POSIX conformance launcher scripts for c89 and c99
cat > $pkgdir/usr/bin/c89 <<"EOF"
2010-05-16 23:08:55 +08:00
#!/bin/sh
fl="-std=c89"
for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) fl="";;
-std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2
exit 1;;
esac
done
exec gcc $fl ${1+"$@"}
EOF
cat > $pkgdir/usr/bin/c99 <<"EOF"
#!/bin/sh
fl="-std=c99"
for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) fl="";;
-std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2
exit 1;;
esac
done
exec gcc $fl ${1+"$@"}
EOF
2012-11-14 05:58:35 +08:00
chmod 755 $pkgdir/usr/bin/c{8,9}9
2010-05-16 23:08:55 +08:00
2012-11-14 05:58:35 +08:00
# install the libstdc++ man pages
install -dm755 ${pkgdir}/usr/share/man/man3
install -m644 -t ${pkgdir}/usr/share/man/man3 \
${CHOST}/libstdc++-v3/doc/doxygen/man/man3/*.3
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
# Install Runtime Library Exception
2013-04-27 02:24:28 +08:00
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
2010-03-13 23:25:19 +08:00
${pkgdir}/usr/share/licenses/gcc/RUNTIME.LIBRARY.EXCEPTION
}
2012-11-14 05:58:35 +08:00
package_gcc-fortran()
{
pkgdesc="Fortran front-end for GCC"
depends=("gcc=$pkgver-$pkgrel")
install=gcc-fortran.install
cd ${srcdir}/gcc-build
make -j1 DESTDIR=$pkgdir install-target-libgfortran
make -j1 -C $CHOST/libgomp DESTDIR=$pkgdir install-nodist_fincludeHEADERS
make -j1 -C gcc DESTDIR=$pkgdir fortran.install-{common,man,info}
install -Dm755 gcc/f951 $pkgdir/usr/lib/gcc/$CHOST/$pkgver/f951
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
ln -s gfortran ${pkgdir}/usr/bin/f95
2013-04-27 02:24:28 +08:00
# remove files included in gcc-libs or gcc
rm ${pkgdir}/usr/lib/lib{gfortran,gcc_s}.so*
rm ${pkgdir}/usr/lib/libquadmath.{a,so*}
rm ${pkgdir}/usr/lib/gcc/$CHOST/${pkgver}/{*.o,libgc*}
rm ${pkgdir}/usr/share/info/libquadmath.info
rm -r ${pkgdir}/usr/lib/gcc/$CHOST/${pkgver}/include
2012-11-14 05:58:35 +08:00
# Install Runtime Library Exception
2013-04-27 02:24:28 +08:00
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
2010-03-13 23:25:19 +08:00
${pkgdir}/usr/share/licenses/gcc-fortran/RUNTIME.LIBRARY.EXCEPTION
}
2012-11-14 05:58:35 +08:00
package_gcc-objc()
{
pkgdesc="Objective-C front-end for GCC"
depends=("gcc=$pkgver-$pkgrel")
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
cd ${srcdir}/gcc-build
make -j1 DESTDIR=$pkgdir install-target-libobjc
install -dm755 $pkgdir/usr/lib/gcc/$CHOST/$pkgver/
install -m755 gcc/cc1obj{,plus} $pkgdir/usr/lib/gcc/$CHOST/$pkgver/
2010-03-13 23:25:19 +08:00
2013-04-27 02:24:28 +08:00
# remove files included in gcc-libs or gcc
rm ${pkgdir}/usr/lib/lib{gcc_s,objc}.so*
rm $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/{*.o,lib*}
rm $pkgdir/usr/lib/gcc/$CHOST/${pkgver}/include/unwind.h
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
# Install Runtime Library Exception
2013-04-27 02:24:28 +08:00
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
2010-03-13 23:25:19 +08:00
${pkgdir}/usr/share/licenses/gcc-objc/RUNTIME.LIBRARY.EXCEPTION
}
2012-11-14 05:58:35 +08:00
package_gcc-ada()
{
pkgdesc="Ada front-end for GCC (GNAT)"
depends=("gcc=$pkgver-$pkgrel")
install=gcc-ada.install
cd ${srcdir}/gcc-build/gcc
make -j1 DESTDIR=$pkgdir ada.install-{common,info}
install -m755 gnat1 $pkgdir/usr/lib/gcc/$CHOST/$pkgver
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
ln -s gcc ${pkgdir}/usr/bin/gnatgcc
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
# Install Runtime Library Exception
2013-04-27 02:24:28 +08:00
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
2012-04-21 08:01:42 +08:00
${pkgdir}/usr/share/licenses/gcc-ada/RUNTIME.LIBRARY.EXCEPTION
2011-10-08 08:02:42 +08:00
}
2012-11-14 05:58:35 +08:00
package_gcc-go()
{
pkgdesc="Go front-end for GCC"
depends=("gcc=$pkgver-$pkgrel")
install=gcc-go.install
2011-10-08 08:02:42 +08:00
2012-11-14 05:58:35 +08:00
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
2011-10-08 08:02:42 +08:00
2012-11-14 05:58:35 +08:00
# Install Runtime Library Exception
2013-04-27 02:24:28 +08:00
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
2011-10-08 08:02:42 +08:00
${pkgdir}/usr/share/licenses/gcc-go/RUNTIME.LIBRARY.EXCEPTION
}