archrelease: copy trunk to community-any
[ArchLinux/community.git] / riscv32-elf-newlib / trunk / PKGBUILD
bloba3c508ff45aec987db6806aeec273441f8c04a2d
1 # Maintainer: Filipe LaĆ­ns (FFY00) <lains@archlinux.org>
2 # Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
4 _target=riscv32-elf
5 pkgname=$_target-newlib
6 pkgver=3.3.0
7 pkgrel=2
8 _upstream_ver=$pkgver
9 pkgdesc='A C standard library implementation intended for use on embedded systems (RISCV32 bare metal)'
10 arch=(any)
11 url='https://www.sourceware.org/newlib/'
12 license=(BSD)
13 makedepends=($_target-gcc)
14 options=(!emptydirs !strip)
15 source=(https://sourceware.org/pub/newlib/newlib-$_upstream_ver.tar.gz)
16 sha256sums=('58dd9e3eaedf519360d92d84205c3deef0b3fc286685d1c562e245914ef72c66')
18 build() {
19   rm -rf build-{newlib,nano}
20   mkdir build-{newlib,nano}
22   export CFLAGS_FOR_TARGET='-g -O2 -ffunction-sections -fdata-sections'
23   cd "$srcdir"/build-newlib
24   ../newlib-$_upstream_ver/configure \
25     --target=$_target \
26     --prefix=/usr \
27     --enable-newlib-io-long-long \
28     --enable-newlib-io-c99-formats \
29     --enable-newlib-register-fini \
30     --enable-newlib-retargetable-locking \
31     --disable-newlib-supplied-syscalls \
32     --disable-nls
33   make
35   export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
36   cd "$srcdir"/build-nano
37   ../newlib-$_upstream_ver/configure \
38     --target=$_target \
39     --prefix=/usr \
40     --disable-newlib-supplied-syscalls \
41     --enable-newlib-reent-small \
42     --enable-newlib-retargetable-locking \
43     --disable-newlib-fvwrite-in-streamio \
44     --disable-newlib-fseek-optimization \
45     --disable-newlib-wide-orient \
46     --enable-newlib-nano-malloc \
47     --disable-newlib-unbuf-stream-opt \
48     --enable-lite-exit \
49     --enable-newlib-global-atexit \
50     --enable-newlib-nano-formatted-io \
51     --disable-nls
52   make
55 package() {
56   cd "$srcdir"/build-nano
57   make DESTDIR="$pkgdir" install -j1
58   find "$pkgdir" -regex ".*/lib\(c\|g\|rdimon\)\.a" -exec rename .a _nano.a '{}' \;
59   install -d "$pkgdir"/usr/$_target/include/newlib-nano
60   install -m644 -t "$pkgdir"/usr/$_target/include/newlib-nano "$pkgdir"/usr/$_target/include/newlib.h
62   cd "$srcdir"/build-newlib
63   make DESTDIR="$pkgdir" install -j1
65   find "$pkgdir"/usr/$_target/lib \( -name "*.a" -or -name "*.o" \) \
66        -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
67        -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
68        -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
70   install -d "$pkgdir"/usr/share/licenses/$pkgname/
71   install -m644 -t "$pkgdir"/usr/share/licenses/$pkgname/ "$srcdir"/newlib-$_upstream_ver/COPYING*