From 5a7b79147052736d55a27859d9116a3d1fb9530c Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Sun, 25 Feb 2024 09:15:11 -0600 Subject: [PATCH] chore: fix tool dep installation for linux & macos --- .github/workflows/release.yml | 10 ++------ scripts/install_tools.sh | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 8 deletions(-) create mode 100755 scripts/install_tools.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 928c4c9..f31e8f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -121,15 +121,9 @@ jobs: - name: Install dependencies run: | ${{ matrix.packages_install }} - - name: Install capnproto + - name: Install capnproto & protobuf needed by veilid & distrans run: | - cd /tmp - curl -O https://capnproto.org/capnproto-c++-1.0.2.tar.gz - tar zxf capnproto-c++-1.0.2.tar.gz - cd capnproto-c++-1.0.2 - ./configure - make -j6 check - sudo make install + ./scripts/install_tools.sh - name: Build artifacts run: | # Actually do builds and make zips and whatnot diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh new file mode 100755 index 0000000..3495617 --- /dev/null +++ b/scripts/install_tools.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -eux + +# TODO: support windows somehow + +CAPNP_VERSION="1.0.2" +PROTOC_VERSION="24.3" # Keep in sync with veilid-core/build.rs + +build_dir=$(mktemp -d) +trap "rm -rf $build_dir" EXIT + +cd $build_dir +mkdir -p capnp-build protoc-install + +# Install capnp +pushd capnp-build +curl -O https://capnproto.org/capnproto-c++-${CAPNP_VERSION}.tar.gz +tar zxf capnproto-c++-${CAPNP_VERSION}.tar.gz +cd capnproto-c++-1.0.2 +./configure +sudo make -j6 install +popd + +# Install protoc +pushd protoc-install +UNAME_M=$(uname -m) +if [[ "$UNAME_M" == "x86_64" ]]; then + PROTOC_ARCH=x86_64 +elif [[ "$UNAME_M" == "aarch64" ]]; then + PROTOC_ARCH=aarch_64 +else + echo Unsupported build architecture + exit 1 +fi +PROTOC_OS="linux" +if [ "$(uname -o)" == "Darwin" ]; then + PROTOC_OS="osx" +fi + +curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$PROTOC_OS-$PROTOC_ARCH.zip +unzip protoc-$PROTOC_VERSION-$PROTOC_OS-$PROTOC_ARCH.zip +sudo cp -r bin include /usr/local/ +popd