Skip to content

Commit f3b5e0d

Browse files
authored
Merge pull request #2645 from rikkuness/fix-provision-script
Added IGNORE_SYSTEM_GCC option to provision.sh
2 parents 56fd265 + ff725a3 commit f3b5e0d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

scripts/provision.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ if [ "$ARM" = "1" ]; then
273273
echo "===== ARM"
274274
EXPECTEDARMGCCVERSION="13.2.1"
275275
EXPECTEDARMGCCFILENAME="arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi"
276-
if type arm-none-eabi-gcc 2> /dev/null > /dev/null; then
276+
277+
if type arm-none-eabi-gcc 2> /dev/null > /dev/null && [[ -z $IGNORE_SYSTEM_GCC ]]; then
277278
ARMGCCVERSION=$(arm-none-eabi-gcc -dumpfullversion)
278279
echo arm-none-eabi-gcc installed, version $ARMGCCVERSION
279280
if [ ! "$ARMGCCVERSION" = "$EXPECTEDARMGCCVERSION" ]; then
@@ -284,26 +285,29 @@ if [ "$ARM" = "1" ]; then
284285
echo "*** ***"
285286
echo "*** The build may work with your compiler version, but it ***"
286287
echo "*** is possible you will encounter errors, or issues with ***"
287-
echo "*** build size ***"
288+
echo "*** build size. If you wish to ignore the installed version ***"
289+
echo "*** and install and embedded version set IGNORE_SYSTEM_GCC=1 ***"
288290
echo "*** ***"
289291
echo "*********************************************************************"
290292
echo "*********************************************************************"
291293
echo " Expected $EXPECTEDARMGCCVERSION"
292294
echo " Got $ARMGCCVERSION"
293295
fi
294296
else
295-
echo "installing gcc-arm-embedded to Espruino/$EXPECTEDARMGCCFILENAME/bin"
296297
#sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
297298
#sudo apt-get update
298299
#sudo DEBIAN_FRONTEND=noninteractive apt-get --force-yes --yes install libsdl1.2-dev gcc-arm-embedded
299300
# OR download from https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
300301
# Unpack from GitHub-hosted file - newer, and much faster
301302
if [ ! -d "$EXPECTEDARMGCCFILENAME" ]; then
303+
echo "installing gcc-arm-embedded to Espruino/$EXPECTEDARMGCCFILENAME/bin"
302304
curl -Ls "https://github.com/espruino/EspruinoBuildTools/raw/master/arm/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi-stripped.tar.xz" | tar xfJ - --no-same-owner
303305
else
304-
echo "Folder found"
306+
echo "gcc-arm-embedded installation found"
305307
fi
306-
export PATH=$PATH:$(pwd)/$EXPECTEDARMGCCFILENAME/bin
308+
309+
ARMGCCPATH="$(pwd)/$EXPECTEDARMGCCFILENAME/bin"
310+
[[ ":$PATH:" != *":$ARMGCCPATH"* ]] && export PATH="$ARMGCCPATH:${PATH}"
307311
fi
308312
fi
309313

0 commit comments

Comments
 (0)