diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f29dc01..02277f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -323,6 +323,78 @@ jobs: path: dist/release/* 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. Ported from GridCraft's release.yml. + runs-on: ubuntu-24.04 + # No `environment: release`: this job signs nothing, so it gets no release secrets. + env: + WORDCRAFT_VERSION: ${{ needs.version.outputs.version }} + WORDCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} + steps: + - uses: actions/checkout@v4 + # Optional font input (docs: storytold/craft-fonts docs/integration.md); releases always embed it. + - name: Check out craft-fonts + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + with: + repository: storytold/craft-fonts + ref: 8dcdacd5153e64560d109541a47d806f26f048c0 + path: craft-fonts + - uses: dtolnay/rust-toolchain@stable + with: + targets: riscv64gc-unknown-linux-gnu + - uses: Swatinem/rust-cache@v2 + with: + key: release-linux-riscv64 + - name: Apply version override + if: inputs.version != '' + run: cargo xtask version set "$WORDCRAFT_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 + # The Linux job's -dev packages, for riscv64. + 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 \ + desktop-file-utils appstream + - 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 + - uses: actions/upload-artifact@v4 + with: + name: release-linux-riscv64 + path: dist/release/*.tar.gz + if-no-files-found: error + freebsd: name: FreeBSD x86_64 needs: version @@ -377,7 +449,7 @@ jobs: release: name: Draft GitHub Release # Needs the signing jobs, which only run on `release`: a branch dry run never gets here. - 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 de57cfc..ae811dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4998,7 +4998,7 @@ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "wordcraft" -version = "0.4.0" +version = "0.5.0" dependencies = [ "arboard", "eframe", @@ -5019,7 +5019,7 @@ dependencies = [ [[package]] name = "wordcraft-cli" -version = "0.4.0" +version = "0.5.0" dependencies = [ "serde_json", "wordcraft-doc", @@ -5031,11 +5031,11 @@ dependencies = [ [[package]] name = "wordcraft-control-key" -version = "0.4.0" +version = "0.5.0" [[package]] name = "wordcraft-doc" -version = "0.4.0" +version = "0.5.0" dependencies = [ "proptest", "serde", @@ -5047,7 +5047,7 @@ dependencies = [ [[package]] name = "wordcraft-docbin" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cfb", "log", @@ -5060,7 +5060,7 @@ dependencies = [ [[package]] name = "wordcraft-docx" -version = "0.4.0" +version = "0.5.0" dependencies = [ "aes", "base64", @@ -5082,7 +5082,7 @@ dependencies = [ [[package]] name = "wordcraft-engine" -version = "0.4.0" +version = "0.5.0" dependencies = [ "image", "js-sys", @@ -5108,7 +5108,7 @@ dependencies = [ [[package]] name = "wordcraft-fonts" -version = "0.4.0" +version = "0.5.0" dependencies = [ "harfrust 0.13.3", "kurbo", @@ -5119,7 +5119,7 @@ dependencies = [ [[package]] name = "wordcraft-formats" -version = "0.4.0" +version = "0.5.0" dependencies = [ "image", "log", @@ -5132,14 +5132,14 @@ dependencies = [ [[package]] name = "wordcraft-geom" -version = "0.4.0" +version = "0.5.0" dependencies = [ "serde", ] [[package]] name = "wordcraft-layout" -version = "0.4.0" +version = "0.5.0" dependencies = [ "js-sys", "log", @@ -5156,7 +5156,7 @@ dependencies = [ [[package]] name = "wordcraft-mcp" -version = "0.4.0" +version = "0.5.0" dependencies = [ "log", "serde_json", @@ -5168,7 +5168,7 @@ dependencies = [ [[package]] name = "wordcraft-metafile" -version = "0.4.0" +version = "0.5.0" dependencies = [ "kurbo", "thiserror 2.0.21", @@ -5176,7 +5176,7 @@ dependencies = [ [[package]] name = "wordcraft-pdf" -version = "0.4.0" +version = "0.5.0" dependencies = [ "hayro-cmap", "hayro-interpret", @@ -5196,7 +5196,7 @@ dependencies = [ [[package]] name = "wordcraft-proof" -version = "0.4.0" +version = "0.5.0" dependencies = [ "log", "miniz_oxide 0.8.9", @@ -5205,7 +5205,7 @@ dependencies = [ [[package]] name = "wordcraft-render" -version = "0.4.0" +version = "0.5.0" dependencies = [ "image", "log", @@ -5219,7 +5219,7 @@ dependencies = [ [[package]] name = "wordcraft-ui-egui" -version = "0.4.0" +version = "0.5.0" dependencies = [ "egui", "egui_kittest", @@ -5241,7 +5241,7 @@ dependencies = [ [[package]] name = "wordcraft-web" -version = "0.4.0" +version = "0.5.0" dependencies = [ "eframe", "egui", @@ -5259,7 +5259,7 @@ dependencies = [ [[package]] name = "wordcraft-zotero" -version = "0.4.0" +version = "0.5.0" dependencies = [ "log", "proptest", @@ -5361,7 +5361,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.4.0" +version = "0.5.0" dependencies = [ "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index 73cd150..98af82c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"] default-members = ["crates/*", "apps/wordcraft", "apps/wordcraft-cli", "xtask"] [workspace.package] -version = "0.4.0" +version = "0.5.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.90" diff --git a/README.md b/README.md index cc006d0..2b763ba 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,9 @@ instead, without setting anything. The log file records the choice (lines starti | Fedora/RHEL/openSUSE | `wordcraft--linux-x86_64.rpm` | `wordcraft--linux-aarch64.rpm` | | | Tarball | `wordcraft--linux-x86_64.tar.gz` | `wordcraft--linux-aarch64.tar.gz` | Unpack anywhere | +RISC-V (riscv64): `wordcraft--linux-riscv64.tar.gz`, a tarball cross-compiled for glibc 2.39+ +(Ubuntu 24.04, Debian 13 and newer). + ### FreeBSD | Build | File | diff --git a/docs/releasing.md b/docs/releasing.md index fbbc52d..411af75 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -13,6 +13,7 @@ this file has the WordCraft specifics. | macOS | universal `WordCraft.app` in a `.dmg`, universal CLI zip | Developer ID + notarization (`APPLE_*` secrets) | | Windows | x64, x86 and arm64 `.msi` + portable `.zip` | Azure Trusted Signing (`AZURE_*` secrets) | | Linux | x86_64 and aarch64 `.AppImage` (+ `.zsync` for AppImageUpdate), `.flatpak` bundle, `.deb`, `.rpm`, `.tar.gz`; Flathub manifest | checksums | +| Linux riscv64 | `.tar.gz` (cross-compiled on `ubuntu-24.04`, glibc >= 2.39; CLI smoke-tested under QEMU) | checksums | | FreeBSD | x86_64 `.tar.gz` | checksums | | Web | `wordcraft-web-.zip` (static site: `index.html`, wasm, glue) | none | @@ -26,5 +27,5 @@ Local packaging: `packaging/macos/package.sh --arch universal`, `packaging/windo `packaging/linux/package.sh` (then `packaging/linux/flatpak-bundle.sh` for the Flatpak), `packaging/web/package.sh`. Dry run: `gh workflow run release.yml --ref ` builds the unsigned jobs (version, Linux, -Flatpak, FreeBSD, web) on any branch; the signing jobs are refused there by the `release` +Linux riscv64, Flatpak, FreeBSD, web) on any branch; the signing jobs are refused there by the `release` environment's branch rule, so no draft release is made. diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index 57d9589..eed6e0a 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build and package WordCraft for Linux ( is x86_64 or aarch64): +# Build and package WordCraft for Linux ( is x86_64 or aarch64, or riscv64 when cross-compiling): # # $DIST/wordcraft--linux-.AppImage any distro with glibc >= the build host's # $DIST/wordcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) @@ -25,13 +25,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 +43,13 @@ BASENAME="wordcraft-$VERSION-linux-$ARCH" echo "==> WordCraft $VERSION for Linux $ARCH ($FORMATS)" if [ "$SKIP_BUILD" = 0 ]; then - (cd "$ROOT" && cargo build --release --locked -p wordcraft -p wordcraft-cli) + if [ -n "${CROSS_TARGET:-}" ]; then + (cd "$ROOT" && cargo build --release --locked -p wordcraft -p wordcraft-cli --target "$CROSS_TARGET") + else + (cd "$ROOT" && cargo build --release --locked -p wordcraft -p wordcraft-cli) + fi 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 +57,7 @@ rm -rf "$WORK" # ---- stage an FHS tree (shared by every format) ------------------------------------------------- install -Dm755 "$BIN/wordcraft" "$STAGE/usr/bin/wordcraft" install -Dm755 "$BIN/wordcraft-cli" "$STAGE/usr/bin/wordcraft-cli" -strip "$STAGE/usr/bin/wordcraft" "$STAGE/usr/bin/wordcraft-cli" 2>/dev/null || true +"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/wordcraft" "$STAGE/usr/bin/wordcraft-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 +140,10 @@ if has appimage; then fi fi -"$STAGE/usr/bin/wordcraft-cli" --version +if [ -z "${CROSS_TARGET:-}" ]; then + "$STAGE/usr/bin/wordcraft-cli" --version +elif [ -n "${EMULATOR:-}" ]; then + "$EMULATOR" "$STAGE/usr/bin/wordcraft-cli" --version +fi echo "==> done" ls -lh "$DIST"