summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: accb2dd940d9fbbdb3090ba4381f6b41157bc869 (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
# Contributor: Vojtech Horky <vojta . horky at-symbol seznam . cz>
# Contributor: Shengqi Chen <i at harrychen dot xyz>
# Maintainer: Liao Junxuan <mikeljx at 126 dot com>

pkgname=mipsel-elf-gcc
_pkgname=gcc
_target="mipsel-elf"
pkgver=14.1.0
pkgrel=1
pkgdesc="The GNU Compiler Collection - C and C++ frontends (for baremetal MIPS)"
url="https://www.gnu.org/software/gcc/"
arch=('x86_64')
license=('GPL' 'LGPL' 'FDL' 'custom')
depends=("${_target}-binutils")
makedepends=("gcc-ada>=${pkgver:0:2}")
options=('!ccache' '!distcc' '!emptydirs' '!libtool' '!strip')
source=("https://ftp.gnu.org/gnu/gcc/gcc-${pkgver}/${_pkgname}-${pkgver}.tar.xz")
sha256sums=('e283c654987afe3de9d8080bc0bd79534b5ca0d681a73a11ff2b5d3767426840')

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

    # Hack - see native package for details
    sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
}

build() {
    CFLAGS=${CFLAGS/-Werror=format-security/}
    CXXFLAGS=${CXXFLAGS/-Werror=format-security/}

    cd "$srcdir"/${_pkgname}-${pkgver}
    mkdir -p gcc-build && cd gcc-build
    ../configure \
        --prefix=/usr --libexecdir=/usr/lib \
        --target="${_target}" \
        --with-newlib \
        --with-gnu-as --with-gnu-ld \
        --disable-nls \
        --disable-decimal-float \
        --disable-threads \
        --disable-libatomic \
        --disable-libgomp \
        --disable-libquadmath \
        --disable-libssp \
        --disable-libvtv \
        --disable-libstdcxx \
        --enable-languages=c,c++ \
        --disable-multilib --disable-libgcj \
        --enable-lto --disable-werror \
        --without-headers --disable-shared \
        --enable-initfini-array
    make
}

package() {
    cd "$srcdir"/${_pkgname}-${pkgver}
    cd gcc-build
    make DESTDIR="$pkgdir" install
    

    find "$pkgdir"/usr/lib/gcc/$_target/ \
       -type f -and \( -name \*.a -or -name \*.o \) \
       -exec "${_target}"-strip '{}' \;

    find "$pkgdir"/usr/bin/ "$pkgdir"/usr/lib/gcc/$_target/ \
        -type f -and \( -executable \) -exec strip '{}' \;

    # remove the documentation
    rm -rf "$pkgdir"/usr/share
    # remove unnecessary files
    rm "$pkgdir"/usr/lib/libcc1.*
}