Skip to content

Commit

Permalink
Add protobuf compiler dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
exquo committed Nov 21, 2023
1 parent 373d3db commit 3879d26
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/libclient-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
env:
LINKER: ${{ matrix.build-env.linker }}
run: |
cat >> ~/.cargo/config <<EOF
cat >> $CARGO_HOME/config.toml <<EOF
[target.$TARGET]
linker = "$LINKER"
EOF
Expand Down
23 changes: 15 additions & 8 deletions generate_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,28 @@
"lib-suffix": ".so",
"triple": "x86_64-unknown-linux-gnu",
"install-cmd": "sudo apt-get update && sudo apt-get install",
"req-pkg": "protobuf-compiler"
} | {
### Rust container on Debian 10
### (libc: Deb-10's v2.28 vs Ubuntu-20.04 v2.31)
"container": "rust:buster",
"install-cmd": "bash ./util.sh add_deb_repos && apt-get update && apt-get install -y",
"req-pkg": "python3 clang libclang-dev cmake make gh protobuf-compiler/buster-backports",
},
"macos": {
"runner": "macos-latest",
"lib-prefix": "lib",
"lib-suffix": ".dylib",
"triple": "x86_64-apple-darwin",
"install-cmd": "brew install",
"req-pkg": "protobuf",
},
"windows": {
"runner": "windows-latest",
"lib-suffix": ".dll",
"triple": "x86_64-pc-windows",
"install-cmd": "choco install",
"req-pkg": "nasm", # for boringssl
"req-pkg": "nasm protoc", # nasm: for boringssl
"rust-flags": "-C target-feature=+crt-static",
# Static linking to remove MSVC dependendency. See:
# zkgroup/ffi/node/Makefile
Expand All @@ -57,7 +66,10 @@ def cross_template(arch, subarch="", env="gnu", vendor="unknown", sys_os="linux"
cross_dict = {
"target": f"{arch}{subarch}-{vendor}-{sys_os}-{env}",
"req-pkg": " ".join((
f"{compiler}-{arch}-{sys_os}-{env}" for compiler in compilers.values()
host_dict["req-pkg"],
" ".join((
f"{compiler}-{arch}-{sys_os}-{env}" for compiler in compilers.values()
)),
)),
"linker": f"{arch}-{sys_os}-{env}-{compilers['C']}",
"build-env-vars": " ".join((
Expand All @@ -69,12 +81,7 @@ def cross_template(arch, subarch="", env="gnu", vendor="unknown", sys_os="linux"
return host_dict | cross_dict

build_envs = [
hosts["linux"] | {
### Rust container on Debian 10
"container": "rust:buster",
"install-cmd": "bash ./util.sh add_gh_ppa && apt-get update && apt-get install -y",
"req-pkg": "python3 clang libclang-dev cmake make gh",
},
hosts["linux"],
hosts["macos"],
hosts["windows"],
### Cross-compiling ###
Expand Down
7 changes: 6 additions & 1 deletion util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,17 @@ gradle_deps_vers () {
done
}

add_gh_ppa() {
add_deb_repos() {
# Installing GitHub CLI `gh` on Debian container
# From https://github.com/cli/cli/blob/trunk/docs/install_linux.md, sans `sudo` (for docker)
type -p curl >/dev/null || apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null

# For installing newer protobuf-compiler than available on Debian 10 (buster)
# Need protoc>v3.12.0, or get "protoc failed: Unknown flag: --experimental_allow_proto3_optional"
echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/buster-backports.list
}

"$@"

0 comments on commit 3879d26

Please sign in to comment.