kaleidoscope-builder: Allow overriding CXX, CC, AR, etc

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/908/head
Gergely Nagy 4 years ago
parent 0cc65b7aac
commit 352a3fe547
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -379,6 +379,10 @@ compile () {
fi
fi
_CMD_CXX="${CXX:-${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}${COMPILER_SUFFIX}}"
_CMD_CC="${CC:-${COMPILER_PREFIX}${C_COMPILER_BASENAME}${COMPILER_SUFFIX}}"
_CMD_AR="${AR:-${COMPILER_PREFIX}${AR_BASENAME}${COMPILER_SUFFIX}}"
# SC2091: We do not care if quotes or backslashes are not respected.
# SC2086: We want word splitting.
# shellcheck disable=SC2086,SC2090
@ -401,8 +405,10 @@ compile () {
-built-in-libraries "${ARDUINO_PATH}/libraries" \
-prefs "compiler.cpp.extra_flags=${ARDUINO_CFLAGS} ${LOCAL_CFLAGS}" \
-prefs "compiler.path=${COMPILER_PATH}" \
-prefs "compiler.c.cmd=${COMPILER_PREFIX}${C_COMPILER_BASENAME}" \
-prefs "compiler.cpp.cmd=${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}" \
-prefs "compiler.c.cmd=${_CMD_CC}" \
-prefs "compiler.cpp.cmd=${_CMD_CXX}" \
-prefs "compiler.ar.cmd=${_CMD_AR}" \
-prefs "compiler.c.elf.cmd=${_CMD_CXX}" \
$CCACHE_ENABLE \
-warnings all \
${ARDUINO_VERBOSE} \

@ -23,9 +23,10 @@ if [ "${ARCH}" = "virtual" ]; then
# Set the compiler path for virtual builds
#
if [ -z "${COMPILER_PATH}" ]; then
COMPILER_PATH="/usr/bin"
COMPILER_PREFIX=""
COMPILER_PATH="/usr/bin/"
fi
COMPILER_PREFIX=""
else
ARCH="avr"
fi
@ -150,6 +151,12 @@ if [ "${uname_S}" = "Darwin" ]; then
fi
}
if [ "${ARCH}" = "virtual" ]; then
COMPILER_PREFIX="x86_64-apple-darwin19-"
COMPILER_SUFFIX="-10"
AR_BASENAME="gcc-ar"
fi
elif [ "${uname_S}" = "FreeBSD" ]; then
find_device_port() {
@ -168,6 +175,7 @@ elif [ "${uname_S}" = "FreeBSD" ]; then
AVR_OBJDUMP="${AVR_OBJDUMP:-/usr/local/bin/avr-objdump}"
AVRDUDE="${AVRDUDE:-/usr/local/bin/avrdude}"
AVRDUDE_CONF="${AVRDUDE_CONF:-/usr/local/etc/avrdude.conf}"
ARDUINO_BUILDER="${ARDUINO_BUILDER:-/usr/local/bin/arduino-builder}"
find_bootloader_ports() {
DIR=$(dirname "$0")
@ -175,6 +183,10 @@ elif [ "${uname_S}" = "FreeBSD" ]; then
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER})"
}
if [ "${ARCH}" = "virtual" ]; then
COMPILER_PATH="${COMPILER_PATH:-/usr/local/bin/}"
fi
elif [ "${uname_O}" = "Cygwin" ]; then
# The Windows arduino-builder.exe doesn't understand being told to exec against Cygwin symlinks
CCACHE_NOT_SUPPORTED=1
@ -248,8 +260,12 @@ ARDUINO_IDE_VERSION="10607"
# Allow the compiler path to be empty for virtual builds
COMPILER_PATH="${COMPILER_PATH-${ARDUINO_TOOLS_PATH}/avr/bin/}"
COMPILER_SUFFIX=""
C_COMPILER_BASENAME=$(basename ${CC:-gcc})
CXX_COMPILER_BASENAME=$(basename ${CXX:-g++})
AR_BASENAME=$(basename ${AR:-ar})
OBJCOPY_BASENAME=$(basename ${OBJCOPY:-objcopy})
# Allow the compiler prefix to be empty for virtual builds
COMPILER_PREFIX="${COMPILER_PREFIX-avr-}"

Loading…
Cancel
Save