changeset 1164:872dc291306a

lib/musl: add STATIC option
author David Demelier <markand@malikania.fr>
date Tue, 08 Oct 2019 20:04:00 +0200
parents d3090b82aea1
children 8d2032c88258
files lib/musl/musl.sh
diffstat 1 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lib/musl/musl.sh	Mon Oct 07 20:10:00 2019 +0200
+++ b/lib/musl/musl.sh	Tue Oct 08 20:04:00 2019 +0200
@@ -23,11 +23,18 @@
 PKGLICENSE="MIT"
 PKGSUMMARY="a new lightweight, fast, simple, free and correct C library"
 PKGDOWNLOAD="https://www.musl-libc.org/releases/$PKGNAME-$PKGVERSION.tar.gz"
+PKGOPTIONS="STATIC"
 PKGDEPENDS="linux-headers:build"
-PKGPRESERVE="lib/ld-musl-x86_64.so.1"
 
 : ${CC:=clang}
 : ${CFLAGS:=-O2}
+: ${STATIC:=no}
+
+if [ "$STATIC" = "yes" ]; then
+	with_static="--disable-shared"
+else
+	PKGPRESERVE="lib/ld-musl-x86_64.so.1"
+fi
 
 build()
 {
@@ -37,11 +44,19 @@
 
 	CC="$CC" \
 	CFLAGS="$CFLAGS" \
-	./configure --prefix=
-	make
-	make install DESTDIR=$DESTDIR
-	mkdir -p $DESTDIR/bin
-	ln -sf /lib/ld-musl-x86_64.so.1 $DESTDIR/bin/ldd
+	./configure \
+		--prefix= \
+		$with_static
+	make \
+		AR=llvm-ar \
+		RANLIB=llvm-ranlib \
+		DESTDIR=$DESTDIR \
+		all install
+
+	if [ "$STATIC" != "yes" ]; then
+		mkdir -p $DESTDIR/bin
+		ln -sf /lib/ld-musl-x86_64.so.1 $DESTDIR/bin/ldd
+	fi
 
 	cd ..
 	rm -rf $PKGNAME-$PKGVERSION