busybox: Set CC fallback once

This commit is contained in:
Dylan Araps 2020-11-19 11:32:27 +02:00
parent e8f700827d
commit 9078f19763
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

View File

@ -5,18 +5,18 @@ for patch in *.patch; do
done done
# Remove forced gcc/g++ usage so builds work on gcc-less systems. # Remove forced gcc/g++ usage so builds work on gcc-less systems.
sed -i "s#= g[c+][c+]#= ${CC:-cc}#g" Makefile sed -i "s#= g[c+][c+]#= ${CC:=cc}#g" Makefile
sed -i "s#\(\$(CROSS_COMPILE)\)gcc#\1${CC:-cc}#g" Makefile sed -i "s#\(\$(CROSS_COMPILE)\)gcc#\1${CC}#g" Makefile
# Ensure that busybox's build system is aware that 'cc' may point # Ensure that busybox's build system is aware that 'cc' may point
# to clang rather than GCC. This is the case in non-GCC systems. # to clang rather than GCC. This is the case in non-GCC systems.
case $("${CC:-cc}" --version) in (*clang*) case $("$CC" --version) in (*clang*)
sed -i "s&\(\$(CC),\)clang&\1$CC&g" Makefile.flags sed -i "s&\(\$(CC),\)clang&\1${CC}&g" Makefile.flags
esac esac
# Build and install regular busybox. # Build and install regular busybox.
# This excludes utilities which require 'suid' to function. # This excludes utilities which require 'suid' to function.
make CC="${CC:-cc}" HOSTCC="${CC:-cc}" make CC="$CC" HOSTCC="$CC"
make CONFIG_PREFIX="$1/usr" install make CONFIG_PREFIX="$1/usr" install
# Rename the binary temporarily. # Rename the binary temporarily.
@ -25,7 +25,7 @@ mv "$1/usr/bin/busybox" "$1/usr/bin/busybox-nosuid"
# Build and install suid busybox. # Build and install suid busybox.
# This _only_ includes utlities which require 'suid' to function. # This _only_ includes utlities which require 'suid' to function.
cp -f .config-suid .config cp -f .config-suid .config
make CC="${CC:-cc}" HOSTCC="${CC:-cc}" make CC="$CC" HOSTCC="$CC"
make CONFIG_PREFIX="$1/usr" install make CONFIG_PREFIX="$1/usr" install
# Aptly name the busybox binaries. # Aptly name the busybox binaries.