archrelease: copy trunk to community-any
[ArchLinux/community.git] / riscv32-elf-gcc / repos / community-x86_64 / PKGBUILD
blob78cb32a64743dfd399ad55d2420b8fe63b4c63b9
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=riscv32-elf
6 pkgname=$_target-gcc
7 pkgver=9.3.0
8 _islver=0.22
9 pkgrel=1
10 #_snapshot=8-20180427
11 pkgdesc='The GNU Compiler Collection - cross compiler for RISCV32 (bare-metal) target'
12 arch=(x86_64)
13 url='https://gcc.gnu.org/'
14 license=(GPL LGPL FDL)
15 depends=($_target-binutils zlib libmpc)
16 makedepends=(gmp mpfr $_target-newlib)
17 optdepends=("$_target-newlib: Standard C library optimized for embedded systems")
18 options=(!emptydirs !strip)
19 source=(https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz{,.sig}
20         #ftp://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.xz
21         http://isl.gforge.inria.fr/isl-$_islver.tar.bz2)
22 sha512sums=('4b9e3639eef6e623747a22c37a904b4750c93b6da77cf3958d5047e9b5ebddb7eebe091cc16ca0a227c0ecbd2bf3b984b221130f269a97ee4cc18f9cf6c444de'
23             'SKIP'
24             'fc2c9796979610dd51143dcefe4f5c989c4354571cc5a1fcc6b932fd41f42a54f6b43adfd289af61be7bd06f3a523fa6a7d7ee56680e32d8036beb4c188fa668')
25 validpgpkeys=(33C235A34C46AA3FFB293709A328C3A2C3C45C06) # Jakub Jelinek <jakub@redhat.com>
27 if [ -n "$_snapshot" ]; then
28   _basedir=gcc-$_snapshot
29 else
30   _basedir=gcc-$pkgver
33 prepare() {
34   mkdir build-gcc
36   cd $_basedir
38   # link isl for in-tree builds
39   ln -s ../isl-$_islver isl
41   echo $pkgver > gcc/BASE-VER
43   # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
44   sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
47 build() {
48   cd build-gcc
50   export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
51   export CXXFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
53   "$srcdir"/$_basedir/configure \
54     --target=$_target \
55     --prefix=/usr \
56     --with-sysroot=/usr/$_target \
57     --with-native-system-header-dir=/include \
58     --libexecdir=/usr/lib \
59     --enable-languages=c,c++ \
60     --enable-threads=single \
61     --enable-plugins \
62     --enable-multilib \
63     --enable-libgcc \
64     --disable-libgomp \
65     --disable-libquadmath \
66     --disable-libffi \
67     --disable-libssp \
68     --disable-libmudflap \
69     --disable-decimal-float \
70     --disable-libstdcxx-pch \
71     --disable-nls \
72     --disable-shared \
73     --disable-tls \
74     --with-newlib \
75     --with-gnu-as \
76     --with-gnu-ld \
77     --with-system-zlib \
78     --with-headers=/usr/$_target/include \
79     --with-python-dir=share/gcc-$_target \
80     --with-gmp \
81     --with-mpfr \
82     --with-mpc \
83     --with-isl \
84     --with-libelf \
85     --enable-gnu-indirect-function \
86     --with-pkgversion="Arch Linux Repositories" \
87     --with-bugurl='https://bugs.archlinux.org/'
89   make
92 package() {
93   cd build-gcc
95   make DESTDIR="$pkgdir" install -j1
97   # strip target binaries
98   find "$pkgdir"/usr/lib/gcc/$_target/$pkgver "$pkgdir"/usr/$_target/lib \
99        -type f -and \( -name \*.a -or -name \*.o \) \
100        -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
101        -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
102        -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
104   # strip host binaries
105   find "$pkgdir"/usr/bin/ "$pkgdir"/usr/lib/gcc/$_target/$pkgver -type f -and \( -executable \) -exec strip '{}' \;
107   # Remove files that conflict with host gcc package
108   rm -r "$pkgdir"/usr/share/man/man7
109   rm -r "$pkgdir"/usr/share/info
110   rm "$pkgdir"/usr/lib/libcc1.*