diff --git a/.gitignore b/.gitignore index 61afd58..8bf6147 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,8 @@ debug/ target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock +# This workspace ships a CLI, so Cargo.lock is tracked. +/dist/ # These are backup files generated by rustfmt **/*.rs.bk diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..8196815 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,10 @@ +# cross 0.2.5 release images are too old for current Rust build scripts. +# Use the newer images tested with the release target matrix. +[target.x86_64-unknown-linux-musl] +image = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main" + +[target.aarch64-unknown-linux-musl] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main" + +[target.x86_64-pc-windows-gnu] +image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:main" diff --git a/README.md b/README.md index 8ab393f..4925a97 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ ```bash # Clone the repository -git clone https://github.com/yourname/epoch_forge.git +git clone https://proxy.dandaedre.com/gitea/idle-org/epoch_forge.git cd epoch_forge # Build & install the binary -cargo install --path . +cargo install --locked --path bin_efo # Initialise an empty world (epoch 0) efo init @@ -113,3 +113,26 @@ Please remember that **stability is not guaranteed**, so use it in a versionned Happy forging! ✨ + +## Binary releases + +The CLI package is `efo`, in the `bin_efo` workspace member. Release tags follow +its Cargo version (for example, `v0.1.0`). The publisher is invoked from its own +checkout with: + +```bash +./release.sh /path/to/epoch_forge --package efo --tag v0.1.0 +``` + +The workspace lockfile is tracked. `Cross.toml` selects the tested cross images +for x86-64 musl Linux, AArch64 musl Linux, and x86-64 GNU Windows. The build scripts +work with rustc alone inside cross containers; rustup is not required there. + +Release archives use `efo-{target}-v{version}.tgz` and contain the matching root +directory with `efo` (or `efo.exe`). `SHA256SUMS` accompanies the archives. The +selected package manifest carries cargo-binstall metadata for the Gitea URLs. +After the matching release has been published, install from the local manifest: + +```bash +cargo binstall efo --manifest-path bin_efo/Cargo.toml +``` diff --git a/bin_efo/Cargo.toml b/bin_efo/Cargo.toml index cae5578..ff63ca7 100644 --- a/bin_efo/Cargo.toml +++ b/bin_efo/Cargo.toml @@ -2,7 +2,12 @@ name = "efo" version = "0.1.0" edition = "2024" +repository = "https://proxy.dandaedre.com/gitea/idle-org/epoch_forge" +[package.metadata.binstall] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }.tgz" +pkg-fmt = "tgz" +bin-dir = "{ name }-{ target }-v{ version }/{ bin }{ binary-ext }" [dependencies] lib_efo = { path = "../lib_efo" } serde = {workspace = true} diff --git a/bin_efo/build.rs b/bin_efo/build.rs index c815c22..1893062 100644 --- a/bin_efo/build.rs +++ b/bin_efo/build.rs @@ -28,22 +28,13 @@ fn main() { let git_branch = run_cmd(Command::new("git").args(args)); println!("cargo:rustc-env=GIT_BRANCH={}", git_branch); - // Prefer the explicit env var – it mirrors the real user choice + // cross images contain rustc but need not contain the rustup manager. + let rustc_version = run_cmd(Command::new("rustc").args(["--version"])); let toolchain = std::env::var("RUSTUP_TOOLCHAIN") - .map(|v| v.trim().to_owned()) - .unwrap_or_else(|_| { - // Try rustup first; if that fails, fall back to rustc - let raw = run_cmd(Command::new("rustup").args(["show", "active-toolchain"])); - - // rustup output may look like: - // stable-x86_64-unknown-linux-gnu (overridden by environment variable) - // We only want the part before the first '(' - raw.split('(').next().unwrap().trim().to_owned() - }); + .map(|value| value.trim().to_owned()) + .unwrap_or_else(|_| rustc_version.clone()); println!("cargo:rustc-env=TOOLCHAIN={}", toolchain); - - let rustc_version = run_cmd(Command::new("rustc").args(["--version"])); println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version); println!( "cargo:rustc-env=EFO_SHORT_VERSION={} ({}{})", diff --git a/lib_efo/build.rs b/lib_efo/build.rs index c815c22..1893062 100644 --- a/lib_efo/build.rs +++ b/lib_efo/build.rs @@ -28,22 +28,13 @@ fn main() { let git_branch = run_cmd(Command::new("git").args(args)); println!("cargo:rustc-env=GIT_BRANCH={}", git_branch); - // Prefer the explicit env var – it mirrors the real user choice + // cross images contain rustc but need not contain the rustup manager. + let rustc_version = run_cmd(Command::new("rustc").args(["--version"])); let toolchain = std::env::var("RUSTUP_TOOLCHAIN") - .map(|v| v.trim().to_owned()) - .unwrap_or_else(|_| { - // Try rustup first; if that fails, fall back to rustc - let raw = run_cmd(Command::new("rustup").args(["show", "active-toolchain"])); - - // rustup output may look like: - // stable-x86_64-unknown-linux-gnu (overridden by environment variable) - // We only want the part before the first '(' - raw.split('(').next().unwrap().trim().to_owned() - }); + .map(|value| value.trim().to_owned()) + .unwrap_or_else(|_| rustc_version.clone()); println!("cargo:rustc-env=TOOLCHAIN={}", toolchain); - - let rustc_version = run_cmd(Command::new("rustc").args(["--version"])); println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version); println!( "cargo:rustc-env=EFO_SHORT_VERSION={} ({}{})",