Skip to content

Commit eeab149

Browse files
authored
Merge pull request #63 from visglz/patch@buildscript
Strip compiler executables and minor fixes
2 parents d2f3972 + f0c8745 commit eeab149

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

build-scripts/RTBuilder_64b

+8-7
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,15 +53,14 @@ 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
5860
done
5961
#validates parameters and print usage helper function in case parameters are missing
6062
if [ -z "$VERBOSE" ]; then
6163
VERBOSE=0
62-
set -eo pipefail # stop the script and exit with return code != 0 if errored
6364
fi
6465
if [ -z "$GCC_VERSION" ] || [ -z "$RPIOS_TYPE" ]; then
6566
echo "Error: Required parameters are missing!"
@@ -135,7 +136,7 @@ mkdir -p "$INSTALLDIR"
135136
cd "$DOWNLOADDIR" || exit
136137
#download binaries if not found
137138
if [ ! -d "linux" ]; then
138-
wget -q https://github.com/$(wget -q https://github.com/raspberrypi/linux/releases/latest -O - | egrep '/.*/.*/.*.tar.gz' -o)
139+
wget -q https://github.com/$(wget -q https://github.com/raspberrypi/linux/releases/latest -O - | egrep '/.*/.*/.*.tar.gz' -o | head -n1)
139140
tar xf raspberrypi*.tar.gz
140141
mv linux* linux
141142
rm ./*.tar.*
@@ -217,15 +218,15 @@ if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -r
217218
cd "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build || exit
218219
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --disable-multilib
219220
make -s -j$(nproc)
220-
make -s install DESTDIR="$INSTALLDIR"
221+
make -s install-strip DESTDIR="$INSTALLDIR"
221222
if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build/*; fi
222223

223224
echo "Building Cross GCC $GCCBASE_VERSION Binaries..."
224225
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build/*; fi
225226
cd "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build || exit
226227
../configure --prefix= --target=$TARGET --enable-languages=$LANGUAGES --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-arch=$ARCH --disable-multilib
227228
make -s -j$(nproc) all-gcc
228-
make -s install-gcc DESTDIR="$INSTALLDIR"
229+
make -s install-strip-gcc DESTDIR="$INSTALLDIR"
229230
if [ -n "$(ls -A "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build/*; fi
230231
cd "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build || exit
231232
../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 +244,15 @@ make -s install DESTDIR="$SYSROOTDIR"
243244
cd "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build || exit
244245
if [ -n "$(ls -A "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build/*; fi
245246
make -s -j$(nproc)
246-
make -s install DESTDIR="$INSTALLDIR"
247+
make -s install-strip DESTDIR="$INSTALLDIR"
247248
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-$GCCBASE_VERSION/build/*; fi
248249

249250
if [ "$GCC_VERSION" != "$GCCBASE_VERSION" ]; then
250251
cd "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build || exit
251252
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build/*; fi
252253
../configure --prefix= --target=$TARGET --enable-languages=$LANGUAGES --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-arch=$ARCH --disable-multilib
253254
make -s -j$(nproc)
254-
make -s install DESTDIR="$INSTALLDIR"
255+
make -s install-strip DESTDIR="$INSTALLDIR"
255256
if [ -n "$(ls -A "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build)" ]; then rm -rf "$DOWNLOADDIR"/gcc-"$GCC_VERSION"/build/*; fi
256257

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

0 commit comments

Comments
 (0)