24
24
# This script aauto downloads, compiles, and compresses Cross & Native GCC ARM64 Toolchain
25
25
# binaries targeting any Raspberry Pi 64-bit (like Pi64) OSes.
26
26
27
+ set -eo pipefail
28
+
27
29
helpfunction () {
28
30
# helper function that prints custom usage help menu
29
31
echo " "
@@ -51,7 +53,7 @@ while getopts "g:o:V" opt; do
51
53
VERBOSE=1
52
54
echo " Info: Activated verbose output!"
53
55
echo " "
54
- set -eov pipefail # Set verbose mode.
56
+ set -v # Set verbose mode.
55
57
;;
56
58
? ) helpfunction ;; # prints help function for invalid parameter
57
59
esac
@@ -135,7 +137,7 @@ mkdir -p "$INSTALLDIR"
135
137
cd " $DOWNLOADDIR " || exit
136
138
# download binaries if not found
137
139
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 )
139
141
tar xf raspberrypi* .tar.gz
140
142
mv linux* linux
141
143
rm ./* .tar.*
@@ -217,15 +219,15 @@ if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -r
217
219
cd " $DOWNLOADDIR " /binutils-$BINUTILS_VERSION /build || exit
218
220
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-sysroot=/$TARGET /libc --with-build-sysroot=" $SYSROOTDIR " --disable-multilib
219
221
make -s -j$( nproc)
220
- make -s install DESTDIR=" $INSTALLDIR "
222
+ make -s install-strip DESTDIR=" $INSTALLDIR "
221
223
if [ -n " $( ls -A " $DOWNLOADDIR " /binutils-$BINUTILS_VERSION /build) " ]; then rm -rf " $DOWNLOADDIR " /binutils-$BINUTILS_VERSION /build/* ; fi
222
224
223
225
echo " Building Cross GCC $GCCBASE_VERSION Binaries..."
224
226
if [ -n " $( ls -A " $DOWNLOADDIR " /gcc-$GCCBASE_VERSION /build) " ]; then rm -rf " $DOWNLOADDIR " /gcc-$GCCBASE_VERSION /build/* ; fi
225
227
cd " $DOWNLOADDIR " /gcc-$GCCBASE_VERSION /build || exit
226
228
../configure --prefix= --target=$TARGET --enable-languages=$LANGUAGES --with-sysroot=/$TARGET /libc --with-build-sysroot=" $SYSROOTDIR " --with-arch=$ARCH --disable-multilib
227
229
make -s -j$( nproc) all-gcc
228
- make -s install-gcc DESTDIR=" $INSTALLDIR "
230
+ make -s install-strip- gcc DESTDIR=" $INSTALLDIR "
229
231
if [ -n " $( ls -A " $DOWNLOADDIR " /glibc-$GLIBC_VERSION /build) " ]; then rm -rf " $DOWNLOADDIR " /glibc-$GLIBC_VERSION /build/* ; fi
230
232
cd " $DOWNLOADDIR " /glibc-$GLIBC_VERSION /build || exit
231
233
../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"
243
245
cd " $DOWNLOADDIR " /gcc-$GCCBASE_VERSION /build || exit
244
246
if [ -n " $( ls -A " $DOWNLOADDIR " /glibc-$GLIBC_VERSION /build) " ]; then rm -rf " $DOWNLOADDIR " /glibc-$GLIBC_VERSION /build/* ; fi
245
247
make -s -j$( nproc)
246
- make -s install DESTDIR=" $INSTALLDIR "
248
+ make -s install-strip DESTDIR=" $INSTALLDIR "
247
249
if [ -n " $( ls -A " $DOWNLOADDIR " /gcc-$GCCBASE_VERSION /build) " ]; then rm -rf " $DOWNLOADDIR " /gcc-$GCCBASE_VERSION /build/* ; fi
248
250
249
251
if [ " $GCC_VERSION " != " $GCCBASE_VERSION " ]; then
250
252
cd " $DOWNLOADDIR " /gcc-" $GCC_VERSION " /build || exit
251
253
if [ -n " $( ls -A " $DOWNLOADDIR " /gcc-" $GCC_VERSION " /build) " ]; then rm -rf " $DOWNLOADDIR " /gcc-" $GCC_VERSION " /build/* ; fi
252
254
../configure --prefix= --target=$TARGET --enable-languages=$LANGUAGES --with-sysroot=/$TARGET /libc --with-build-sysroot=" $SYSROOTDIR " --with-arch=$ARCH --disable-multilib
253
255
make -s -j$( nproc)
254
- make -s install DESTDIR=" $INSTALLDIR "
256
+ make -s install-strip DESTDIR=" $INSTALLDIR "
255
257
if [ -n " $( ls -A " $DOWNLOADDIR " /gcc-" $GCC_VERSION " /build) " ]; then rm -rf " $DOWNLOADDIR " /gcc-" $GCC_VERSION " /build/* ; fi
256
258
257
259
echo " Building GCC Native GCC $GCC_VERSION Binaries..."
0 commit comments