summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing2019-10-26 15:01:56 +0200
committerEmil Renner Berthing2019-10-26 15:01:56 +0200
commit05120cd6283635ee340f0ddd3c9163e6f69839e9 (patch)
treea017bc69f823ad5c5baf3f5325b997487d12c9cb
downloadaur-05120cd6283635ee340f0ddd3c9163e6f69839e9.tar.gz
initial commit
-rw-r--r--.SRCINFO15
-rw-r--r--PKGBUILD76
2 files changed, 91 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..85acfb847ed5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,15 @@
+pkgbase = riscv64-unknown-elf-newlib
+ pkgdesc = A C standard library implementation intended for use on embedded systems (microcontrollers)
+ pkgver = 3.1.0.20181231
+ pkgrel = 1
+ url = https://www.sourceware.org/newlib/
+ arch = any
+ license = BSD
+ makedepends = riscv64-unknown-elf-gcc
+ options = !emptydirs
+ options = !strip
+ source = https://sourceware.org/pub/newlib/newlib-3.1.0.20181231.tar.gz
+ sha256sums = 9e12fea7297648b114434033ed4458755afe7b9b6c7d58123389e82bd37681c0
+
+pkgname = riscv64-unknown-elf-newlib
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..de58bacb82cb
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,76 @@
+# Maintainer: Emil Renner Berthing <aur@esmil.dk>
+
+_target=riscv64-unknown-elf
+pkgname=$_target-newlib
+pkgver=3.1.0.20181231
+pkgrel=1
+pkgdesc='A C standard library implementation intended for use on embedded systems (microcontrollers)'
+arch=('any')
+url='https://www.sourceware.org/newlib/'
+license=('BSD')
+makedepends=("$_target-gcc")
+options=(!emptydirs !strip)
+source=("https://sourceware.org/pub/newlib/newlib-${pkgver}.tar.gz")
+sha256sums=('9e12fea7297648b114434033ed4458755afe7b9b6c7d58123389e82bd37681c0')
+
+build() {
+ mkdir build-{newlib,nano}
+
+ cd "$srcdir/build-newlib"
+ ../newlib-$pkgver/configure \
+ CFLAGS_FOR_TARGET='-g -O2 -mcmodel=medany -ffunction-sections -fdata-sections' \
+ --target=$_target \
+ --prefix=/usr \
+ --enable-newlib-io-long-long \
+ --enable-newlib-io-c99-formats \
+ --enable-newlib-register-fini \
+ --enable-newlib-retargetable-locking \
+ --disable-newlib-supplied-syscalls \
+ --disable-nls
+ make
+
+ cd "$srcdir/build-nano"
+ ../newlib-$pkgver/configure \
+ CFLAGS_FOR_TARGET='-g -Os -mcmodel=medlow -ffunction-sections -fdata-sections' \
+ --target=$_target \
+ --prefix=/usr \
+ --disable-newlib-supplied-syscalls \
+ --enable-newlib-reent-small \
+ --enable-newlib-retargetable-locking \
+ --disable-newlib-fvwrite-in-streamio \
+ --disable-newlib-fseek-optimization \
+ --disable-newlib-wide-orient \
+ --enable-newlib-nano-malloc \
+ --disable-newlib-unbuf-stream-opt \
+ --enable-lite-exit \
+ --enable-newlib-global-atexit \
+ --enable-newlib-nano-formatted-io \
+ --disable-nls
+ make
+}
+
+package() {
+ local file
+
+ cd "$srcdir/build-nano"
+ make -j1 DESTDIR="$pkgdir" install
+
+ while read -r file; do
+ mv "$file" "${file%.a}_nano.a"
+ done < <(exec find "$pkgdir" -name libc.a -or -name libg.a -or -name libgloss.a)
+
+ install -dm755 "$pkgdir/usr/$_target/include/newlib-nano"
+ install -m644 "$pkgdir/usr/$_target/include/newlib.h" \
+ "$pkgdir/usr/$_target/include/newlib-nano/"
+
+ cd "$srcdir/build-newlib"
+ make -j1 DESTDIR="$pkgdir" install
+
+ find "$pkgdir/usr/$_target/lib" \( -name '*.a' -or -name '*.o' \) -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
+
+ install -dm755 "$pkgdir/usr/share/licenses/$pkgname"
+ install -m644 "$srcdir"/newlib-$pkgver/COPYING* \
+ "$pkgdir"/usr/share/licenses/$pkgname/
+}
+
+# vim: set ts=2 sw=2 et: