Skip to content

Commit

Permalink
land/newlib: Build both shared+pic and static version
Browse files Browse the repository at this point in the history
  • Loading branch information
lutoma committed Dec 12, 2023
1 parent 189ba42 commit ba0947e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions land/newlib/PKGBUILD
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down Expand Up @@ -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 \
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion land/newlib/newlib-3.2.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba0947e

Please sign in to comment.