jpkotta

gcc48 PKGBUILD

Jun 1st, 2016
332
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Maintainer: Felix Schindler <felix at schindlerfaimly dot de>
  2. # Contributor: Allan McRae <allan@archlinux.org>
  3. #
  4. # This PKGBUILD is maintained at https://github.com/ftalbrecht/aur
  5. # in the gcc48 branch
  6.  
  7. # toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
  8. # NOTE: libtool requires rebuilt with each new gcc version
  9.  
  10. pkgname=gcc48
  11. _pkgver_minor=4.8
  12. pkgver=${_pkgver_minor}.5
  13. pkgrel=2
  14. pkgdesc="The GNU Compiler Collection - C and C++ frontends (4.8.x)"
  15. arch=('i686' 'x86_64')
  16. license=('GPL' 'LGPL' 'FDL' 'custom')
  17. url="http://gcc.gnu.org"
  18. depends=('binutils>=2.24' 'libmpc' 'cloog')
  19. makedepends=('binutils>=2.24' 'libmpc' 'cloog' 'doxygen')
  20. checkdepends=('dejagnu' 'inetutils')
  21. options=('!emptydirs' 'staticlibs' '!libtool')
  22. source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2)
  23. md5sums=('80d2c2982a3392bb0b89673ff136e223')
  24.  
  25. _basedir=gcc-${pkgver}
  26.  
  27. _libdir="usr/lib/gcc/$CHOST/$pkgver"
  28.  
  29. prepare() {
  30.   cd ${srcdir}/${_basedir}
  31.  
  32.   # Do not run fixincludes
  33.   sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
  34.  
  35.   # Arch Linux installs x86_64 libraries /lib
  36.   [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
  37.  
  38.   echo ${pkgver} > gcc/BASE-VER
  39.  
  40.   # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
  41.   sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
  42.  
  43.   # installing libiberty headers is broken
  44.   # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56780#c6
  45.   sed -i 's#@target_header_dir@#libiberty#' libiberty/Makefile.in
  46.  
  47.   sed -i 's#^\(.*__gnu_inline__.*\)$#// \1#' gcc/cp/cfns.h
  48.  
  49.   mkdir ${srcdir}/gcc-build
  50. }
  51.  
  52. build() {
  53.   cd ${srcdir}/gcc-build
  54.  
  55.   # Doesn't like FORTIFY_SOURCE
  56.   CPPFLAGS=${CPPFLAGS//-D_FORTIFY_SOURCE=?/}
  57.  
  58.   # Doesn't like -fstack-protector-strong
  59.   CFLAGS=${CFLAGS//-fstack-protector-strong/-fstack-protector}
  60.   CXXFLAGS=${CXXFLAGS//-fstack-protector-strong/-fstack-protector}
  61.  
  62.   # using -pipe causes spurious test-suite failures
  63.   # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
  64.   CFLAGS=${CFLAGS/-pipe/}
  65.   CXXFLAGS=${CXXFLAGS/-pipe/}
  66.  
  67.   LD_PRELOAD=/usr/lib/libstdc++.so.6
  68.  
  69.   export CPPFLAGS CXXFLAGS CFLAGS LD_PRELOAD
  70.  
  71.   ${srcdir}/${_basedir}/configure --prefix=/usr \
  72.       --libdir=/usr/lib --libexecdir=/usr/lib \
  73.       --mandir=/usr/share/man --infodir=/usr/share/info \
  74.       --with-bugurl=https://bugs.archlinux.org/ \
  75.       --enable-languages=c,c++,fortran \
  76.       --enable-shared --enable-threads=posix \
  77.       --with-system-zlib --enable-__cxa_atexit \
  78.       --disable-libunwind-exceptions --enable-clocale=gnu \
  79.       --disable-libstdcxx-pch \
  80.       --enable-gnu-unique-object \
  81.       --with-ppl \
  82.       --disable-multilib --disable-werror \
  83.       --enable-linker-build-id \
  84.       --enable-cloog-backend=isl \
  85.       --enable-lto --enable-gold --enable-ld=default \
  86.       --enable-plugin --with-plugin-ld=ld.gold \
  87.       --program-suffix=-${pkgver} --enable-version-specific-runtime-libs \
  88.       --enable-checking=release
  89.  
  90.   make
  91.  
  92.   # make documentation
  93.   make -C $CARCH-unknown-linux-gnu/libstdc++-v3/doc doc-man-doxygen
  94. }
  95.  
  96. package()
  97. {
  98.   cd ${srcdir}/gcc-build
  99.  
  100.   export LD_PRELOAD=/usr/lib/libstdc++.so.6
  101.  
  102.   make -j1 DESTDIR=${pkgdir} install
  103.  
  104.   ## Lazy way of dealing with conflicting man and info pages and locales...
  105.   rm -rf ${pkgdir}/usr/share/
  106.   rm -rf ${pkgdir}/usr/include/
  107.   find ${pkgdir}/ -name \*iberty\* | xargs rm
  108.  
  109.   # Move potentially conflicting stuff to version specific subdirectory
  110.   $(ls "$pkgdir"/usr/lib/gcc/$CHOST/lib* &> /dev/null) && mv "$pkgdir"/usr/lib/gcc/$CHOST/lib* "$pkgdir/usr/lib/gcc/$CHOST/$pkgver/"
  111.  
  112.   # Install Runtime Library Exception
  113.   install -Dm644 ${srcdir}/gcc-${pkgver}/COPYING.RUNTIME \
  114.     ${pkgdir}/usr/share/licenses/$pkgname/RUNTIME.LIBRARY.EXCEPTION
  115.  
  116.   # create symlinks
  117.   cd ${pkgdir}/usr/bin
  118.   for ii in c++ g++ gcc gcc-ar gcc-nm gcc-ranlib gfortran; do
  119.     ln -s ${ii}-${pkgver} ${ii}-${_pkgver_minor}
  120.     ln -s ${CHOST}-${ii}-${pkgver} ${CHOST}-${ii}-${_pkgver_minor}
  121.   done
  122.   ln -s gcov-${pkgver} gcov-${_pkgver_minor}
  123. }
RAW Paste Data