_target=mips _triplet="$_target-ultra64-elf" _prefix="/opt/$_triplet" _sysroot="$_prefix/sysroot" pkgname="$_triplet-newlib" pkgver=4.1.0 pkgrel=3 _newlib="newlib-$pkgver" pkgdesc="A C library intended for use on embedded systems ($_triplet)" arch=('any') license=('BSD') url='http://sourceware.org/newlib/' makedepends=("$_triplet-bootstrap") source=("ftp://sourceware.org/pub/newlib/$_newlib.tar.gz") sha256sums=('f296e372f51324224d387cc116dc37a6bd397198756746f93a2b02e9a5d40154') 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="-Os -G0 -fcommon -ffunction-sections -fdata-sections" 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" \ \ --disable-libssp \ --disable-newlib-atexit-dynamic-alloc \ --disable-newlib-fvwrite-in-streamio \ --disable-newlib-supplied-syscalls \ --disable-newlib-unbuf-stream-opt \ --disable-newlib-wide-orient \ --disable-nls \ --disable-shared \ --disable-threads \ --enable-lite-exit \ --enable-lto \ --enable-newlib-global-atexit \ --enable-newlib-nano-malloc \ --enable-target-optspace \ --with-newlib \ 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 \ '{}' \; }