roc/Earthfile

62 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-07-15 14:44:32 +03:00
VERSION 0.6
2023-09-26 13:08:16 +03:00
FROM rust:1.71.1-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version
2023-07-12 11:36:35 +03:00
WORKDIR /earthbuild
prep-debian:
RUN apt -y update
install-other-libs:
FROM +prep-debian
RUN apt -y install wget git
2023-07-15 14:44:32 +03:00
RUN apt -y install libunwind-dev pkg-config zlib1g-dev
2023-07-12 11:36:35 +03:00
RUN apt -y install unzip # for www/build.sh
2023-07-15 14:44:32 +03:00
install-zig-llvm:
ARG ZIG_ARCH
2023-07-12 11:36:35 +03:00
FROM +install-other-libs
# zig
RUN wget -c https://ziglang.org/download/0.11.0/zig-linux-$ZIG_ARCH-0.11.0.tar.xz --no-check-certificate
RUN tar -xf zig-linux-$ZIG_ARCH-0.11.0.tar.xz
RUN ln -s /earthbuild/zig-linux-$ZIG_ARCH-0.11.0/zig /bin/zig
2023-07-12 11:36:35 +03:00
# zig builtins wasm tests
RUN apt -y install build-essential
# llvm
RUN apt -y install lsb-release software-properties-common gnupg
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 16
RUN ln -s /usr/bin/clang-16 /usr/bin/clang
2023-07-12 11:36:35 +03:00
# use lld as linker
RUN ln -s /usr/bin/lld-16 /usr/bin/ld.lld
2023-10-24 16:39:32 +03:00
RUN apt -y install libpolly-16-dev # required by llvm-sys crate
2023-07-12 11:36:35 +03:00
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld -C target-cpu=native"
RUN apt -y install libssl-dev
RUN OPENSSL_NO_VENDOR=1 cargo install wasm-pack
# sccache
RUN cargo install sccache --locked
2023-07-12 11:36:35 +03:00
RUN sccache -V
ENV RUSTC_WRAPPER=/usr/local/cargo/bin/sccache
ENV SCCACHE_DIR=/earthbuild/sccache_dir
ENV CARGO_INCREMENTAL=0 # no need to recompile package when using new function
copy-dirs:
ARG ZIG_ARCH
FROM +install-zig-llvm --ZIG_ARCH=$ZIG_ARCH
2023-07-15 14:44:32 +03:00
COPY --dir crates examples Cargo.toml Cargo.lock version.txt .cargo www rust-toolchain.toml ./
2023-07-12 11:36:35 +03:00
build-nightly-release:
2023-07-15 14:44:32 +03:00
ARG RELEASE_FOLDER_NAME
2023-07-17 19:17:16 +03:00
ARG RUSTFLAGS
ARG ZIG_ARCH=x86_64
FROM +copy-dirs --ZIG_ARCH=$ZIG_ARCH
2023-07-12 11:36:35 +03:00
COPY --dir .git LICENSE LEGAL_DETAILS ci ./
# version.txt is used by the CLI: roc --version
RUN ./ci/write_version.sh
2023-07-17 19:17:16 +03:00
RUN RUSTFLAGS=$RUSTFLAGS cargo build --profile=release-with-lto --locked --bin roc
2023-07-12 11:36:35 +03:00
# strip debug info
RUN strip ./target/release-with-lto/roc
2023-07-15 14:44:32 +03:00
RUN ./ci/package_release.sh $RELEASE_FOLDER_NAME
RUN ls
SAVE ARTIFACT ./$RELEASE_FOLDER_NAME.tar.gz AS LOCAL $RELEASE_FOLDER_NAME.tar.gz