kaleidoscope-builder fixed for builds of virtual hardware

This commit induces the following changes:

bin/kaleidoscope-builder

  * ccache dummy compiler and executables are now generated in a way
    that allows using the same CCACHE_WRAPPER_PATH for virtual and
    non-virtual builds

  * virtual builds are now triggered by either specifying the full FQBN with x86
    as architecture or by defining ARCH=x86

etc/kaleidoscope-builder.conf

  * COMPILER_PREFIX and COMPILER_PATH are now determined (if not predefined)
    based on ARCH or FQBN

Signed-off-by: Florian Fleissner <florian.fleissner@inpartik.de>
pull/640/head
Florian Fleissner 6 years ago committed by Jesse Vincent
parent 4ecf5f795e
commit 7326be589f

@ -60,13 +60,32 @@ enable_ccache () {
if [ "$(command -v ccache)" ]; then if [ "$(command -v ccache)" ]; then
if ! [ -d "$CCACHE_WRAPPER_PATH" ]; then if ! [ -d "$CCACHE_WRAPPER_PATH" ]; then
mkdir -p "$CCACHE_WRAPPER_PATH" mkdir -p "$CCACHE_WRAPPER_PATH"
fi
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}gcc" ]; then
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}gcc" ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}gcc"
fi
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}g++" ]; then
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}g++" ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}g++"
fi
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm" ]; then
ln -s "${AVR_NM}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm" ln -s "${AVR_NM}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm"
fi
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy" ]; then
ln -s "${AVR_OBJCOPY}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy" ln -s "${AVR_OBJCOPY}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy"
fi
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar" ]; then
ln -s "${AVR_AR}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar" ln -s "${AVR_AR}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar"
fi
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size" ]; then
ln -s "${AVR_SIZE}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size" ln -s "${AVR_SIZE}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size"
fi fi
export CCACHE_PATH=${COMPILER_PATH}/ export CCACHE_PATH=${COMPILER_PATH}/
CCACHE_ENABLE="-prefs compiler.path=${CCACHE_WRAPPER_PATH}/" CCACHE_ENABLE="-prefs compiler.path=${CCACHE_WRAPPER_PATH}/"
fi fi
@ -74,7 +93,7 @@ enable_ccache () {
firmware_size () { firmware_size () {
if [ "${BOARD}" = "virtual" ]; then if [ "${ARCH}" = "x86" ]; then
echo "[Size not computed for virtual build]" echo "[Size not computed for virtual build]"
return return
fi fi
@ -253,8 +272,12 @@ compile () {
BOARD="$(. "${SKETCH_DIR}"/.kaleidoscope-builder.conf && echo "${BOARD}")" BOARD="$(. "${SKETCH_DIR}"/.kaleidoscope-builder.conf && echo "${BOARD}")"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
FQBN="$(. "${SKETCH_DIR}"/.kaleidoscope-builder.conf && echo "${FQBN}")" FQBN="$(. "${SKETCH_DIR}"/.kaleidoscope-builder.conf && echo "${FQBN}")"
if [ "${SAVED_FQBN}" = "${FQBN}" ] || [ -z "${FQBN}" ]; then if [ -n "${BOARD}" ]; then
if [ -z "${ARCH}" ]; then
FQBN="keyboardio:avr:${BOARD}" FQBN="keyboardio:avr:${BOARD}"
else
FQBN="keyboardio:${ARCH}:${BOARD}"
fi
fi fi
fi fi

@ -12,9 +12,25 @@ LIBRARY="${LIBRARY:-${SKETCH}}"
BOARD="${BOARD:-model01}" BOARD="${BOARD:-model01}"
MCU="${MCU:-atmega32u4}" MCU="${MCU:-atmega32u4}"
if [ "${BOARD}" = "virtual" ]; then
if [ -z "${ARCH}" ]; then
ARCH=$(echo "${FQBN}" | sed -n -e 's/^[^:]\+:\([^:]\+\).*/\1/p')
fi
if [ "${ARCH}" = "x86" ]; then
FQBN="${FQBN:-keyboardio:x86:${BOARD}}" FQBN="${FQBN:-keyboardio:x86:${BOARD}}"
# Set the compiler path for virtual builds (x86)
#
if [ -z "${COMPILER_PATH}" ]; then
COMPILER_PATH="/usr/bin"
COMPILER_PREFIX=""
fi
else else
ARCH="avr"
fi
if [ -z "${FQBN}" ]; then
FQBN="${FQBN:-keyboardio:avr:${BOARD}}" FQBN="${FQBN:-keyboardio:avr:${BOARD}}"
fi fi
@ -141,9 +157,11 @@ ARDUINO_IDE_VERSION="10607"
###### Executable paths ###### Executable paths
###### ######
# Allow the compiler path to be empty for x86 builds
COMPILER_PATH="${COMPILER_PATH-${ARDUINO_TOOLS_PATH}/avr/bin/}"
COMPILER_PATH="${COMPILER_PATH:-${ARDUINO_TOOLS_PATH}/avr/bin/}" # Allow the compiler prefix to be empty for x86 builds
COMPILER_PREFIX="${COMPILER_PREFIX:-avr-}" COMPILER_PREFIX="${COMPILER_PREFIX-avr-}"
AVR_SIZE="${AVR_SIZE:-${COMPILER_PATH}/${COMPILER_PREFIX}size}" AVR_SIZE="${AVR_SIZE:-${COMPILER_PATH}/${COMPILER_PREFIX}size}"
AVR_SIZE_FLAGS="${AVR_SIZE_FLAGS:--C --mcu=${MCU}}" AVR_SIZE_FLAGS="${AVR_SIZE_FLAGS:--C --mcu=${MCU}}"
AVR_OBJDUMP="${AVR_OBJDUMP:-${COMPILER_PATH}/${COMPILER_PREFIX}objdump}" AVR_OBJDUMP="${AVR_OBJDUMP:-${COMPILER_PATH}/${COMPILER_PREFIX}objdump}"

Loading…
Cancel
Save