From ba0947e4fb36e1b5b915f66ce223b55dd80bfb84 Mon Sep 17 00:00:00 2001 From: Lukas Martini Date: Tue, 12 Dec 2023 18:05:25 +0100 Subject: [PATCH] land/newlib: Build both shared+pic and static version --- land/newlib/PKGBUILD | 21 +++++++++++++++++++-- land/newlib/newlib-3.2.0.patch | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/land/newlib/PKGBUILD b/land/newlib/PKGBUILD index 907afe75..7a3907b8 100644 --- a/land/newlib/PKGBUILD +++ b/land/newlib/PKGBUILD @@ -1,6 +1,6 @@ pkgname=newlib pkgver=3.2.0 -pkgrel=7 +pkgrel=8 pkgdesc="Newlib is a C library intended for use on embedded systems." arch=('i786') url="https://sourceware.org/newlib/" @@ -34,7 +34,8 @@ prepare() { build() { cd $pkgname-$pkgver - CFLAGS="" CPPFLAGS="" LDFLAGS="-g" ./configure \ + # Shared/position-independent build + CFLAGS_FOR_TARGET="-fPIC" CFLAGS="" CPPFLAGS="" LDFLAGS="" ./configure \ --target=i786-pc-xelix \ --prefix=/usr \ --exec-prefix=/usr \ @@ -45,8 +46,24 @@ build() { --enable-newlib-io-long-long \ --enable-newlib-io-long-double + make clean make -j$(nproc) all-target-newlib i786-pc-xelix-gcc -shared -Wl,--whole-archive -Wl,--allow-multiple-definition -nodefaultlibs -ffreestanding -o libc.so i786-pc-xelix/newlib/libc.a + + # Static build + make distclean + CFLAGS="" CPPFLAGS="" LDFLAGS="" ./configure \ + --target=i786-pc-xelix \ + --prefix=/usr \ + --exec-prefix=/usr \ + --sysconfdir=/etc \ + --enable-newlib-mb \ + --enable-newlib-iconv \ + --enable-newlib-io-c99-formats \ + --enable-newlib-io-long-long \ + --enable-newlib-io-long-double + + make -j$(nproc) all-target-newlib } package() { diff --git a/land/newlib/newlib-3.2.0.patch b/land/newlib/newlib-3.2.0.patch index 1d4957a1..3582b71e 100644 --- a/land/newlib/newlib-3.2.0.patch +++ b/land/newlib/newlib-3.2.0.patch @@ -101,7 +101,7 @@ diff -rupN newlib-3.2.0/newlib/libc/sys/configure.in newlib-3.2.0-xelix/newlib/l ;; + *-*-xelix*) + syscall_dir=syscalls -+ newlib_cflags="${newlib_cflags} -DHAVE_FCNTL -DHAVE_MMAP -fPIC -ggdb" ++ newlib_cflags="${newlib_cflags} -DHAVE_FCNTL -DHAVE_MMAP" + ;; xstormy16-*-*) syscall_dir=syscalls