Add earthfile compiling
This commit is contained in:
parent
9a18f8af73
commit
8ad770d046
3
.earthignore
Normal file
3
.earthignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!/src
|
||||||
|
!/Cargo.*
|
10
Cargo.toml
10
Cargo.toml
@ -14,3 +14,13 @@ tui = "0.14"
|
|||||||
termion = "1.5"
|
termion = "1.5"
|
||||||
serde = {version = "1.0", features = ["derive"]}
|
serde = {version = "1.0", features = ["derive"]}
|
||||||
confy = "0.4.0"
|
confy = "0.4.0"
|
||||||
|
|
||||||
|
# TODO: cross compilation
|
||||||
|
# [target.arm-unknown-linux-gnueabihf]
|
||||||
|
# linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
|
||||||
|
# [target.armv7-unknown-linux-musleabi]
|
||||||
|
# linker = "armv7-unknown-linux-musleabi-gcc"
|
||||||
|
|
||||||
|
# [target.aarch64-unknown-linux-musl]
|
||||||
|
# linker = "aarch64-unknown-linux-musl-gcc"
|
||||||
|
30
build.earth
Normal file
30
build.earth
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
FROM rust:latest
|
||||||
|
ENV CARGO_HOME=/deps
|
||||||
|
WORKDIR /work
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu
|
||||||
|
|
||||||
|
deps:
|
||||||
|
COPY ./Cargo.toml ./Cargo.lock .
|
||||||
|
RUN mkdir src && touch src/main.rs
|
||||||
|
RUN cargo fetch
|
||||||
|
SAVE ARTIFACT /deps
|
||||||
|
|
||||||
|
build:
|
||||||
|
ARG TOOLCHAIN
|
||||||
|
RUN rustup target add $TOOLCHAIN
|
||||||
|
SAVE IMAGE docker-wg:5000/rust-builder:$TOOLCHAIN
|
||||||
|
|
||||||
|
COPY +deps/deps /deps
|
||||||
|
COPY ./Cargo.toml ./Cargo.lock .
|
||||||
|
COPY ./src/ ./src/
|
||||||
|
RUN cargo build --release --target $TOOLCHAIN
|
||||||
|
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs
|
||||||
|
|
||||||
|
all:
|
||||||
|
BUILD --build-arg TOOLCHAIN=x86_64-unknown-linux-musl +build
|
||||||
|
BUILD --build-arg TOOLCHAIN=i686-unknown-linux-musl +build
|
||||||
|
# TODO: Cross compile
|
||||||
|
# BUILD --build-arg TOOLCHAIN=aarch64-unknown-linux-musl +build
|
||||||
|
# BUILD --build-arg TOOLCHAIN=arm-unknown-linux-musleabi +build
|
||||||
|
# BUILD --build-arg TOOLCHAIN=armv7-unknown-linux-musleabi +build
|
Loading…
Reference in New Issue
Block a user