summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7fdd3d653017cf00bd9d820fd221fe0802178172 (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
# Maintainer: Tyler Veness <calcmogul at gmail dot com>

_target="arm-frc-linux-gnueabi"
pkgname=${_target}-gcc
pkgver=4.9.4
pkgrel=2
pkgdesc="The GNU Compiler Collection (${_target})"
arch=(i686 x86_64)
license=('GPL' 'LGPL')
url="http://gcc.gnu.org"
groups=('frc-2016')
depends=("${_target}-binutils" "${_target}-eglibc" 'libmpc' 'elfutils')
options=('!buildflags' '!libtool' '!emptydirs' 'zipman' 'docs'
  '!strip' 'staticlibs')
source=("ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2"
        "minorSOname.patch"
        "no-nested-deprecated-warnings.patch")
md5sums=('87c24a4090c1577ba817ec6882602491'
         'eac80070a6324fc67ed5b3ac85551789'
         '507f0b6c95ad5ff8e436697ae093a10d')

prepare() {
  cd "${srcdir}/gcc-${pkgver}"

  echo ${pkgver} > gcc/BASE-VER

  patch -p1 < ${srcdir}/minorSOname.patch
  patch -p1 < ${srcdir}/no-nested-deprecated-warnings.patch

  mkdir ${srcdir}/gcc-build
}

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

  ${srcdir}/gcc-${pkgver}/configure \
    --prefix=/usr \
    --program-prefix=${_target}- \
    --target=${_target} \
    --host=$CHOST \
    --build=$CHOST \
    --enable-shared \
    --disable-nls \
    --enable-threads=posix \
    --enable-languages=c,c++ \
    --disable-multilib \
    --disable-multiarch \
    --with-sysroot=/usr/${_target} \
    --with-build-sysroot=/usr/${_target} \
    --with-as=/usr/bin/${_target}-as \
    --with-ld=/usr/bin/${_target}-ld \
    --with-cpu=cortex-a9 \
    --with-float=softfp \
    --with-fpu=vfp \
    --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' \
    --enable-lto \
    --with-pkgversion='GCC for FRC' \
    --with-cloog \
    --enable-poison-system-directories \
    --enable-plugin \
    --with-system-zlib \
    --disable-libmudflap

  make all-gcc all-target-libgcc all-target-libstdc++-v3
}

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

  make "DESTDIR=$pkgdir" install-gcc install-target-libgcc \
    install-target-libstdc++-v3

  rm -rf "$pkgdir"/usr/share/{man/man7,info}/

  cp -r "$pkgdir"/usr/libexec/* "$pkgdir/usr/lib/"
  rm -rf "$pkgdir/usr/libexec"

  rm -rf "$pkgdir/usr/share/gcc-${pkgver}/python"

  # strip it manually
  strip "$pkgdir"/usr/bin/* 2>/dev/null || true
  find "$pkgdir"/usr/lib -type f -exec /usr/bin/${_target}-strip \
    --strip-unneeded {} \; 2>/dev/null || true
}