refactor kaleidoscope-builder.conf to make it possible to extract the probing tools that have platform-specific implementations

tmp/arduino-cli-pre-rebase
Jesse Vincent 4 years ago
parent 928f02fdbd
commit 9699eb198e
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -31,74 +31,73 @@ uname_S=$(uname -s 2>/dev/null || echo not)
uname_O=$(uname -o 2>/dev/null || echo not)
find_device_port() {
if [ -n "${DEVICE_PORT}" ]; then
echo "DEVICE_PORT=\"${DEVICE_PORT}\" predefined."
return
fi
find_device_vid_pid
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
if [[ "${DEVICE_PORT}" = "" ]]; then
if [ "${uname_S}" = "Darwin" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})"
elif [ "${uname_O}" = "Cygwin" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
DEVICE_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format Cygwin)"
DEVICE_COM_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format COM)"
elif [ "${uname_S}" = "FreeBSD" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER})"
else
echo "DEVICE_PORT=\"${DEVICE_PORT}\" predefined."
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})"
fi
}
reset_device_cmd() {
if [ -z ${NO_RESET} ]; then
if [ "${uname_S}" = "Darwin" ]; then
/bin/stty -f ${DEVICE_PORT} 1200
elif [ "${uname_S}" = "FreeBSD" ]; then
/bin/stty -f ${DEVICE_PORT} 1200
elif [ "${uname_O}" = "Cygwin" ]; then
cmd /c mode ${DEVICE_COM_PORT} baud=1200
else
stty -F ${DEVICE_PORT} 1200 hupcl
fi
fi
}
find_bootloader_ports() {
find_device_vid_pid
: "${BOOTLOADER_VID:=${VID}}"
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
else
if [ -n "${DEVICE_PORT_BOOTLOADER}" ]; then
echo "DEVICE_PORT_BOOTLOADER=\"${DEVICE_PORT_BOOTLOADER}\" predefined."
return
fi
}
if [ "${uname_S}" = "Darwin" ]; then
find_device_port() {
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})"
}
reset_device_cmd() {
/bin/stty -f ${DEVICE_PORT} 1200
}
find_bootloader_ports() {
find_device_vid_pid
: "${BOOTLOADER_VID:=${VID}}"
if [ "${uname_S}" = "Darwin" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
else
echo "DEVICE_PORT_BOOTLOADER=\"${DEVICE_PORT_BOOTLOADER}\" predefined."
fi
}
elif [ "${uname_S}" = "FreeBSD" ]; then
elif [ "${uname_O}" = "Cygwin" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
DEVICE_PORT_BOOTLOADER="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID} -Format COM)"
elif [ "${uname_S}" = "FreeBSD" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER})"
find_device_port() {
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER})"
}
else
reset_device_cmd() {
/bin/stty -f ${DEVICE_PORT} 1200
}
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
fi
}
if [ "${uname_S}" = "FreeBSD" ]; then
: "${AVR_SIZE:=/usr/local/bin/avr-size}"
: "${AVR_NM:=/usr/local/bin/avr-nm}"
: "${AVR_OBJDUMP:=/usr/local/bin/avr-objdump}"
find_bootloader_ports() {
DEVICE_PORT_PROBER="${KALEIDOSCPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER})"
}
if [ "${ARCH}" = "virtual" ]; then
: "${COMPILER_PATH:=/usr/local/bin/}"
fi
@ -125,22 +124,4 @@ elif [ "${uname_O}" = "Cygwin" ]; then
TMPDIR="$(realpath --relative-to=./ ${TMPDIR})"
find_device_port() {
find_device_vid_pid
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
DEVICE_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format Cygwin)"
DEVICE_COM_PORT="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID} -Format COM)"
}
reset_device_cmd() {
cmd /c mode ${DEVICE_COM_PORT} baud=1200
}
find_bootloader_ports() {
find_device_vid_pid
: "${BOOTLOADER_VID:=${VID}}"
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
DEVICE_PORT_BOOTLOADER="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID} -Format COM)"
}
fi

Loading…
Cancel
Save