Skip to content

Commit

Permalink
Add Cross.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
aleasims committed Dec 9, 2024
1 parent bed7b11 commit d9adf7f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
pre-build = "./scripts/cross/pre-build-script.sh"
env.passthrough = ["BUF_CACHE_DIR=/tmp"]
41 changes: 41 additions & 0 deletions scripts/cross/pre-build-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -eu

TARGET=${1}

BUF_VERSION=1.47.2
PROTOC_VERSION=25.1

ARCH=$(echo "$TARGET" | cut -d "-" -f 1)

echo "ARCH=$ARCH"

PROTOC_ARCH=$ARCH

if [ $ARCH = "aarch64" ]; then
# For some reason protobuf is using this weird naming for ARM
PROTOC_ARCH=aarch_64
fi

echo "PROTOC_ARCH=$PROTOC_ARCH"

export DEBIAN_FRONTEND=noninteractive

dpkg --add-architecture $CROSS_DEB_ARCH

apt-get update
apt-get install -y \
openssl \
ca-certificates \
pkg-config \
cmake \
libssl-dev:$CROSS_DEB_ARCH \
curl \
unzip

curl -sSL -o /usr/local/bin/buf "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-${ARCH}"
chmod +x /usr/local/bin/buf

curl -sSL -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip"
unzip /tmp/protoc.zip -d /usr/local

0 comments on commit d9adf7f

Please sign in to comment.