mockband/.gitea/build.sh

44 lines
1000 B
Bash
Executable File

#! /bin/sh
set -e
log () {
echo "=== $*"
}
# Make sure we're in the project directory
cd $(dirname $0)/..
## This is bananas.
mkdir -p build/ out/ build/cache/
cp -rL /usr/share/arduino /usr/share/arduino-builder build/ || true # there's a cyclic symlink that causes failure
while read vid pid variant; do
log
log Building $vid $pid $product
log
sed -i "
/leonardo.build.vid/ s/=.*/=$vid/
/leonardo.build.pid/ s/=.*/=$pid/
/leonardo.build.usb_product/ s/=.*/=\"Mockband $variant\"/
" build/arduino/hardware/arduino/avr/boards.txt
grep 'leonardo.build' build/arduino/hardware/arduino/avr/boards.txt
arduino-builder \
-fqbn arduino:avr:leonardo \
-build-path $(pwd)/build/ \
-build-cache $(pwd)/build/cache/ \
-hardware build/arduino/hardware \
-tools build/arduino/tools \
-compile MockBand.ino
mv build/MockBand.ino.hex out/MockBand.$variant.hex
find out build/cache
done << EOD
0x1bad 0x0004 guitar
0x1bad 0x3110 drums
EOD
ls -l out/