_target=mips64 _prefix="/opt/n64-toolchain-slim" pkgname=n64-toolkit-newlib pkgver=2.5.0.20171222 pkgrel=1 _newlib="newlib-$pkgver" pkgdesc="A C library intended for use on embedded systems (${_target})" arch=('any') license=('BSD') url='http://sourceware.org/newlib/' makedepends=('n64-toolkit-bootstrap') source=("ftp://sourceware.org/pub/newlib/$_newlib.tar.gz") md5sums=('98215f83a542fdde946c11661a34ab3f') options=('!emptydirs' '!strip') build() { export PATH="$PATH:$_prefix/bin" # the programs we're compiling are really picky about flags. # it's best to keep it simple. export CFLAGS="-O2" export CXXFLAGS="-O2" export CPPFLAGS="" export LDFLAGS="" export CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections \ -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables" export CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET -fno-rtti" cd "$srcdir" [ -d "build-newlib" ] || mkdir "build-newlib" cd "build-newlib" local _build= if [ -n "$MINGW_CHOST" ]; then _build="--build=$MINGW_CHOST --host=$MINGW_CHOST" fi "../$_newlib/configure" $_build --target=${_target} --prefix="$_prefix" \ --with-newlib \ --enable-lto \ --enable-target-optspace \ --enable-lite-exit \ --enable-newlib-global-atexit \ --enable-newlib-nano-malloc \ --disable-shared \ --disable-threads \ --disable-newlib-atexit-dynamic-alloc \ --disable-newlib-fvwrite-in-streamio \ --disable-newlib-wide-orient \ --disable-newlib-unbuf-stream-opt \ --disable-newlib-supplied-syscalls \ #--enable-newlib-nano-formatted-io make } package() { export PATH="$PATH:$_prefix/bin" local PREFIX="$pkgdir$_prefix" cd "$srcdir/build-newlib" make DESTDIR="$pkgdir" install -j1 # strip target binaries find "$PREFIX/$_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 \ '{}' \; }