PKGBUILDs/n64-toolkit/PKGBUILD.newlib

72 lines
2.0 KiB
Plaintext

_target=mips64
_tuple=$_target-elf-ultra64
_prefix=/opt/$_tuple
pkgname=$_tuple-newlib
pkgver=3.1.0.20181231
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=("$_tuple-bootstrap")
source=("ftp://sourceware.org/pub/newlib/$_newlib.tar.gz")
md5sums=('d25fd33b39147d79741faece37dd33a8')
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 -G0 \
-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 \
'{}' \;
}