Try working on cross compiling

This commit is contained in:
Austen Adler 2021-05-13 00:33:30 -04:00
parent 0f6b1772fc
commit a14f940d30
2 changed files with 17 additions and 2 deletions

View File

@ -15,6 +15,18 @@ termion = "1.5"
serde = {version = "1.0", features = ["derive"]} serde = {version = "1.0", features = ["derive"]}
confy = "0.4.0" confy = "0.4.0"
#[target.arm-linux-linux-muxl]
#linker = "arm-linux-unknown-gcc"
[target.aarch64-linux-musl]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-gcc]
linker = "aarch64-linux-gnu-gcc"
# TODO: cross compilation # TODO: cross compilation
# [target.arm-unknown-linux-gnueabihf] # [target.arm-unknown-linux-gnueabihf]
# linker = "arm-linux-gnueabihf-gcc" # linker = "arm-linux-gnueabihf-gcc"

View File

@ -2,7 +2,7 @@ FROM rust:latest
ENV CARGO_HOME=/deps ENV CARGO_HOME=/deps
WORKDIR /work WORKDIR /work
RUN apt-get update RUN apt-get update
RUN apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu RUN apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu gdb-mingw-w64 gcc-mingw-w64-x86-64
deps: deps:
COPY ./Cargo.toml ./Cargo.lock . COPY ./Cargo.toml ./Cargo.lock .
@ -20,11 +20,14 @@ build:
COPY ./src/ ./src/ COPY ./src/ ./src/
RUN cargo build --release --target "$TOOLCHAIN" RUN cargo build --release --target "$TOOLCHAIN"
RUN strip "target/$TOOLCHAIN/release/rpn_rs" RUN strip "target/$TOOLCHAIN/release/rpn_rs"
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs RUN xz --keep "target/$TOOLCHAIN/release/rpn_rs"
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs-$TOOLCHAIN
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs.xz AS LOCAL target/$TOOLCHAIN/release/rpn_rs-$TOOLCHAIN.xz
all: all:
BUILD --build-arg TOOLCHAIN=x86_64-unknown-linux-musl +build BUILD --build-arg TOOLCHAIN=x86_64-unknown-linux-musl +build
BUILD --build-arg TOOLCHAIN=i686-unknown-linux-musl +build BUILD --build-arg TOOLCHAIN=i686-unknown-linux-musl +build
# BUILD --build-arg TOOLCHAIN=x86_64-pc-windows-gnu +build
# TODO: Cross compile # TODO: Cross compile
# BUILD --build-arg TOOLCHAIN=aarch64-unknown-linux-musl +build # BUILD --build-arg TOOLCHAIN=aarch64-unknown-linux-musl +build
# BUILD --build-arg TOOLCHAIN=arm-unknown-linux-musleabi +build # BUILD --build-arg TOOLCHAIN=arm-unknown-linux-musleabi +build