diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c81bf050..b7e3036d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,9 @@ # The signing jobs (macOS, Windows) and the draft-release job run in the `release` environment # (restricted to the `release` branch), which holds the signing secrets. Every secret is optional: # missing ones produce unsigned artifacts and a warning, never a failed build. The jobs that sign -# nothing (version, Linux, Flatpak, FreeBSD, web) run without it, so a dispatch on any branch is -# a dry run of them; the release job needs the signed jobs, so a branch run never drafts a release. +# nothing (version, Linux, Linux riscv64, Flatpak, FreeBSD, web) run without it, so a dispatch on +# any branch is a dry run of them; the release job needs the signed jobs, so a branch run never +# drafts a release. name: Release on: @@ -272,6 +273,79 @@ jobs: path: dist/release/*.flatpak if-no-files-found: error + linux-riscv64: + name: Linux riscv64 + needs: version + # Cross-compiled on x86_64 (no hosted RISC-V runners) against the runner's own Ubuntu release + # from ports.ubuntu.com, so the binaries need that release's glibc (24.04: 2.39). 22.04's + # riscv64 ports lag its amd64 updates, which breaks the multiarch install. tar.gz only; the + # CLI is smoke-tested under QEMU. + runs-on: ubuntu-24.04 + # No `environment: release`: this job signs nothing, so it gets no release secrets. + env: + LIGHTCRAFT_VERSION: ${{ needs.version.outputs.version }} + LIGHTCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + # Fonts (optional build input; required for releases): see craftrules standards/fonts.md. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: storytold/craft-fonts + ref: 8dcdacd5153e64560d109541a47d806f26f048c0 # bump deliberately + path: craft-fonts + - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable + with: + targets: riscv64gc-unknown-linux-gnu + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: release-linux-riscv64 + - name: Apply version override + if: inputs.version != '' + run: cargo xtask version set "$LIGHTCRAFT_VERSION" + - name: Install cross-compilation dependencies + run: | + . /etc/os-release + sudo dpkg --add-architecture riscv64 + # Pin the existing (archive.ubuntu.com) sources to amd64; riscv64 comes from ports. + if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then + sudo sed -i '/^Types: deb/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources + fi + if [ -f /etc/apt/sources.list ]; then + sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list + sudo sed -i 's/^deb-src /deb-src [arch=amd64] /g' /etc/apt/sources.list + fi + for suite in "$VERSION_CODENAME" "$VERSION_CODENAME-updates" "$VERSION_CODENAME-security"; do + echo "deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports $suite main universe restricted multiverse" + done | sudo tee /etc/apt/sources.list.d/riscv64.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu libc6-dev-riscv64-cross libc6-dev:riscv64 qemu-user \ + libxkbcommon-dev:riscv64 libwayland-dev:riscv64 libx11-dev:riscv64 libxrandr-dev:riscv64 \ + libxi-dev:riscv64 libgl1-mesa-dev:riscv64 + - name: Build and package (tar.gz) + env: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc + PKG_CONFIG_SYSROOT_DIR: / + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig:/usr/share/pkgconfig + PKG_CONFIG_ALLOW_CROSS: "1" + CROSS_ARCH: riscv64 + CROSS_TARGET: riscv64gc-unknown-linux-gnu + CROSS_COMPILE: riscv64-linux-gnu- + EMULATOR: qemu-riscv64 + QEMU_LD_PREFIX: /usr/riscv64-linux-gnu + run: packaging/linux/package.sh --formats tar + - name: Check the tarball + run: | + tar -tzf dist/release/lightcraft-*-linux-riscv64.tar.gz \ + | grep -E '/bin/lightcraft$|/bin/lightcraft-cli$|/share/applications/ai\.storyteller\.lightcraft\.desktop$' + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: release-linux-riscv64 + path: dist/release/*.tar.gz + if-no-files-found: error + freebsd: name: FreeBSD x86_64 needs: version @@ -368,7 +442,7 @@ jobs: release: name: Draft GitHub Release - needs: [version, macos, windows, linux, flatpak, freebsd, web] + needs: [version, macos, windows, linux, linux-riscv64, flatpak, freebsd, web] runs-on: ubuntu-latest environment: release permissions: diff --git a/Cargo.lock b/Cargo.lock index 0ad4ab84..31abb19c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2976,7 +2976,7 @@ dependencies = [ [[package]] name = "lightcraft" -version = "0.5.0" +version = "0.6.0" dependencies = [ "eframe", "egui", @@ -2994,7 +2994,7 @@ dependencies = [ [[package]] name = "lightcraft-catalog" -version = "0.5.0" +version = "0.6.0" dependencies = [ "crc32fast", "lightcraft-develop", @@ -3010,7 +3010,7 @@ dependencies = [ [[package]] name = "lightcraft-cli" -version = "0.5.0" +version = "0.6.0" dependencies = [ "dhat", "lightcraft-codecs", @@ -3025,7 +3025,7 @@ dependencies = [ [[package]] name = "lightcraft-codecs" -version = "0.5.0" +version = "0.6.0" dependencies = [ "avif-serialize", "bytemuck", @@ -3053,7 +3053,7 @@ dependencies = [ [[package]] name = "lightcraft-color" -version = "0.5.0" +version = "0.6.0" dependencies = [ "lightcraft-geom", "proptest", @@ -3062,7 +3062,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise" -version = "0.5.0" +version = "0.6.0" dependencies = [ "faer-core", "lightcraft-denoise-core", @@ -3079,7 +3079,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise-core" -version = "0.5.0" +version = "0.6.0" dependencies = [ "lightcraft-raster", "miniz_oxide 0.8.9", @@ -3094,7 +3094,7 @@ dependencies = [ [[package]] name = "lightcraft-develop" -version = "0.5.0" +version = "0.6.0" dependencies = [ "lightcraft-color", "lightcraft-geom", @@ -3106,7 +3106,7 @@ dependencies = [ [[package]] name = "lightcraft-engine" -version = "0.5.0" +version = "0.6.0" dependencies = [ "ab_glyph", "harfrust", @@ -3143,7 +3143,7 @@ dependencies = [ [[package]] name = "lightcraft-faces" -version = "0.5.0" +version = "0.6.0" dependencies = [ "matrixmultiply", "ndarray", @@ -3157,7 +3157,7 @@ dependencies = [ [[package]] name = "lightcraft-fetch" -version = "0.5.0" +version = "0.6.0" dependencies = [ "log", "rustls", @@ -3168,7 +3168,7 @@ dependencies = [ [[package]] name = "lightcraft-geom" -version = "0.5.0" +version = "0.6.0" dependencies = [ "proptest", "serde", @@ -3176,7 +3176,7 @@ dependencies = [ [[package]] name = "lightcraft-gpu" -version = "0.5.0" +version = "0.6.0" dependencies = [ "bytemuck", "lightcraft-color", @@ -3194,7 +3194,7 @@ dependencies = [ [[package]] name = "lightcraft-heif" -version = "0.5.0" +version = "0.6.0" dependencies = [ "heic-rs", "rayon", @@ -3202,7 +3202,7 @@ dependencies = [ [[package]] name = "lightcraft-mcp" -version = "0.5.0" +version = "0.6.0" dependencies = [ "lightcraft-codecs", "lightcraft-engine", @@ -3213,7 +3213,7 @@ dependencies = [ [[package]] name = "lightcraft-merge" -version = "0.5.0" +version = "0.6.0" dependencies = [ "lightcraft-codecs", "lightcraft-color", @@ -3229,7 +3229,7 @@ dependencies = [ [[package]] name = "lightcraft-meta" -version = "0.5.0" +version = "0.6.0" dependencies = [ "lightcraft-geom", "lightcraft-tiff", @@ -3241,7 +3241,7 @@ dependencies = [ [[package]] name = "lightcraft-pipeline" -version = "0.5.0" +version = "0.6.0" dependencies = [ "image", "lightcraft-color", @@ -3258,7 +3258,7 @@ dependencies = [ [[package]] name = "lightcraft-preview" -version = "0.5.0" +version = "0.6.0" dependencies = [ "jpeg-encoder", "lightcraft-raster", @@ -3270,7 +3270,7 @@ dependencies = [ [[package]] name = "lightcraft-raster" -version = "0.5.0" +version = "0.6.0" dependencies = [ "libc", "lightcraft-color", @@ -3282,7 +3282,7 @@ dependencies = [ [[package]] name = "lightcraft-raw" -version = "0.5.0" +version = "0.6.0" dependencies = [ "jpeg-encoder", "jxl-oxide", @@ -3304,7 +3304,7 @@ dependencies = [ [[package]] name = "lightcraft-scenes" -version = "0.5.0" +version = "0.6.0" dependencies = [ "image", "lightcraft-color", @@ -3315,7 +3315,7 @@ dependencies = [ [[package]] name = "lightcraft-segment" -version = "0.5.0" +version = "0.6.0" dependencies = [ "candle-core", "candle-nn", @@ -3328,11 +3328,11 @@ dependencies = [ [[package]] name = "lightcraft-sysmem" -version = "0.5.0" +version = "0.6.0" [[package]] name = "lightcraft-tiff" -version = "0.5.0" +version = "0.6.0" dependencies = [ "proptest", "serde", @@ -3341,7 +3341,7 @@ dependencies = [ [[package]] name = "lightcraft-ui-egui" -version = "0.5.0" +version = "0.6.0" dependencies = [ "egui", "lightcraft-catalog", @@ -3366,7 +3366,7 @@ dependencies = [ [[package]] name = "lightcraft-web" -version = "0.5.0" +version = "0.6.0" dependencies = [ "crc32fast", "eframe", @@ -6826,7 +6826,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "xtask" -version = "0.5.0" +version = "0.6.0" dependencies = [ "brotli", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 58e5383b..08e0ac51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*", "apps/*", "xtask"] [workspace.package] -version = "0.5.0" +version = "0.6.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.90" diff --git a/README.md b/README.md index d395a104..cc1fd85f 100644 --- a/README.md +++ b/README.md @@ -483,6 +483,8 @@ option to start it. For unattended installs: `msiexec /i lightcraft--window | Fedora/RHEL/openSUSE | `lightcraft--linux-x86_64.rpm` | `lightcraft--linux-aarch64.rpm` | | | Tarball | `lightcraft--linux-x86_64.tar.gz` | `lightcraft--linux-aarch64.tar.gz` | Unpack anywhere | +RISC-V (riscv64): `lightcraft--linux-riscv64.tar.gz`, a tarball only (glibc 2.39 or newer, e.g. Ubuntu 24.04+). + ### FreeBSD | Build | File | diff --git a/docs/releasing.md b/docs/releasing.md index de348811..feff91d8 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -22,7 +22,7 @@ release that has already been published, so bump the version before producing an ## Builds and artifacts -Release jobs build macOS universal, Windows x86/x64/ARM64, Linux x86_64/aarch64, FreeBSD x86_64, +Release jobs build macOS universal, Windows x86/x64/ARM64, Linux x86_64/aarch64/riscv64, FreeBSD x86_64, and the WASM web app. The platform scripts in [`packaging/`](../packaging/) write their outputs to `dist/release/` (the full list of files is the README's Downloads section): @@ -32,6 +32,9 @@ and the WASM web app. The platform scripts in [`packaging/`](../packaging/) writ architecture (`packaging/linux/package.sh`). Each AppImage embeds `gh-releases-zsync|storytold|lightcraft|latest|lightcraft-*-linux-.AppImage.zsync`, so AppImageUpdate fetches only the changed blocks from the latest published (non-pre-) release. +- Linux riscv64: `.tar.gz` only, cross-compiled on Ubuntu 24.04 against its riscv64 ports + libraries (so glibc 2.39 or newer), with the CLI smoke-tested under QEMU (`CROSS_*` variables + of `packaging/linux/package.sh`). - Flatpak: a single-file `.flatpak` bundle for each architecture, repackaged from that architecture's Linux tarball (`packaging/linux/flatpak-bundle.sh` with `packaging/linux/flatpak/ai.storyteller.lightcraft.bundle.yml`; no Rust build). The from-source diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index 441cd69c..b5e1d945 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build and package LightCraft for Linux ( is x86_64 or aarch64): +# Build and package LightCraft for Linux ( is x86_64 or aarch64, or riscv64 when cross-compiling): # # $DIST/lightcraft--linux-.AppImage any distro with glibc >= the build host's # $DIST/lightcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) @@ -13,6 +13,8 @@ # (downloaded into $CARGO_TARGET_DIR if missing). Build on an old distro (CI: Ubuntu 22.04, # glibc 2.35) so the binaries run on newer ones. Optional: desktop-file-validate, appstreamcli, # zsyncmake (the zsync package) for the AppImage's .zsync. +# Cross-compiling (CI: riscv64, tar only): set CROSS_ARCH, CROSS_TARGET (the Rust target), +# CROSS_COMPILE (binutils prefix, for strip) and optionally EMULATOR (runs the CLI smoke test). set -euo pipefail # shellcheck source=../env.sh . "$(dirname "${BASH_SOURCE[0]}")/../env.sh" @@ -25,13 +27,14 @@ while [ $# -gt 0 ]; do case "$1" in --skip-build) SKIP_BUILD=1; shift ;; --formats) FORMATS="$2"; shift 2 ;; - -h | --help) sed -n '2,15p' "$0"; exit 0 ;; + -h | --help) sed -n '2,17p' "$0"; exit 0 ;; *) echo "unknown argument: $1" >&2; exit 2 ;; esac done -ARCH="$(uname -m)" +ARCH="${CROSS_ARCH:-$(uname -m)}" case "$ARCH" in + riscv64) DEB_ARCH=riscv64 ;; x86_64) DEB_ARCH=amd64 ;; aarch64 | arm64) ARCH=aarch64; DEB_ARCH=arm64 ;; *) echo "unsupported architecture $ARCH" >&2; exit 2 ;; @@ -42,9 +45,10 @@ BASENAME="lightcraft-$VERSION-linux-$ARCH" echo "==> LightCraft $VERSION for Linux $ARCH ($FORMATS)" if [ "$SKIP_BUILD" = 0 ]; then - (cd "$ROOT" && cargo build --release --locked -p lightcraft -p lightcraft-cli --features lightcraft/heif,lightcraft-cli/heif) + (cd "$ROOT" && cargo build --release --locked -p lightcraft -p lightcraft-cli --features lightcraft/heif,lightcraft-cli/heif \ + ${CROSS_TARGET:+--target "$CROSS_TARGET"}) fi -BIN="$CARGO_TARGET_DIR/release" +BIN="$CARGO_TARGET_DIR/${CROSS_TARGET:+$CROSS_TARGET/}release" WORK="$CARGO_TARGET_DIR/linux-package" STAGE="$WORK/root" rm -rf "$WORK" @@ -52,7 +56,7 @@ rm -rf "$WORK" # ---- stage an FHS tree (shared by every format) ------------------------------------------------- install -Dm755 "$BIN/lightcraft" "$STAGE/usr/bin/lightcraft" install -Dm755 "$BIN/lightcraft-cli" "$STAGE/usr/bin/lightcraft-cli" -strip "$STAGE/usr/bin/lightcraft" "$STAGE/usr/bin/lightcraft-cli" 2>/dev/null || true +"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/lightcraft" "$STAGE/usr/bin/lightcraft-cli" 2>/dev/null || true install -Dm644 "$HERE/$APP_ID.desktop" "$STAGE/usr/share/applications/$APP_ID.desktop" install -Dm644 "$HERE/$APP_ID.mime.xml" "$STAGE/usr/share/mime/packages/$APP_ID.xml" mkdir -p "$STAGE/usr/share/metainfo" @@ -135,6 +139,10 @@ if has appimage; then fi fi -"$STAGE/usr/bin/lightcraft-cli" --version +if [ -z "${CROSS_TARGET:-}" ]; then + "$STAGE/usr/bin/lightcraft-cli" --version +elif [ -n "${EMULATOR:-}" ]; then + "$EMULATOR" "$STAGE/usr/bin/lightcraft-cli" --version +fi echo "==> done" ls -lh "$DIST"