diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68c4ebb..659e316 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_KEY }} - name: Build - run: SKIP_RISCV=0 ./build_macos.sh + run: ./build_macos.sh - name: Upload Artifact uses: actions/upload-artifact@v4 with: @@ -97,7 +97,7 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_KEY }} - name: Build - run: SKIP_RISCV=0 ./build_linux.sh + run: ./build_linux.sh - name: Upload Artifact uses: actions/upload-artifact@v4 with: diff --git a/build_linux.sh b/build_linux.sh index b027cac..3331f2a 100755 --- a/build_linux.sh +++ b/build_linux.sh @@ -2,6 +2,16 @@ set -euo pipefail +# Defaults +SKIP_RISCV=${SKIP_RISCV-0} +if git clone https://git.savannah.nongnu.org/git/git2cl.git; then + SKIP_OPENOCD=${SKIP_OPENOCD-0} +else + # Clone is failing, so skip build + echo "Skipping openocd build, as likely to fail" + SKIP_OPENOCD=${SKIP_OPENOCD-1} +fi + # Install prerequisites sudo apt install -y jq cmake libtool automake libusb-1.0-0-dev libhidapi-dev libftdi1-dev # Risc-V prerequisites @@ -36,7 +46,9 @@ if [[ "$SKIP_RISCV" != 1 ]]; then # Takes ages to build ../packages/linux/riscv/build-riscv-gcc.sh fi -../packages/linux/openocd/build-openocd.sh +if [[ "$SKIP_OPENOCD" != 1 ]]; then + ../packages/linux/openocd/build-openocd.sh +fi ../packages/linux/picotool/build-picotool.sh cd .. @@ -64,21 +76,23 @@ pushd "$builddir/picotool-install/" tar -a -cf "$topd/bin/$filename" * .keep popd -# Package OpenOCD separately as well +if [[ "$SKIP_OPENOCD" != 1 ]]; then + # Package OpenOCD separately as well -version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1)) -version=${version[0]} -version=${version[3]} -version=$(echo $version | cut -d "-" -f 1) + version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1)) + version=${version[0]} + version=${version[3]} + version=$(echo $version | cut -d "-" -f 1) -echo "OpenOCD version $version" + echo "OpenOCD version $version" -filename="openocd-${version}-${suffix}.tar.gz" + filename="openocd-${version}-${suffix}.tar.gz" -echo "Saving OpenOCD package to $filename" -pushd "$builddir/openocd-install/usr/local/bin" -tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts" -popd + echo "Saving OpenOCD package to $filename" + pushd "$builddir/openocd-install/usr/local/bin" + tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts" + popd +fi if [[ "$SKIP_RISCV" != 1 ]]; then # Package riscv toolchain separately as well diff --git a/build_macos.sh b/build_macos.sh index 70fb944..5823a66 100755 --- a/build_macos.sh +++ b/build_macos.sh @@ -2,6 +2,16 @@ set -euo pipefail +# Defaults +SKIP_RISCV=${SKIP_RISCV-0} +if git clone https://git.savannah.nongnu.org/git/git2cl.git; then + SKIP_OPENOCD=${SKIP_OPENOCD-0} +else + # Clone is failing, so skip build + echo "Skipping openocd build, as likely to fail" + SKIP_OPENOCD=${SKIP_OPENOCD-1} +fi + # Install prerequisites arch -x86_64 /usr/local/bin/brew install jq libtool libusb automake hidapi arch -arm64 /opt/homebrew/bin/brew install jq libtool libusb automake hidapi @@ -47,7 +57,7 @@ if [[ "$SKIP_RISCV" != 1 ]]; then # Takes ages to build ../packages/macos/riscv/build-riscv-gcc.sh fi -if [[ $(uname -m) == 'arm64' ]]; then +if [[ "$SKIP_OPENOCD" != 1 ]] && [[ $(uname -m) == 'arm64' ]]; then ../packages/macos/openocd/build-openocd.sh fi arch -x86_64 ../packages/macos/picotool/build-picotool.sh @@ -78,7 +88,7 @@ pushd "$builddir/picotool-install/" tar -a -cf "$topd/bin/$filename" * .keep popd -if [[ $(uname -m) == 'arm64' ]]; then +if [[ "$SKIP_OPENOCD" != 1 ]] && [[ $(uname -m) == 'arm64' ]]; then # Package OpenOCD separately as well version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1))