Add build scripts

This commit is contained in:
Samuel Sloniker 2024-07-01 11:26:35 -07:00
parent 1e3a6e6e3b
commit 0d3554028a
2 changed files with 33 additions and 0 deletions

16
build_adafruit_libs.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# build_adafruit_libs.sh - build CircuitPack packages for Adafruit libraries
if [ "$1" = "" ]; then
echo "usage: $0 <path_to_unzipped_adafruit_libraries>" >&2
exit 2
fi
for file_name in $(ls $1/lib); do
rm -rf board
mkdir -p board/lib
package_name=$(basename -s .mpy $file_name)
cp -r $1/lib/$file_name board/lib/
python3 cppack.py $package_name board
rm -r board
done

17
build_package.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# build_package.sh - build a CircuitPack package for CircuitPack
# Requires mpy-cross installed in $PATH
mpy-cross 2>/dev/null
if [ "$?" = 127 ]; then
echo 'error: `mpy-cross` must be installed; get it from the link below and install it in a directory in your $PATH' >&2
echo 'https://learn.adafruit.com/welcome-to-circuitpython/library-file-types-and-frozen-libraries#creating-an-mpy-file-3118108' >&2
exit 2
fi
rm -rf board
mkdir -p board/lib
mpy-cross circuitpack.py
mv circuitpack.mpy board/lib/
python3 cppack.py circuitpack board
rm -r board