summaryrefslogtreecommitdiff
path: root/libre/gcc-libs-static/PKGBUILD
blob: 396b19375258c868f54c41c630f8f3f2e7ba966e (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Maintainer: Márcio Silva <coadde@parabola.nu>
# based of gcc

_pkgname=gcc-libs
pkgname=gcc-libs-static
pkgver=5.3.0
_pkgver=5
_islver=0.15
pkgrel=5
_snapshot=5-20160209
pkgdesc="The GNU Compiler Collection (static libraries only)"
arch=('i686' 'x86_64' 'armv7h')
license=('GPL' 'LGPL' 'FDL' 'custom')
url="http://gcc.gnu.org"
makedepends=('binutils>=2.26' 'libmpc-static' 'gcc-ada')
checkdepends=('dejagnu' 'inetutils')
options=('!docs' 'staticlibs' '!emptydirs')
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
        http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2
        Unlink-the-response-file.patch)
md5sums=('499161c65b639aa5c12a14944582b7ec'
         '8428efbbc6f6e2810ce5c1ba73ecf98c'
         '1f4d4ef71004261376d26d5ba6a84499')

if [ -n "${_snapshot}" ]; then
  _basedir=gcc-${_snapshot}
else
  _basedir=gcc-${pkgver}
fi

_libdir="usr/lib/gcc/$CHOST/$pkgver"

prepare() {
  cd ${srcdir}/${_basedir}

  # link isl for in-tree build
  ln -s ../isl-${_islver} isl

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

  # Parabola GNU/Linux-libre installs x86_64 libraries /lib
  [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64

  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

  # https://bugs.archlinux.org/task/47874 - commit f591a95d
  patch -p1 -i $srcdir/Unlink-the-response-file.patch

  mkdir ${srcdir}/gcc-build
}

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

  # using -pipe causes spurious test-suite failures
  # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
  # enable -fPIC for static libraries
  CFLAGS="${CFLAGS/-pipe/} -fPIC"
  CXXFLAGS="${CXXFLAGS/-pipe/} -fPIC"

  ${srcdir}/${_basedir}/configure --prefix=/usr \
      --libdir=/usr/lib \
      --with-bugurl=https://labs.parabola.nu/ \
      --enable-languages=c,c++,ada,fortran,lto,objc,obj-c++ \
      --disable-shared --enable-threads=posix --enable-libmpx \
      --with-system-zlib --with-isl --enable-__cxa_atexit \
      --disable-libunwind-exceptions --enable-clocale=gnu \
      --disable-libstdcxx-pch --disable-libssp \
      --enable-gnu-unique-object --enable-linker-build-id \
      --enable-lto --enable-plugin --enable-install-libiberty \
      --with-linker-hash-style=gnu --enable-gnu-indirect-function \
      --disable-multilib --disable-werror \
      --enable-checking=release

  make

  # --enble-languages=go

}

check() {
  cd ${srcdir}/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()
{
  pkgdesc="Runtime libraries shipped by GCC (static libraries only)"
  depends=('gcc-libs')
  options=('!emptydirs' '!strip' '!docs' 'staticlibs')

  cd ${srcdir}/gcc-build
  
  make -C $CHOST/libgcc DESTDIR=${pkgdir} install

  for lib in libatomic \
             libcilkrts \
             libgfortran \
             libgomp \
             libitm \
             libquadmath \
             libsanitizer/{a,l,ub}san \
             libstdc++-v3/src \
             libvtv; do
    make -C $CHOST/$lib DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
  done
  # libgo

  [[ $CARCH == "x86_64" ]] && \
    make -C $CHOST/libsanitizer/tsan DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES

  make -C $CHOST/libobjc DESTDIR=${pkgdir} install

  make -C $CHOST/libmpx DESTDIR=${pkgdir} install
  rm -v ${pkgdir}/usr/lib/libmpx.spec

  # remove conflicting files
  rm -vr ${pkgdir}/usr/lib/gcc
  rm -v ${pkgdir}/usr/lib/libstdc++.a
}