mockband/.gitea/build.sh

47 lines
1.0 KiB
Bash
Raw Normal View History

2024-01-04 21:36:17 -07:00
#! /bin/sh
set -e
log () {
echo "=== $*"
}
# Make sure we're in the project directory
cd $(dirname $0)/..
mkdir -p out/
2024-01-04 22:42:11 -07:00
while read variant vid pid flags; do
2024-01-04 21:36:17 -07:00
log
log Building $vid $pid $product
log
2024-01-04 22:42:11 -07:00
# We can overload build.extra_flags from boards.txt,
# so just specify the -D flags to gcc
flags="$flags -DUSB_VID=$vid -DUSB_PID=$pid"
2024-01-04 22:48:20 -07:00
flags="$flags -DUSB_MANUFACTURER=\"woozle.org\""
flags="$flags \"-DUSB_PRODUCT=\"Mockband $variant\"\"" # wtf quoting
2024-01-04 22:42:11 -07:00
flags="$flags -DCDC_DISABLED"
2024-01-04 22:59:14 -07:00
# Arduino gets cranky when it tries to use its own cache
rm -rf build/
mkdir -p build/cache/
2024-01-04 21:36:17 -07:00
arduino-builder \
-build-path $(pwd)/build/ \
-build-cache $(pwd)/build/cache/ \
2024-01-04 22:16:36 -07:00
-fqbn arduino:avr:leonardo \
-hardware /usr/share/arduino/hardware \
-tools /usr/share/arduino/tools \
2024-01-04 22:42:11 -07:00
-prefs="build.extra_flags=$flags" \
2024-01-04 21:36:17 -07:00
-compile MockBand.ino
mv build/MockBand.ino.hex out/MockBand.$variant.hex
done << EOD
2024-01-04 22:42:11 -07:00
guitar 0x1bad 0x0004
guitar-wammy 0x1bad 0x0004 -DWAMMY
drums 0x1bad 0x3110
2024-01-04 21:36:17 -07:00
EOD
ls -l out/