diff --git a/.github/workflow-templates/cargo-build/action.yml b/.github/workflow-templates/cargo-build/action.yml index acb2786a57..c243473053 100644 --- a/.github/workflow-templates/cargo-build/action.yml +++ b/.github/workflow-templates/cargo-build/action.yml @@ -19,15 +19,6 @@ runs: echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV echo "SCCACHE_CACHE_SIZE=100GB" >> $GITHUB_ENV - # Set RUSTFLAGS if not already set - if [ -z "$RUSTFLAGS" ]; then - echo "RUSTFLAGS=-C opt-level=3 -D warnings -C linker=clang -C link-arg=-fuse-ld=$(pwd)/mold/bin/mold" >> $GITHUB_ENV - fi - - name: Setup Mold Linker - shell: bash - run: | - mkdir -p mold - curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - - name: Build moonbeam shell: bash run: | diff --git a/docker/moonbeam-builder.Dockerfile b/docker/moonbeam-builder.Dockerfile index f24a8f3922..0ffb0c8ed1 100644 --- a/docker/moonbeam-builder.Dockerfile +++ b/docker/moonbeam-builder.Dockerfile @@ -4,9 +4,10 @@ FROM docker.io/library/ubuntu:22.04 AS builder -ARG RUSTFLAGS="" +ARG BUILD_PARAMS="--release --all" +ARG RUSTFLAGS="-C opt-level=3 -D warnings -C linker=clang -C link-arg=-fuse-ld=/build/mold/bin/mold" +ENV BUILD_PARAMS=$BUILD_PARAMS ENV RUSTFLAGS=$RUSTFLAGS -ENV BUILD_PARAMS="--release --all" ENV DEBIAN_FRONTEND=noninteractive WORKDIR /build @@ -19,6 +20,11 @@ RUN apt install --assume-yes git clang curl libssl-dev llvm libudev-dev make pro RUN set -e +# Setup mold linker +RUN echo "*** Setup mold linker ***" +RUN mkdir -p mold +RUN curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - + RUN echo "*** Installing Rust environment ***" RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:$PATH"