From 2b2130ff42975c40485f9defdb67b7bbf357a4db Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 28 Jun 2025 17:47:20 +0300 Subject: [PATCH] toolchain/ports: Use strip install targets I just found that these exist. This is much cleaner than manually stripping the executables! --- ports/binutils/build.sh | 6 +----- ports/gcc/build.sh | 15 ++------------- toolchain/build.sh | 10 ++++------ 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/ports/binutils/build.sh b/ports/binutils/build.sh index e36ad141..2c8327cf 100755 --- a/ports/binutils/build.sh +++ b/ports/binutils/build.sh @@ -4,6 +4,7 @@ NAME='binutils' VERSION='2.44' DOWNLOAD_URL="https://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.gz#0cdd76777a0dfd3dd3a63f215f030208ddb91c2361d2bcc02acec0f1c16b6a2e" DEPENDENCIES=('zlib') +MAKE_INSTALL_TARGETS=('install-strip') CONFIGURE_OPTIONS=( "--target=$BANAN_TOOLCHAIN_TRIPLE" '--with-sysroot=/' @@ -14,8 +15,3 @@ CONFIGURE_OPTIONS=( '--disable-nls' '--disable-werror' ) - -build() { - make -j$(nproc) || exit 1 - find . -type f -executable -exec $STRIP --strip-unneeded {} + 2>/dev/null -} diff --git a/ports/gcc/build.sh b/ports/gcc/build.sh index 789b9218..0151d84c 100755 --- a/ports/gcc/build.sh +++ b/ports/gcc/build.sh @@ -4,6 +4,8 @@ NAME='gcc' VERSION='15.1.0' DOWNLOAD_URL="https://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.gz#51b9919ea69c980d7a381db95d4be27edf73b21254eb13d752a08003b4d013b1" DEPENDENCIES=('binutils' 'gmp' 'mpfr' 'mpc') +MAKE_BUILD_TARGETS=('all-gcc' 'all-target-libgcc' 'all-target-libstdc++-v3') +MAKE_INSTALL_TARGETS=('install-strip-gcc' 'install-strip-target-libgcc' 'install-strip-target-libstdc++-v3') CONFIGURE_OPTIONS=( "--target=$BANAN_TOOLCHAIN_TRIPLE" '--with-sysroot=/' @@ -15,16 +17,3 @@ CONFIGURE_OPTIONS=( '--disable-nls' '--enable-languages=c,c++' ) - -build() { - make -j$(nproc) all-gcc || exit 1 - make -j$(nproc) all-target-libgcc || exit 1 - make -j$(nproc) all-target-libstdc++-v3 || exit 1 - find . -type f -executable -exec strip --strip-unneeded {} + 2>/dev/null -} - -install() { - make install-gcc DESTDIR="$BANAN_SYSROOT" || exit 1 - make install-target-libgcc DESTDIR="$BANAN_SYSROOT" || exit 1 - make install-target-libstdc++-v3 DESTDIR="$BANAN_SYSROOT" || exit 1 -} diff --git a/toolchain/build.sh b/toolchain/build.sh index 0df1dfa8..29e9cf42 100755 --- a/toolchain/build.sh +++ b/toolchain/build.sh @@ -94,7 +94,7 @@ build_binutils () { --disable-werror make $MAKE_JOBS - make install + make install-strip } build_gcc () { @@ -131,8 +131,8 @@ build_gcc () { make $MAKE_JOBS all-gcc make $MAKE_JOBS all-target-libgcc CFLAGS_FOR_TARGET="$XCFLAGS" - make install-gcc - make install-target-libgcc + make install-strip-gcc + make install-strip-target-libgcc } build_libstdcpp () { @@ -143,7 +143,7 @@ build_libstdcpp () { cd $BANAN_BUILD_DIR/toolchain/$GCC_VERSION/build-$BANAN_ARCH make $MAKE_JOBS all-target-libstdc++-v3 - make install-target-libstdc++-v3 + make install-strip-target-libstdc++-v3 } build_grub () { @@ -275,5 +275,3 @@ if (($BUILD_LIBSTDCPP)); then build_libstdcpp fi - -find "$BANAN_TOOLCHAIN_PREFIX" -type f -executable -exec strip --strip-unneeded {} + 2>/dev/null