From 260c166ce95b0606cb940ebcf7798d15ada7aa77 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Thu, 22 Jun 2023 07:38:58 -0400 Subject: [PATCH] Update cross-compile documentation Also, add initial CI test --- .gitignore | 4 +++- .woodpecker.yml | 19 +++++++++++++++++++ README.md | 2 +- shell.nix | 15 +++++++++++++-- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .woodpecker.yml diff --git a/.gitignore b/.gitignore index 806522a..1f4a548 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /target /logs -/output \ No newline at end of file +/output +.cargo +.rustup diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..2f60e03 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,19 @@ +pipeline: + build: + image: rust:bookworm + commands: + - cargo check + - apt update && apt install -y lld + - cargo build --release --target aarch64-unknown-linux-musl + publish: + image: woodpeckerci/plugin-gitea-release + settings: + base_url: https://git.blizzard.systems + files: + - "target/aarch64-unknown-linux-musl/release/seymour_life" + api_key: + from_secret: API_KEY + target: devel + draft: true + prerelease: true + title: diff --git a/README.md b/README.md index 7a71ce0..9546c93 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ You can also build without the `--release` flag, which wil take less time, but w Cross compilation is possible with this project, if you do not have a Raspberry Pi available specifically for compilation. Compilation directly on the Pi is rather intensive, and takes significantly longer than cross-compiling. -If you are compiling on Linux, cross-compilation has a dependency of `lld`. This can be found in your distribution's package manager, or directly distributed by LLVM. +If you are compiling on Linux, cross-compilation has a dependency of `lld`. This can be found in your distribution's package manager, or directly distributed by LLVM. For Nix users, a predefined `shell.nix` file has been provided for your convenience. If you are compiling on Windows, to safely cross-compile, you must modify the `.cargo/config.toml` file. Replace `lld` with `rust-lld`, then cross-compilation should work properly. diff --git a/shell.nix b/shell.nix index 42ef54a..478c392 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,15 @@ {pkgs ? import {} }: - pkgs.mkShell { - nativeBuildInputs = with pkgs; [ cargo rustc ]; + pkgs.mkShell rec { + buildInputs = with pkgs; [ lld rustup ]; + RUSTUP_HOME = toString ./.rustup; + CARGO_HOME = toString ./.cargo; + RUSTUP_TOOLCHAIN = "stable"; + HOST_ARCH = "x86_64-unknown-linux-gnu"; + CARGO_BUILD_TARGET = "aarch64-unknown-linux-musl"; + shellHook = '' + export PATH=$PATH:${CARGO_HOME}/bin + export PATH=$PATH:${RUSTUP_HOME}/toolchains/${RUSTUP_TOOLCHAIN}-${HOST_ARCH}/bin/ + + rustup target add "${CARGO_BUILD_TARGET}" + ''; }