core/busybox: disable compiler extensions for clang

Fri, 25 Oct 2019 20:03:00 +0200

author
David Demelier <markand@malikania.fr>
date
Fri, 25 Oct 2019 20:03:00 +0200
changeset 1180
99c240ea1b56
parent 1179
73a7fdc6d516
child 1181
0728f1d39ad9

core/busybox: disable compiler extensions for clang

While here:

- add PKGWWW,
- add more tunables (AR, AS and such).

core/busybox/busybox.sh file | annotate | diff | comparison | revisions
--- a/core/busybox/busybox.sh	Wed Oct 23 13:58:58 2019 +0200
+++ b/core/busybox/busybox.sh	Fri Oct 25 20:03:00 2019 +0200
@@ -20,19 +20,26 @@
 PKGREVISION=1
 PKGLICENSE="GPLv2"
 PKGSUMMARY="swiss army knife for embedded"
+PKGWWW="https://busybox.net"
 PKGDOWNLOAD="https://busybox.net/downloads/$PKGNAME-$PKGVERSION.tar.bz2"
 PKGDEPENDS="linux-headers:build"
 PKGOPTIONS="CONFIG IPV6 PAM SELINUX STATIC"
 PKGPROTECT="etc/udhcpd.conf"
 
+: ${AR:=llvm-ar}
+: ${AS:=llvm-as}
 : ${CC:=clang}
 : ${CFLAGS:=-O2}
 : ${LDFLAGS:=}
+: ${NM:=llvm-nm}
+: ${OBJCOPY:=llvm-objcopy}
+: ${OBJDUMP:=llvm-objdump}
+: ${STRIP:=llvm-strip}
 : ${CONFIG:=}
 : ${IPV6:=yes}
 : ${PAM:=no}
 : ${SELINUX:=no}
-: ${STATIC:=no}
+: ${STATIC:=yes}
 
 build()
 {
@@ -52,10 +59,10 @@
 		# to a dummy value to avoid incorrect information in package
 		# file.
 		#
-		IPV6="ignored"
-		SELINUX="ignored"
-		PAM="ignored"
-		STATIC="ignored"
+		IPV6=""
+		SELINUX=""
+		PAM=""
+		STATIC=""
 	else
 		cp ../config .config
 
@@ -80,12 +87,31 @@
 	fi
 
 	# Our start script is located in /etc/rc.init.
+	# Upstream: rejected a tunable option.
 	sed -i -e 's|/etc/init.d/rcS|/etc/rc.init|' init/init.c
 
 	# Change the redirection limit which is too small for vpk download.
+	# Upstream: yes in Git.
 	sed -i -e "/redir_limit = 5/ s/5/16/" networking/wget.c
 
-	make CC="$CC" HOSTCC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CROSS_COMPILE=llvm-
+	#
+	# CFLAGS="": fix build under clang by removing all non-standard
+	# options.
+	#
+	make \
+		AR="$AR" \
+		AS="$AS" \
+		CC="$CC" \
+		CFLAGS="" \
+		HOSTCC="$CC" \
+		HOSTCFLAGS="" \
+		EXTRA_CFLAGS="$CFLAGS" \
+		EXTRA_LDFLAGS="$LDFLAGS" \
+		NM="$NM" \
+		OBJCOPY="$OBJCOPY" \
+		OBJDUMP="$OBJDUMP" \
+		STRIP="$STRIP" \
+		V=1
 	install -Dm0755 busybox $DESTDIR/bin/busybox
 	install -dm0755 $DESTDIR/share/udhcp
 	install -m0644 examples/udhcp/sample.* $DESTDIR/share/udhcp

mercurial