Skip to content

Commit

Permalink
[Chore] Utilize OCTEZ_EXECUTABLES env var
Browse files Browse the repository at this point in the history
Problem: `make static` command utilizes `OCTEZ_EXECUTABLES` variable,
which we can use to specify exact binaries to build. Also, it
could be used to build experimental or development binaries.

Solution: Let user provide `OCTEZ_EXECUTABLES` env var and pass
it to the build.
  • Loading branch information
krendelhoff2 committed Sep 12, 2023
1 parent 358f802 commit 67e38c8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
8 changes: 8 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ Currently supported architectures are: `host` and `aarch64`, so that
one can build native binaries for current architecture or build `aarch64` binaries on
`x86_64` machine.

In order to build only specific binaries, or experimental/dev ones, you should specify
`OCTEZ_EXECUTABLES` env variable:
```
export OCTEZ_VERSION="v14.1"
export OCTEZ_EXECUTABLES="octez-smart-rollup-wasm-debugger octez-protocol-compiler octez-dal-node"
./docker-static-build.sh
```

### Compiling for `aarch64` on `x86_64` prerequisites

Docker image defined in [`Dockerfile.aarch64`](build/Dockerfile.aarch64) uses qemu for
Expand Down
1 change: 1 addition & 0 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ ENV OPAMYES true
COPY ./build/build-deps.sh /build-deps.sh
RUN /build-deps.sh
COPY ./build/build-tezos.sh /build-tezos.sh
ARG OCTEZ_EXECUTABLES
RUN /build-tezos.sh
RUN upx octez-*
1 change: 1 addition & 0 deletions docker/build/Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ ENV OPAMYES true
COPY ./build/build-deps.sh /build-deps.sh
RUN /build-deps.sh
COPY ./build/build-tezos.sh /build-tezos.sh
ARG OCTEZ_EXECUTABLES
RUN /build-tezos.sh
RUN upx octez-*
17 changes: 12 additions & 5 deletions docker/docker-static-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@

set -euo pipefail

binaries=("octez-admin-client" "octez-dac-client" "octez-dac-node" "octez-client" "octez-node" "octez-signer" "octez-codec")
if [ -z ${OCTEZ_EXECUTABLES+x} ]; then

for proto in $(jq -r ".active | .[]" ../protocols.json); do
binaries+=("octez-accuser-$proto" "octez-baker-$proto" "octez-smart-rollup-client-$proto" "octez-smart-rollup-node-$proto")
done
binaries=("octez-admin-client" "octez-dac-client" "octez-dac-node" "octez-client" "octez-node" "octez-signer" "octez-codec")

for proto in $(jq -r ".active | .[]" ../protocols.json); do
binaries+=("octez-accuser-$proto" "octez-baker-$proto" "octez-smart-rollup-client-$proto" "octez-smart-rollup-node-$proto")
done

OCTEZ_EXECUTABLES="$( IFS=$' '; echo "${binaries[*]}" )"
else
IFS=' ' read -r -a binaries <<< "$OCTEZ_EXECUTABLES"
fi

if [[ "${USE_PODMAN-}" == "True" ]]; then
virtualisation_engine="podman"
Expand Down Expand Up @@ -40,7 +47,7 @@ if [[ $arch == "aarch64" && $(uname -m) != "x86_64" ]]; then
echo "Compiling for aarch64 is supported only from aarch64 and x86_64"
fi

"$virtualisation_engine" build -t alpine-tezos -f "$docker_file" --build-arg OCTEZ_VERSION="$OCTEZ_VERSION" .
"$virtualisation_engine" build -t alpine-tezos -f "$docker_file" --build-arg=OCTEZ_VERSION="$OCTEZ_VERSION" --build-arg=OCTEZ_EXECUTABLES="$OCTEZ_EXECUTABLES" .
container_id="$("$virtualisation_engine" create alpine-tezos)"
for b in "${binaries[@]}"; do
"$virtualisation_engine" cp "$container_id:/tezos/$b" "$b"
Expand Down

0 comments on commit 67e38c8

Please sign in to comment.