|
|
@ -26,15 +26,15 @@ absolute_filename() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build_version () {
|
|
|
|
build_version () {
|
|
|
|
GIT_VERSION="$(cd "$(find_sketch)"; if [ -d .git ]; then echo -n '-g' && git describe --abbrev=4 --dirty --always; fi)"
|
|
|
|
GIT_VERSION="$(cd "${SKETCH_DIR}"; if [ -d .git ]; then echo -n '-g' && git describe --abbrev=4 --dirty --always; fi)"
|
|
|
|
LIB_PROPERTIES_PATH="${LIB_PROPERTIES_PATH:-"../.."}"
|
|
|
|
LIB_PROPERTIES_PATH="${LIB_PROPERTIES_PATH:-"../.."}"
|
|
|
|
LIB_VERSION="$(cd "$(find_sketch)"; (grep version= "${LIB_PROPERTIES_PATH}/library.properties" 2>/dev/null || echo version=0.0.0) | cut -d= -f2)${GIT_VERSION}"
|
|
|
|
LIB_VERSION="$(cd "${SKETCH_DIR}"; (grep version= "${LIB_PROPERTIES_PATH}/library.properties" 2>/dev/null || echo version=0.0.0) | cut -d= -f2)${GIT_VERSION}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
build_paths() {
|
|
|
|
build_paths() {
|
|
|
|
# We need that echo because we\re piping to cksum
|
|
|
|
# We need that echo because we\re piping to cksum
|
|
|
|
# shellcheck disable=SC2005
|
|
|
|
# shellcheck disable=SC2005
|
|
|
|
SKETCH_IDENTIFIER="$(echo "$(absolute_filename "$(find_sketch)/${SKETCH}.ino")" | cksum | cut -d ' ' -f 1)-${SKETCH}.ino"
|
|
|
|
SKETCH_IDENTIFIER="$(echo "$(absolute_filename "${SKETCH_DIR}/${SKETCH}.ino")" | cksum | cut -d ' ' -f 1)-${SKETCH}.ino"
|
|
|
|
KALEIDOSCOPE_TEMP_PATH="${KALEIDOSCOPE_TEMP_PATH:-${TMPDIR:-/tmp}/kaleidoscope-${USER}}"
|
|
|
|
KALEIDOSCOPE_TEMP_PATH="${KALEIDOSCOPE_TEMP_PATH:-${TMPDIR:-/tmp}/kaleidoscope-${USER}}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -67,7 +67,6 @@ enable_ccache () {
|
|
|
|
if [ -z "${CCACHE_NOT_SUPPORTED}" ] && [ "$(command -v ccache)" ]; then
|
|
|
|
if [ -z "${CCACHE_NOT_SUPPORTED}" ] && [ "$(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}${C_COMPILER_BASENAME}" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}" ]; then
|
|
|
|
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}"
|
|
|
|
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}"
|
|
|
@ -92,6 +91,7 @@ enable_ccache () {
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size" ]; then
|
|
|
|
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
|
|
|
|
|
|
|
|
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}/"
|
|
|
@ -137,11 +137,16 @@ find_sketch () {
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for path in "examples/${LIBRARY}" \
|
|
|
|
SKETCH_DIR="$SKETCH"
|
|
|
|
|
|
|
|
SKETCH_FILE=$(basename "$SKETCH")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for path in "${SKETCH_DIR}" \
|
|
|
|
|
|
|
|
"examples/${LIBRARY}" \
|
|
|
|
"src" \
|
|
|
|
"src" \
|
|
|
|
"."; do
|
|
|
|
"."; do
|
|
|
|
if [ -f "${path}/${SKETCH}.ino" ]; then
|
|
|
|
if [ -f "${path}/${SKETCH_FILE}.ino" ]; then
|
|
|
|
echo "${path}"
|
|
|
|
SKETCH_DIR="${path}"
|
|
|
|
|
|
|
|
SKETCH="${SKETCH_FILE}"
|
|
|
|
return
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -324,14 +329,13 @@ hex_with_bootloader () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
maybe_build () {
|
|
|
|
maybe_build () {
|
|
|
|
|
|
|
|
find_sketch
|
|
|
|
build_version
|
|
|
|
build_version
|
|
|
|
build_paths
|
|
|
|
build_paths
|
|
|
|
build_filenames
|
|
|
|
build_filenames
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -e "${HEX_FILE_PATH}" ]; then
|
|
|
|
if [ ! -e "${HEX_FILE_PATH}" ]; then
|
|
|
|
build "$@"
|
|
|
|
build "$@"
|
|
|
|
else
|
|
|
|
|
|
|
|
SKETCH_DIR="$(find_sketch)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -341,7 +345,14 @@ build () {
|
|
|
|
size "$@"
|
|
|
|
size "$@"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prepare_ccache () {
|
|
|
|
|
|
|
|
build_paths
|
|
|
|
|
|
|
|
enable_ccache
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
compile () {
|
|
|
|
compile () {
|
|
|
|
|
|
|
|
find_sketch
|
|
|
|
build_version
|
|
|
|
build_version
|
|
|
|
build_paths
|
|
|
|
build_paths
|
|
|
|
build_filenames
|
|
|
|
build_filenames
|
|
|
@ -349,8 +360,6 @@ compile () {
|
|
|
|
|
|
|
|
|
|
|
|
install -d "${OUTPUT_PATH}"
|
|
|
|
install -d "${OUTPUT_PATH}"
|
|
|
|
|
|
|
|
|
|
|
|
SKETCH_DIR="$(find_sketch)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Building ${SKETCH_DIR}/${SKETCH}"
|
|
|
|
echo "Building ${SKETCH_DIR}/${SKETCH}"
|
|
|
|
|
|
|
|
|
|
|
|
# This is defined in the (optional) user config.
|
|
|
|
# This is defined in the (optional) user config.
|
|
|
@ -440,7 +449,7 @@ compile () {
|
|
|
|
FQBN="${SAVED_FQBN}"
|
|
|
|
FQBN="${SAVED_FQBN}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_find_all () {
|
|
|
|
find_all_sketches () {
|
|
|
|
for plugin in ./*.ino \
|
|
|
|
for plugin in ./*.ino \
|
|
|
|
$([ -d examples ] && find examples -name '*.ino') \
|
|
|
|
$([ -d examples ] && find examples -name '*.ino') \
|
|
|
|
src/*.ino; do
|
|
|
|
src/*.ino; do
|
|
|
@ -461,7 +470,7 @@ _find_all () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
build_all () {
|
|
|
|
build_all () {
|
|
|
|
plugins="$(_find_all)"
|
|
|
|
plugins="$(find_all_sketches)"
|
|
|
|
|
|
|
|
|
|
|
|
for plugin in ${plugins}; do
|
|
|
|
for plugin in ${plugins}; do
|
|
|
|
export SKETCH="${plugin}"
|
|
|
|
export SKETCH="${plugin}"
|
|
|
@ -472,7 +481,7 @@ build_all () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compile_all () {
|
|
|
|
compile_all () {
|
|
|
|
plugins="$(_find_all)"
|
|
|
|
plugins="$(find_all_sketches)"
|
|
|
|
|
|
|
|
|
|
|
|
for plugin in ${plugins}; do
|
|
|
|
for plugin in ${plugins}; do
|
|
|
|
export SKETCH="${plugin}"
|
|
|
|
export SKETCH="${plugin}"
|
|
|
@ -737,12 +746,6 @@ done
|
|
|
|
|
|
|
|
|
|
|
|
LIBRARY="${SKETCH}"
|
|
|
|
LIBRARY="${SKETCH}"
|
|
|
|
|
|
|
|
|
|
|
|
case "${SKETCH}" in
|
|
|
|
|
|
|
|
*/*)
|
|
|
|
|
|
|
|
SKETCH="$(basename "${SKETCH}")"
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export SKETCH
|
|
|
|
export SKETCH
|
|
|
|
export LIBRARY
|
|
|
|
export LIBRARY
|
|
|
|
|
|
|
|
|
|
|
|