commit:     529576b64de23b81d34f5b820893bdeb30ee1caf
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 27 13:53:31 2024 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Sat Apr 27 13:53:31 2024 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=529576b6

gkbuilds/busybox: rework toolchain handling

Thanks to Mike Gilbert, code changes borrowed from gentoo.git commit
25e0a98682b9ab600cb3a6ea3fc3834ce1cce8f6

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 gkbuilds/busybox.gkbuild | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/gkbuilds/busybox.gkbuild b/gkbuilds/busybox.gkbuild
index ac09363..cf1e4bc 100644
--- a/gkbuilds/busybox.gkbuild
+++ b/gkbuilds/busybox.gkbuild
@@ -9,14 +9,6 @@ src_prepare() {
                -e 
's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g'
 \
                Makefile.flags || gen_die
 
-       sed -i \
-               -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
-               -e "/^CC\>/s:=.*:= $(tc-getCC):" \
-               -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
-               -e "/^HOSTCXX/s:=.*:= $(tc-getBUILD_CXX):" \
-               -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
-               Makefile || gen_die
-
        sed -i \
                -e 's:-static-libgcc::' \
                Makefile.flags || die
@@ -28,8 +20,28 @@ src_prepare() {
                || die "Failed top copy '${TEMP}/busybox-config' to 
'${S}/.config.gk_orig'!"
 }
 
+bbmake() {
+       local args=(
+               V=1
+               CROSS_COMPILE="${CHOST}-"
+               AR="${AR}"
+               CC="${CC}"
+               HOSTCC="${BUILD_CC}"
+               HOSTCFLAGS="${BUILD_CFLAGS}"
+               PKG_CONFIG="${PKG_CONFIG}"
+       )
+       make "${args[@]}" "$@"
+}
+
 src_configure() {
-       gkexec "yes '' | ${MAKE} V=1 oldconfig" 1
+       tc-export AR CC BUILD_CC PKG_CONFIG
+       BUILD_CFLAGS=${CFLAGS}
+       BUILD_CFLAGS+=" -D_FILE_OFFSET_BITS=64"
+       gkexec "yes '' | bbmake V=1 oldconfig" 1
+}
+
+src_compile() {
+       bbmake busybox
 }
 
 src_install() {

Reply via email to