summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 633484cc2c1ae4b8fa4109b719a64534d8646036 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer: Jannik Birk <birk.jannik@gmail.com>

_target=i686-elf
pkgname=$_target-gcc
pkgver=6.2.0
pkgrel=1
_gmpver=6.0.0a
_mpfrver=3.1.2
_mpcver=1.0.2
_islver=0.16
_cloogver=0.18.1
pkgdesc='The GNU Compiler Collection - cross compiler for i686-elf target'
arch=(i686 x86_64)
url='http://gcc.gnu.org/'
license=(GPL LGPL FDL)
depends=($_target-binutils zlib)
options=(!emptydirs)
source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
        https://gmplib.org/download/gmp/gmp-$_gmpver.tar.xz
        http://www.mpfr.org/mpfr-$_mpfrver/mpfr-$_mpfrver.tar.xz
        ftp://ftp.gnu.org/gnu/mpc/mpc-$_mpcver.tar.gz
        http://isl.gforge.inria.fr/isl-$_islver.tar.bz2
        http://www.bastoul.net/cloog/pages/download/cloog-$_cloogver.tar.gz)
sha256sums=('9944589fc722d3e66308c0ce5257788ebd7872982a718aa2516123940671b7c5'
            '9156d32edac6955bc53b0218f5f3763facb890b73a835d5e1b901dcf8eb8b764'
            '399d0f47ef6608cc01d29ed1b99c7faff36d9994c45f36f41ba250147100453b'
            'b561f54d8a479cee3bc891ee52735f18ff86712ba30f036f8b8537bae380c488'
            '3899e68047d0a18db5a7d73bdabcbe9246865e73e86efbd95387817d342fd554'
            '02500a4edd14875f94fe84cbeda4290425cb0c1c2474c6f75d75a303d64b4196')

_basedir=gcc-$pkgver

prepare() {
  cd $_basedir
  
  # link gmp/mpfr/mpc for in-tree builds
  ln -s ../gmp-$_gmpver gmp
  ln -s ../mpfr-$_mpfrver mpfr
  ln -s ../mpc-$_mpcver mpc

  # link isl/cloog for in-tree builds
  ln -s ../isl-$_islver isl
  ln -s ../cloog-$_cloogver cloog

  echo $pkgver > gcc/BASE-VER

  # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
  sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure

  mkdir $srcdir/gcc-build
}

build() {
  cd gcc-build

  $srcdir/$_basedir/configure \
    --target=$_target \
    --prefix=/usr \
    --enable-languages=c,c++ \
    --disable-tls \
    --without-headers \
    --with-system-zlib \
    --with-gmp \
    --with-mpfr \
    --with-mpc \
    --with-cloog \
    --with-isl \
    --enable-cloog-backend=isl

  make all-gcc
  make all-target-libgcc
}

check() {
  cd gcc-build

  # 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
  $srcdir/$_basedir/contrib/test_summary
}

package() {
  cd gcc-build

  make DESTDIR="$pkgdir" install-gcc
  make DESTDIR="$pkgdir" install-target-libgcc

  # Remove files that conflict with host gcc package
  rm -r "$pkgdir"/usr/share/man/man7
  rm -r "$pkgdir"/usr/share/info
  rm -r "$pkgdir"/usr/share/locale
}