archrelease: copy trunk to community-any
[ArchLinux/community.git] / riscv64-elf-newlib / repos / community-any / PKGBUILD
bloba82a0dbff8bfae29928d14865ad3d0a94cf006f7
1 # Maintainer: Filipe LaĆ­ns (FFY00) <lains@archlinux.org>
2 # Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
4 _target=riscv64-elf
5 pkgname=$_target-newlib
6 pkgver=4.1.0
7 pkgrel=3
8 _upstream_ver=$pkgver
9 pkgdesc='A C standard library implementation intended for use on embedded systems (RISCV64 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 sha512sums=('6a24b64bb8136e4cd9d21b8720a36f87a34397fd952520af66903e183455c5cf19bb0ee4607c12a05d139c6c59382263383cb62c461a839f969d23d3bc4b1d34')
18 build() {
19   rm -rf build-{newlib,nano}
20   mkdir build-{newlib,nano}
22   cd "$srcdir"/build-newlib
24   export CFLAGS_FOR_TARGET='-g -O2 -ffunction-sections -fdata-sections'
25   ../newlib-$_upstream_ver/configure \
26     --target=$_target \
27     --prefix=/usr \
28     --enable-newlib-io-long-long \
29     --enable-newlib-io-c99-formats \
30     --enable-newlib-register-fini \
31     --enable-newlib-retargetable-locking \
32     --disable-newlib-supplied-syscalls \
33     --disable-nls
34   make
36   cd "$srcdir"/build-nano
38   export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
39   ../newlib-$_upstream_ver/configure \
40     --target=$_target \
41     --prefix=/usr \
42     --disable-newlib-supplied-syscalls \
43     --enable-newlib-reent-small \
44     --enable-newlib-retargetable-locking \
45     --disable-newlib-fvwrite-in-streamio \
46     --disable-newlib-fseek-optimization \
47     --disable-newlib-wide-orient \
48     --enable-newlib-nano-malloc \
49     --disable-newlib-unbuf-stream-opt \
50     --enable-lite-exit \
51     --enable-newlib-global-atexit \
52     --enable-newlib-nano-formatted-io \
53     --disable-nls
54   make
57 package() {
58   cd "$srcdir"/build-nano
60   make DESTDIR="$pkgdir" install -j1
62   find "$pkgdir" -regex ".*/lib\(c\|g\|m\|rdimon\|gloss\)\.a" -exec rename .a _nano.a '{}' \;
63   install -d "$pkgdir"/usr/$_target/include/newlib-nano
64   install -m644 -t "$pkgdir"/usr/$_target/include/newlib-nano "$pkgdir"/usr/$_target/include/newlib.h
66   cd "$srcdir"/build-newlib
68   make DESTDIR="$pkgdir" install -j1
70   find "$pkgdir"/usr/$_target/lib \( -name "*.a" -or -name "*.o" \) \
71        -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
72        -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
73        -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
75   install -d "$pkgdir"/usr/share/licenses/$pkgname/
76   install -m644 -t "$pkgdir"/usr/share/licenses/$pkgname/ "$srcdir"/newlib-$_upstream_ver/COPYING*