You are not logged in.

#1 2011-05-10 05:03:18

ytj
Member
Registered: 2010-11-14
Posts: 24

Review PKGBUILD for gcc45

Hi everyone,

It works on my machine. However, I have no much experience to create a PKGBUILD.
I think a review is worthwhile before posting it to AUR.

You can download the whole source from this link:
https://docs.google.com/uc?export=downl … ision=true

Here is my PKGBUILD.

# Maintainer: Tianjiao Yin <ytj000@gmail.com>
# Contributor: Allan McRae <allan@archlinux.org>

# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version

pkgname=gcc45
_ver=4.5
pkgver=4.5.3
pkgrel=1
pkgdesc="The GNU Compiler Collection (4.5.x)"
arch=('i686' 'x86_64')
license=('GPL' 'LGPL' 'custom')
url="http://gcc.gnu.org"
# makedepends=('binutils>=2.21' 'libmpc' 'cloog-ppl>=0.15.9-2' 'elfutils' 'gcc-ada' 'dejagnu')
depends=('glibc' 'binutils' 'gmp' 'mpfr' 'libmpc' 'ppl' 'isl' 'cloog' 'elfutils')
makedepends=('flex' 'bison' 'aria2')
options=('!libtool' '!emptydirs')
source=(gcc-hash-style-both.patch
    gcc_pure64.patch
    {core,g++,testsuite}.metalink
    )
md5sums=('6fd395bacbd7b6e47c7b74854b478363'
         '4030ee1c08dd1e843c0225b772360e76'
         '54f2d37907584c6dcbe299bbc7f541b3'
         '70d7df7425c50583d5ca4499f12d80ea'
         'd6b52ba040b00ea5504ecd035b12a100')

_basedir="${srcdir}/gcc-${pkgver}"

# ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.5.3/md5.sum
build() {
  cd ${srcdir}

  msg "Downloading... "
  aria2c core.metalink
  aria2c g++.metalink
  # aria2c testsuite.metalink

  msg "Unpacking... "
  tar xf gcc-core.tar.bz2
  tar xf gcc-g++.tar.bz2
  # tar xf gcc-testsuite.tar.bz2

  msg "Building... "


  cd ${_basedir}

  #"Add" ppl-0.11 compatibility
  sed -i "/ppl_minor_version=/s#10#11#" configure

  # Do not install libiberty
  sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in

  # Do not run fixincludes
  sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in

  if [ "${CARCH}" = "x86_64" ]; then
    patch -Np1 -i ${srcdir}/gcc_pure64.patch
  fi
  patch -Np0 -i ${srcdir}/gcc-hash-style-both.patch

  echo ${pkgver} > gcc/BASE-VER

  cd ${srcdir}
  mkdir gcc-build && cd gcc-build
  ${_basedir}/configure --prefix=/usr \
      --libdir=/usr/lib --libexecdir=/usr/lib \
      --mandir=/usr/share/man --infodir=/usr/share/info \
      --with-bugurl=https://bugs.archlinux.org/ \
      --enable-languages=c,c++ \
      --enable-shared --enable-threads=posix \
      --with-system-zlib --enable-__cxa_atexit \
      --enable-clocale=gnu \
      --enable-gnu-unique-object \
      --with-ppl \
      --enable-lto --enable-plugin \
      --enable-gold --with-plugin-ld=ld.gold \
      --disable-multilib --disable-libstdcxx-pch \
      --disable-libunwind-exceptions \
      --enable-linker-build-id \
      --enable-cloog-backend=isl \
      --enable-ld=default \
      --enable-checking=release --disable-werror \
      --program-suffix=-${_ver} --enable-version-specific-runtime-libs

      # --with-cloog --with-cloog-include=/usr/include/cloog-ppl \
  make

  ## 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 -j3 check || true
  #${_basedir}/contrib/test_summary
}


package()
{
  cd ${srcdir}/gcc-build

  make -j1 DESTDIR=${pkgdir} install

  ## Lazy way of dealing with conflicting man and info pages and locales...
  rm -rf ${pkgdir}/usr/share/

  install -Dm644 ${srcdir}/gcc-${pkgver}/COPYING.RUNTIME \
    ${pkgdir}/usr/share/licenses/$pkgname/RUNTIME.LIBRARY.EXCEPTION
}

Motivation:
g++ 4.6.0 can NOT compile this simple code with -std=c++0x :

template <typename T>
struct S {
    static T *P;
    T x;
};

template <typename T>
T *S<T>::P = &S<T>::x;

This technique was heavy used in my project, as well as c++0x.
It works on g++ 4.6.0 without -std=c++0x or g++ 4.5.3 with or without -std=c++0x

Offline

Board footer

Powered by FluxBB