Files
firmware/bin/build-native.sh

36 lines
1.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
platformioFailed() {
[[ $VIRTUAL_ENV != "" ]] && exit 1 # don't hint at virtualenv if it's already in use
echo -e "\nThere were issues running platformio and you are not using a virtual environment." \
"\nYou may try setting up virtualenv and downloading the latest platformio from pip:" \
"\n\tvirtualenv venv" \
"\n\tsource venv/bin/activate" \
"\n\tpip install platformio" \
"\n\t./bin/build-native.sh # retry building"
exit 1
}
VERSION=$(bin/buildinfo.py long)
SHORT_VERSION=$(bin/buildinfo.py short)
2025-04-18 08:27:38 -04:00
PIO_ENV=${1:-native}
2025-12-08 18:21:23 -05:00
BUILDDIR=.pio/build/$PIO_ENV
OUTDIR=release
2025-12-08 18:21:23 -05:00
rm -f $OUTDIR/meshtasticd*
mkdir -p $OUTDIR/
rm -r $OUTDIR/* || true
2025-12-08 18:21:23 -05:00
basename=meshtasticd-$1-$VERSION
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
pio pkg install --environment "$PIO_ENV" || platformioFailed
2025-04-18 08:27:38 -04:00
pio run --environment "$PIO_ENV" || platformioFailed
2025-12-08 18:21:23 -05:00
cp "$BUILDDIR/meshtasticd" "$OUTDIR/meshtasticd_linux_$(uname -m)"
cp bin/native-install.* $OUTDIR/