commit:     25e0a98682b9ab600cb3a6ea3fc3834ce1cce8f6
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 26 18:04:46 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 18:06:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25e0a986

sys-apps/busybox: rework toolchain handling

Pass toolchain vars as arguments to make to avoid using sed on Makefile.

Unsilence make so we can see what is actually being executed in
src_configure.

Append -D_FILE_OFFSET_BITS=64 to BUILD_CFLAGS and pass this as
HOSTCFLAGS to resolve LFS issue on 32-bit archs.

Closes: https://bugs.gentoo.org/930513
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-apps/busybox/busybox-1.36.1-r1.ebuild | 45 +++++++++++++++++++------------
 sys-apps/busybox/busybox-1.36.1-r2.ebuild | 45 +++++++++++++++++++------------
 sys-apps/busybox/busybox-9999.ebuild      | 45 +++++++++++++++++++------------
 3 files changed, 84 insertions(+), 51 deletions(-)

diff --git a/sys-apps/busybox/busybox-1.36.1-r1.ebuild 
b/sys-apps/busybox/busybox-1.36.1-r1.ebuild
index 78c429beefc9..98369ddbf32e 100644
--- a/sys-apps/busybox/busybox-1.36.1-r1.ebuild
+++ b/sys-apps/busybox/busybox-1.36.1-r1.ebuild
@@ -87,9 +87,6 @@ PATCHES=(
 
 src_prepare() {
        default
-       unset KBUILD_OUTPUT #88088
-       append-flags -fno-strict-aliasing #310413
-       use ppc64 && append-flags -mminimal-toc #130943
 
        cp "${FILESDIR}"/ginit.c init/ || die
 
@@ -97,13 +94,6 @@ src_prepare() {
        sed -i -r \
                -e 
's:[[:space:]]?-(Werror|Os|Oz|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g'
 \
                Makefile.flags || die
-       sed -i \
-               -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
-               -e "/^AR\>/s:=.*:= $(tc-getAR):" \
-               -e "/^CC\>/s:=.*:= $(tc-getCC):" \
-               -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
-               -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
-               Makefile || die
        sed -i \
                -e 's:-static-libgcc::' \
                Makefile.flags || die
@@ -112,13 +102,34 @@ src_prepare() {
        sed -i -e 's:debug=false:debug=true:' scripts/trylink || die
 }
 
+bbmake() {
+       local args=(
+               V=1
+               CROSS_COMPILE="${CHOST}-"
+               AR="${AR}"
+               CC="${CC}"
+               HOSTCC="${BUILD_CC}"
+               HOSTCFLAGS="${BUILD_CFLAGS}"
+               PKG_CONFIG="${PKG_CONFIG}"
+       )
+       emake "${args[@]}" "$@"
+}
+
 src_configure() {
+       tc-export AR CC BUILD_CC PKG_CONFIG
+
+       tc-is-cross-compiler || BUILD_CFLAGS=${CFLAGS}
+       BUILD_CFLAGS+=" -D_FILE_OFFSET_BITS=64" #930513
+
+       append-flags -fno-strict-aliasing #310413
+       use ppc64 && append-flags -mminimal-toc #130943
+
        # check for a busybox config before making one of our own.
        # if one exist lets return and use it.
 
        restore_config .config
        if [ -f .config ]; then
-               yes "" | emake -j1 -s oldconfig >/dev/null
+               yes "" | bbmake -j1 oldconfig
                return 0
        else
                ewarn "Could not locate user configfile, so we will save a 
default one"
@@ -127,11 +138,11 @@ src_configure() {
        # setting SKIP_SELINUX skips searching for selinux at this stage. We 
don't
        # need to search now in case we end up not needing it after all.
        # setup the config file
-       emake -j1 -s allyesconfig SKIP_SELINUX=$(usex selinux n y) >/dev/null 
#620918
+       bbmake -j1 allyesconfig SKIP_SELINUX=$(usex selinux n y) #620918
        # nommu forces a bunch of things off which we want on #387555
        busybox_config_option n NOMMU
        sed -i '/^#/d' .config
-       yes "" | emake -j1 -s oldconfig SKIP_SELINUX=$(usex selinux n y) 
>/dev/null #620918
+       yes "" | bbmake -j1 oldconfig SKIP_SELINUX=$(usex selinux n y) #620918
 
        # now turn off stuff we really don't want
        busybox_config_option n DMALLOC
@@ -221,17 +232,17 @@ src_configure() {
                busybox_config_option n ${opt}
        done
 
-       emake -j1 oldconfig > /dev/null
+       bbmake -j1 oldconfig
 }
 
 src_compile() {
        unset KBUILD_OUTPUT #88088
        export SKIP_STRIP=y
 
-       emake V=1 busybox
+       bbmake busybox
 
        # bug #701512
-       emake V=1 doc
+       bbmake doc
 }
 
 src_install() {
@@ -304,7 +315,7 @@ src_install() {
        fi
 
        # bundle up the symlink files for use later
-       emake DESTDIR="${ED}" install
+       bbmake DESTDIR="${ED}" install
        # for compatibility, provide /usr/bin/env
        mkdir -p _install/usr/bin || die
        if [[ ! -e _install/usr/bin/env ]]; then

diff --git a/sys-apps/busybox/busybox-1.36.1-r2.ebuild 
b/sys-apps/busybox/busybox-1.36.1-r2.ebuild
index 74082ac77ae5..fc700c3b31e4 100644
--- a/sys-apps/busybox/busybox-1.36.1-r2.ebuild
+++ b/sys-apps/busybox/busybox-1.36.1-r2.ebuild
@@ -88,9 +88,6 @@ PATCHES=(
 
 src_prepare() {
        default
-       unset KBUILD_OUTPUT #88088
-       append-flags -fno-strict-aliasing #310413
-       use ppc64 && append-flags -mminimal-toc #130943
 
        cp "${FILESDIR}"/ginit.c init/ || die
 
@@ -98,13 +95,6 @@ src_prepare() {
        sed -i -r \
                -e 
's:[[:space:]]?-(Werror|Os|Oz|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g'
 \
                Makefile.flags || die
-       sed -i \
-               -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
-               -e "/^AR\>/s:=.*:= $(tc-getAR):" \
-               -e "/^CC\>/s:=.*:= $(tc-getCC):" \
-               -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
-               -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
-               Makefile || die
        sed -i \
                -e 's:-static-libgcc::' \
                Makefile.flags || die
@@ -113,13 +103,34 @@ src_prepare() {
        sed -i -e 's:debug=false:debug=true:' scripts/trylink || die
 }
 
+bbmake() {
+       local args=(
+               V=1
+               CROSS_COMPILE="${CHOST}-"
+               AR="${AR}"
+               CC="${CC}"
+               HOSTCC="${BUILD_CC}"
+               HOSTCFLAGS="${BUILD_CFLAGS}"
+               PKG_CONFIG="${PKG_CONFIG}"
+       )
+       emake "${args[@]}" "$@"
+}
+
 src_configure() {
+       tc-export AR CC BUILD_CC PKG_CONFIG
+
+       tc-is-cross-compiler || BUILD_CFLAGS=${CFLAGS}
+       BUILD_CFLAGS+=" -D_FILE_OFFSET_BITS=64" #930513
+
+       append-flags -fno-strict-aliasing #310413
+       use ppc64 && append-flags -mminimal-toc #130943
+
        # check for a busybox config before making one of our own.
        # if one exist lets return and use it.
 
        restore_config .config
        if [ -f .config ]; then
-               yes "" | emake -j1 -s oldconfig >/dev/null
+               yes "" | bbmake -j1 oldconfig
                return 0
        else
                ewarn "Could not locate user configfile, so we will save a 
default one"
@@ -128,11 +139,11 @@ src_configure() {
        # setting SKIP_SELINUX skips searching for selinux at this stage. We 
don't
        # need to search now in case we end up not needing it after all.
        # setup the config file
-       emake -j1 -s allyesconfig SKIP_SELINUX=$(usex selinux n y) >/dev/null 
#620918
+       bbmake -j1 allyesconfig SKIP_SELINUX=$(usex selinux n y) #620918
        # nommu forces a bunch of things off which we want on #387555
        busybox_config_option n NOMMU
        sed -i '/^#/d' .config
-       yes "" | emake -j1 -s oldconfig SKIP_SELINUX=$(usex selinux n y) 
>/dev/null #620918
+       yes "" | bbmake -j1 oldconfig SKIP_SELINUX=$(usex selinux n y) #620918
 
        # now turn off stuff we really don't want
        busybox_config_option n DMALLOC
@@ -222,17 +233,17 @@ src_configure() {
                busybox_config_option n ${opt}
        done
 
-       emake -j1 oldconfig > /dev/null
+       bbmake -j1 oldconfig
 }
 
 src_compile() {
        unset KBUILD_OUTPUT #88088
        export SKIP_STRIP=y
 
-       emake V=1 busybox
+       bbmake busybox
 
        # bug #701512
-       emake V=1 doc
+       bbmake doc
 }
 
 src_install() {
@@ -305,7 +316,7 @@ src_install() {
        fi
 
        # bundle up the symlink files for use later
-       emake DESTDIR="${ED}" install
+       bbmake DESTDIR="${ED}" install
        # for compatibility, provide /usr/bin/env
        mkdir -p _install/usr/bin || die
        if [[ ! -e _install/usr/bin/env ]]; then

diff --git a/sys-apps/busybox/busybox-9999.ebuild 
b/sys-apps/busybox/busybox-9999.ebuild
index 74082ac77ae5..fc700c3b31e4 100644
--- a/sys-apps/busybox/busybox-9999.ebuild
+++ b/sys-apps/busybox/busybox-9999.ebuild
@@ -88,9 +88,6 @@ PATCHES=(
 
 src_prepare() {
        default
-       unset KBUILD_OUTPUT #88088
-       append-flags -fno-strict-aliasing #310413
-       use ppc64 && append-flags -mminimal-toc #130943
 
        cp "${FILESDIR}"/ginit.c init/ || die
 
@@ -98,13 +95,6 @@ src_prepare() {
        sed -i -r \
                -e 
's:[[:space:]]?-(Werror|Os|Oz|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g'
 \
                Makefile.flags || die
-       sed -i \
-               -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
-               -e "/^AR\>/s:=.*:= $(tc-getAR):" \
-               -e "/^CC\>/s:=.*:= $(tc-getCC):" \
-               -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
-               -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
-               Makefile || die
        sed -i \
                -e 's:-static-libgcc::' \
                Makefile.flags || die
@@ -113,13 +103,34 @@ src_prepare() {
        sed -i -e 's:debug=false:debug=true:' scripts/trylink || die
 }
 
+bbmake() {
+       local args=(
+               V=1
+               CROSS_COMPILE="${CHOST}-"
+               AR="${AR}"
+               CC="${CC}"
+               HOSTCC="${BUILD_CC}"
+               HOSTCFLAGS="${BUILD_CFLAGS}"
+               PKG_CONFIG="${PKG_CONFIG}"
+       )
+       emake "${args[@]}" "$@"
+}
+
 src_configure() {
+       tc-export AR CC BUILD_CC PKG_CONFIG
+
+       tc-is-cross-compiler || BUILD_CFLAGS=${CFLAGS}
+       BUILD_CFLAGS+=" -D_FILE_OFFSET_BITS=64" #930513
+
+       append-flags -fno-strict-aliasing #310413
+       use ppc64 && append-flags -mminimal-toc #130943
+
        # check for a busybox config before making one of our own.
        # if one exist lets return and use it.
 
        restore_config .config
        if [ -f .config ]; then
-               yes "" | emake -j1 -s oldconfig >/dev/null
+               yes "" | bbmake -j1 oldconfig
                return 0
        else
                ewarn "Could not locate user configfile, so we will save a 
default one"
@@ -128,11 +139,11 @@ src_configure() {
        # setting SKIP_SELINUX skips searching for selinux at this stage. We 
don't
        # need to search now in case we end up not needing it after all.
        # setup the config file
-       emake -j1 -s allyesconfig SKIP_SELINUX=$(usex selinux n y) >/dev/null 
#620918
+       bbmake -j1 allyesconfig SKIP_SELINUX=$(usex selinux n y) #620918
        # nommu forces a bunch of things off which we want on #387555
        busybox_config_option n NOMMU
        sed -i '/^#/d' .config
-       yes "" | emake -j1 -s oldconfig SKIP_SELINUX=$(usex selinux n y) 
>/dev/null #620918
+       yes "" | bbmake -j1 oldconfig SKIP_SELINUX=$(usex selinux n y) #620918
 
        # now turn off stuff we really don't want
        busybox_config_option n DMALLOC
@@ -222,17 +233,17 @@ src_configure() {
                busybox_config_option n ${opt}
        done
 
-       emake -j1 oldconfig > /dev/null
+       bbmake -j1 oldconfig
 }
 
 src_compile() {
        unset KBUILD_OUTPUT #88088
        export SKIP_STRIP=y
 
-       emake V=1 busybox
+       bbmake busybox
 
        # bug #701512
-       emake V=1 doc
+       bbmake doc
 }
 
 src_install() {
@@ -305,7 +316,7 @@ src_install() {
        fi
 
        # bundle up the symlink files for use later
-       emake DESTDIR="${ED}" install
+       bbmake DESTDIR="${ED}" install
        # for compatibility, provide /usr/bin/env
        mkdir -p _install/usr/bin || die
        if [[ ! -e _install/usr/bin/env ]]; then

Reply via email to