Skip to content

Commit 5f99847

Browse files
committed
Strip compiler executables and minor fixes
* Strip on compiler install (#39) * This drastically reduces extracted size from 1.7GB to 477MB * Followup to pull request #62 * Set "set -eo pipefail" at top of script. Set "set -v" only for verbose mode * Fix wget download of linux kernel * The out wget was failing because of multiple lines. Only consider topmost line with most recent file)
1 parent d2f3972 commit 5f99847

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

build-scripts/RTBuilder_64b

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
# This script aauto downloads, compiles, and compresses Cross & Native GCC ARM64 Toolchain
2525
# binaries targeting any Raspberry Pi 64-bit (like Pi64) OSes.
2626

27+
set -eo pipefail
28+
2729
helpfunction() {
2830
#helper function that prints custom usage help menu
2931
echo ""
@@ -51,7 +53,7 @@ while getopts "g:o:V" opt; do
5153
VERBOSE=1
5254
echo "Info: Activated verbose output!"
5355
echo ""
54-
set -eov pipefail # Set verbose mode.
56+
set -v # Set verbose mode.
5557
;;
5658
?) helpfunction ;; #prints help function for invalid parameter
5759
esac
@@ -135,7 +137,7 @@ mkdir -p "$INSTALLDIR"
135137
cd "$DOWNLOADDIR" || exit
136138
#download binaries if not found
137139
if [ ! -d "linux" ]; then
138-
wget -q https://github.com/$(wget -q https://github.com/raspberrypi/linux/releases/latest -O - | egrep '/.*/.*/.*.tar.gz' -o)
140+
wget -q https://github.com/$(wget -q https://github.com/raspberrypi/linux/releases/latest -O - | egrep '/.*/.*/.*.tar.gz' -o | head -n1)
139141
tar xf raspberrypi*.tar.gz
140142
mv linux* linux
141143
rm ./*.tar.*
@@ -217,15 +219,15 @@ if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -r
217219
cd "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build || exit
218220
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --disable-multilib
219221
make -s -j$(nproc)
220-
make -s install DESTDIR="$INSTALLDIR"
222+
make -s install-strip DESTDIR="$INSTALLDIR"
221223
if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build/*; fi
222224

223225
echo "Building Cross GCC $GCCBASE_VERSION Binaries..."
224226
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build/*; fi
225227
cd "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build || exit
226228
../configure --prefix= --target=$TARGET --enable-languages=$LANGUAGES --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-arch=$ARCH --disable-multilib
227229
make -s -j$(nproc) all-gcc
228-
make -s install-gcc DESTDIR="$INSTALLDIR"
230+
make -s install-strip-gcc DESTDIR="$INSTALLDIR"
229231
if [ -n "$(ls -A "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build/*; fi
230232
cd "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build || exit
231233
../configure --prefix=/usr --build="$MACHTYPE" --host=$TARGET --target=$TARGET --with-arch=$ARCH --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-headers="$SYSROOTDIR"/usr/include --with-lib="$SYSROOTDIR"/usr/lib --disable-multilib libc_cv_forced_unwind=yes
@@ -243,15 +245,15 @@ make -s install DESTDIR="$SYSROOTDIR"
243245
cd "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build || exit
244246
if [ -n "$(ls -A "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build/*; fi
245247
make -s -j$(nproc)
246-
make -s install DESTDIR="$INSTALLDIR"
248+
make -s install-strip DESTDIR="$INSTALLDIR"
247249
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build/*; fi
248250

249251
if [ "$GCC_VERSION" != "$GCCBASE_VERSION" ]; then
250252
cd "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build || exit
251253
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build/*; fi
252254
../configure --prefix= --target=$TARGET --enable-languages=$LANGUAGES --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-arch=$ARCH --disable-multilib
253255
make -s -j$(nproc)
254-
make -s install DESTDIR="$INSTALLDIR"
256+
make -s install-strip DESTDIR="$INSTALLDIR"
255257
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build/*; fi
256258

257259
echo "Building GCC Native GCC $GCC_VERSION Binaries..."

0 commit comments

Comments
 (0)