archrelease: copy trunk to community-any
[ArchLinux/community.git] / nds32le-elf-gcc / repos / community-x86_64 / PKGBUILD
blob6765a3bbc252f4cae0bc2214542ff9c343e4db90
1 # Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
2 # Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
3 # Contributor: Martin Schmölzer <mschmoelzer@gmail.com>
5 _target=nds32le-elf
6 pkgname=$_target-gcc
7 pkgver=12.2.0
8 pkgrel=1
9 #_snapshot=8-20180427
10 pkgdesc='The GNU Compiler Collection - cross compiler for Andes 32 little-endian (bare-metal) target'
11 arch=(x86_64)
12 url='https://gcc.gnu.org/'
13 license=(GPL LGPL FDL)
14 depends=($_target-binutils zlib libmpc libisl zstd)
15 makedepends=(gmp mpfr $_target-newlib)
16 optdepends=("$_target-newlib: Standard C library optimized for embedded systems")
17 options=(!emptydirs !strip !lto)
18 source=(https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz{,.sig}
19         #ftp://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.xz
20         )
21 sha512sums=('e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173'
22             'SKIP')
23 validpgpkeys=(D3A93CAD751C2AF4F8C7AD516C35B99309B5FA62  # Jakub Jelinek <jakub@redhat.com>
24               13975A70E63C361C73AE69EF6EEB81F8981C74C7) # Richard Guenther <richard.guenther@gmail.com>
26 if [ -n "$_snapshot" ]; then
27   _basedir=gcc-$_snapshot
28 else
29   _basedir=gcc-$pkgver
32 prepare() {
33   mkdir build-gcc
35   cd $_basedir
37   echo $pkgver > gcc/BASE-VER
40 build() {
41   cd build-gcc
43   CFLAGS=${CFLAGS/-Werror=format-security/}
44   CXXFLAGS=${CXXFLAGS/-Werror=format-security/}
46   export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
47   export CXXFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
49   "$srcdir"/$_basedir/configure \
50     --target=$_target \
51     --prefix=/usr \
52     --with-sysroot=/usr/$_target \
53     --with-native-system-header-dir=/include \
54     --libexecdir=/usr/lib \
55     --enable-languages=c,c++ \
56     --enable-threads=single \
57     --enable-plugins \
58     --enable-multilib \
59     --enable-libgcc \
60     --disable-libgomp \
61     --disable-libquadmath \
62     --disable-libffi \
63     --disable-libssp \
64     --disable-libmudflap \
65     --disable-decimal-float \
66     --disable-libstdcxx-pch \
67     --disable-nls \
68     --disable-shared \
69     --disable-tls \
70     --with-newlib \
71     --with-gnu-as \
72     --with-gnu-ld \
73     --with-system-zlib \
74     --with-headers=/usr/$_target/include \
75     --with-python-dir=share/gcc-$_target \
76     --with-gmp \
77     --with-mpfr \
78     --with-mpc \
79     --with-isl \
80     --with-libelf \
81     --enable-gnu-indirect-function \
82     --with-pkgversion="Arch Linux Repositories" \
83     --with-bugurl='https://bugs.archlinux.org/'
85   make
88 package() {
89   cd build-gcc
91   make DESTDIR="$pkgdir" install -j1
93   # strip target binaries
94   find "$pkgdir"/usr/lib/gcc/$_target/$pkgver "$pkgdir"/usr/$_target/lib \
95        -type f -and \( -name \*.a -or -name \*.o \) \
96        -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
97        -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
98        -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
100   # strip host binaries
101   find "$pkgdir"/usr/bin/ "$pkgdir"/usr/lib/gcc/$_target/$pkgver -type f -and \( -executable \) -exec strip '{}' \;
103   # Remove files that conflict with host gcc package
104   rm -r "$pkgdir"/usr/share/man/man7
105   rm -r "$pkgdir"/usr/share/info
106   rm "$pkgdir"/usr/lib/libcc1.*