PKGBUILDs/n64-toolkit/PKGBUILD.newlib

72 lines
2.0 KiB
Plaintext
Raw Normal View History

2017-05-16 10:00:05 -07:00
_target=mips64
2018-03-24 20:45:52 -07:00
_tuple=$_target-elf-ultra64
_prefix=/opt/$_tuple
pkgname=$_tuple-newlib
2019-01-23 20:25:05 -08:00
pkgver=3.1.0.20181231
2017-05-16 10:00:05 -07:00
pkgrel=1
_newlib="newlib-$pkgver"
2018-03-24 20:45:52 -07:00
pkgdesc="A C library intended for use on embedded systems ($_target)"
2017-05-16 10:00:05 -07:00
arch=('any')
license=('BSD')
url='http://sourceware.org/newlib/'
2018-03-24 20:45:52 -07:00
makedepends=("$_tuple-bootstrap")
2017-05-16 10:00:05 -07:00
source=("ftp://sourceware.org/pub/newlib/$_newlib.tar.gz")
2019-01-23 20:25:05 -08:00
md5sums=('d25fd33b39147d79741faece37dd33a8')
2017-05-16 10:00:05 -07:00
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=""
2019-01-25 22:36:38 -08:00
export CFLAGS_FOR_TARGET="-O2 -G0 \
2017-05-16 10:00:05 -07:00
-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
2018-03-24 20:45:52 -07:00
"../$_newlib/configure" $_build --target=$_target --prefix="$_prefix" \
2017-05-16 10:00:05 -07:00
--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 \
'{}' \;
}