diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml index 7fc97a437..e1ed5844a 100644 --- a/.github/workflows/packaging-lint.yml +++ b/.github/workflows/packaging-lint.yml @@ -54,4 +54,13 @@ jobs: desktop-file-validate packaging/linux/ai.storyteller.cadcraft.desktop sed -e 's/@VERSION@/0.0.0/' -e 's/@DATE@/2026-01-01/' packaging/linux/ai.storyteller.cadcraft.metainfo.xml.in >"$RUNNER_TEMP/ai.storyteller.cadcraft.metainfo.xml" appstreamcli validate --no-net --explain "$RUNNER_TEMP/ai.storyteller.cadcraft.metainfo.xml" - python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.cadcraft.yml')); assert m['id'] == 'ai.storyteller.cadcraft' and m['command'] == 'cadcraft'" + python3 - <<'EOF' + import yaml + src = yaml.safe_load(open("packaging/linux/flatpak/ai.storyteller.cadcraft.yml")) + bundle = yaml.safe_load(open("packaging/linux/flatpak/ai.storyteller.cadcraft.bundle.yml")) + for m in (src, bundle): + assert m["id"] == "ai.storyteller.cadcraft" and m["command"] == "cadcraft", m["id"] + for key in ("runtime", "runtime-version", "sdk", "finish-args"): + assert src[key] == bundle[key], f"Flatpak manifests disagree on {key}: {src[key]} vs {bundle[key]}" + print("Flatpak manifests ok") + EOF diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb09173c5..e33cba037 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,13 @@ # Release pipeline: every push to `release` builds signed installers for every platform and # creates or updates the draft GitHub Release "CADCraft v". See docs/releasing.md. # -# Only the `release` branch builds: pushes to it trigger the run, and a manual dispatch from any -# other ref is skipped by the guard on the `version` job (every other job needs it). Pushing to -# `release` is limited by a repository ruleset to org admins and the release-managers team. -# All jobs 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. +# Pushes to `release` trigger the run; pushing there is limited by a repository ruleset to org +# admins and the release-managers team. The jobs that sign (macOS, Windows) and the one that +# drafts the GitHub Release 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 other jobs (version, Linux, Flatpak, FreeBSD, +# web) sign nothing and get no secrets, so a manual dispatch on any other branch is a dry run of +# them: the environment refuses the signing jobs there, and the draft-release job is skipped. name: Release on: @@ -37,9 +38,7 @@ env: jobs: version: name: version - if: github.ref == 'refs/heads/release' runs-on: ubuntu-latest - environment: release outputs: version: ${{ steps.v.outputs.version }} date: ${{ steps.v.outputs.date }} @@ -117,7 +116,6 @@ jobs: - { arch: x64, target: x86_64-pc-windows-msvc } - { arch: x86, target: i686-pc-windows-msvc } # Windows on ARM: cross-compiled on the x64 runner, so signing and WiX run as above. - # .github/workflows/windows-arm64.yml installs and runs it on ARM64 hardware. - { arch: arm64, target: aarch64-pc-windows-msvc } env: CADCRAFT_VERSION: ${{ needs.version.outputs.version }} @@ -161,7 +159,7 @@ jobs: # The oldest GitHub-hosted image, so the binaries only need glibc >= 2.35 (Ubuntu 22.04+, # Debian 12+, Fedora 36+, RHEL 10). See docs/releasing.md. runs-on: ${{ matrix.runner }} - environment: release + # No `environment: release`: this job signs nothing, so it gets no release secrets. strategy: fail-fast: false matrix: @@ -179,7 +177,7 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev \ - desktop-file-utils appstream python3-yaml + desktop-file-utils appstream python3-yaml zsync curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \ "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_${{ matrix.deb }}.deb" sudo dpkg -i "$RUNNER_TEMP/nfpm.deb" @@ -201,6 +199,11 @@ jobs: for appimage in dist/release/*.AppImage; do chmod +x "$appimage" APPIMAGE_EXTRACT_AND_RUN=1 "$appimage" --version + # Update information is embedded, and the .zsync for delta updates sits beside it. + # Without APPIMAGE_EXTRACT_AND_RUN: with it, the runtime passes --appimage-* options + # on to the app (which then tries to open a window) instead of answering them. + "$appimage" --appimage-updateinformation | grep -F 'gh-releases-zsync|' + test -s "$appimage.zsync" done - uses: actions/upload-artifact@v4 with: @@ -208,11 +211,49 @@ jobs: path: dist/release/* if-no-files-found: error + flatpak: + name: Flatpak ${{ matrix.arch }} + needs: [version, linux] + # Repackages the Linux job's tarball (the same binaries as the AppImage/deb/rpm); no Rust + # build here. 24.04 for a newer flatpak-builder (1.4) than 22.04 ships. + runs-on: ${{ matrix.runner }} + # No `environment: release`: this job signs nothing, so it gets no release secrets. + strategy: + fail-fast: false + matrix: + include: + - { arch: x86_64, runner: ubuntu-24.04 } + - { arch: aarch64, runner: ubuntu-24.04-arm } + env: + CADCRAFT_VERSION: ${{ needs.version.outputs.version }} + CADCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: release-linux-${{ matrix.arch }} + path: dist/linux + - name: Install flatpak-builder + run: | + sudo apt-get update + # librsvg2-common: the SVG pixbuf loader that the host's `appstreamcli compose` (run by + # flatpak-builder) needs for any scalable icon. + sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common + # Ubuntu 24.04's AppArmor blocks the unprivileged user namespaces bubblewrap needs. + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + - name: Build the Flatpak bundle + run: packaging/linux/flatpak-bundle.sh "dist/linux/cadcraft-$CADCRAFT_VERSION-linux-${{ matrix.arch }}.tar.gz" + - uses: actions/upload-artifact@v4 + with: + name: release-flatpak-${{ matrix.arch }} + path: dist/release/*.flatpak + if-no-files-found: error + web: name: Web (wasm) needs: version runs-on: ubuntu-latest - environment: release + # No `environment: release`: this job signs nothing, so it gets no release secrets. env: CADCRAFT_VERSION: ${{ needs.version.outputs.version }} CADCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} @@ -246,7 +287,7 @@ jobs: needs: version # GitHub has no FreeBSD runners: build inside a FreeBSD VM on a Linux runner. runs-on: ubuntu-latest - environment: release + # No `environment: release`: this job signs nothing, so it gets no release secrets. timeout-minutes: 300 env: CADCRAFT_VERSION: ${{ needs.version.outputs.version }} @@ -287,7 +328,9 @@ jobs: release: name: Draft GitHub Release - needs: [version, macos, windows, linux, web, freebsd] + needs: [version, macos, windows, linux, flatpak, web, freebsd] + # Only the `release` branch publishes; a dry run on another branch stops before this job. + if: github.ref == 'refs/heads/release' runs-on: ubuntu-latest environment: release permissions: diff --git a/README.md b/README.md index 01d384928..76d8b2fb1 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Agents, MCP and the CLI · Architecture · Roadmap · + Downloads · The Crafting Apps · License and credits

@@ -171,6 +172,50 @@ checks formatting, clippy, tests, asset attribution, the crate layering and the See [ROADMAP.md](ROADMAP.md) for milestones, measured parity and the estimate of remaining work. +## Downloads + +Every [release](https://github.com/storytold/cadcraft/releases/latest) ships these builds. `` is the +version number; `SHA256SUMS.txt` lists a checksum for every file. + +### macOS + +| Build | File | Notes | +|---|---|---| +| App, universal (Apple silicon + Intel) | `cadcraft--macos-universal.dmg` | Signed and notarized | +| Command-line tool, universal | `cadcraft-cli--macos-universal.zip` | Signed and notarized | + +### Windows + +| Build | Installer | Portable | +|---|---|---| +| x64 (64-bit Intel/AMD) | `cadcraft--windows-x64.msi` | `cadcraft--windows-x64-portable.zip` | +| arm64 (Snapdragon and other ARM PCs) | `cadcraft--windows-arm64.msi` | `cadcraft--windows-arm64-portable.zip` | +| x86 (32-bit) | `cadcraft--windows-x86.msi` | `cadcraft--windows-x86-portable.zip` | + +Installers and executables are code-signed. + +### Linux + +| Format | x86_64 | aarch64 (ARM64) | Notes | +|---|---|---|---| +| AppImage | `cadcraft--linux-x86_64.AppImage` | `cadcraft--linux-aarch64.AppImage` | Runs anywhere; updates itself with [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) (`.zsync` files) | +| Flatpak | `cadcraft--linux-x86_64.flatpak` | `cadcraft--linux-aarch64.flatpak` | Sandboxed; `flatpak install --user ` | +| Debian/Ubuntu | `cadcraft--linux-x86_64.deb` | `cadcraft--linux-aarch64.deb` | | +| Fedora/RHEL/openSUSE | `cadcraft--linux-x86_64.rpm` | `cadcraft--linux-aarch64.rpm` | | +| Tarball | `cadcraft--linux-x86_64.tar.gz` | `cadcraft--linux-aarch64.tar.gz` | Unpack anywhere | + +### FreeBSD + +| Build | File | +|---|---| +| x86_64 | `cadcraft--freebsd-x86_64.tar.gz` | + +### Web (WebAssembly) + +| Build | File | Notes | +|---|---|---| +| Static site | `cadcraft-web-.zip` | Runs in a modern browser; host it on any static server | + ## The Crafting Apps CADCraft is one of the **Crafting Apps**: free, open-source creative tools from the diff --git a/docs/releasing.md b/docs/releasing.md index 0b3f066f5..1932726ca 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -3,8 +3,8 @@ The canonical recipe is craftrules' [`release/playbook.md`](https://github.com/storytold/craftrules/blob/main/release/playbook.md); this file covers only what's CADCraft-specific. - **Version:** `[workspace.package] version` in the root `Cargo.toml` is the single source. `cargo xtask version` prints it; `cargo xtask version set X.Y.Z[-pre]` changes it. The app shows it in About, `cadcraft --version` and `cadcraft-cli --version`; release builds also embed the commit (`CADCRAFT_BUILD_SHA`). -- **Cut a release:** bump the version on `main`, then push `main` to `release` (`git push origin main:release`). Every push to `release` runs `.github/workflows/release.yml` and creates or updates the draft GitHub Release `CADCraft v`. A `workflow_dispatch` run with `version: X.Y.Z-rc.N` makes a test build. -- **Artifacts:** macOS universal `.dmg` (Developer ID signed, notarized, stapled) and CLI `.zip`; Windows x64 and x86 `.msi` + portable `.zip` (Azure Trusted Signing); Linux x86_64 `.AppImage`, `.deb`, `.rpm`, `.tar.gz` (+ Flatpak manifest in `packaging/linux/flatpak/`); FreeBSD x86_64 `.tar.gz` (built in a FreeBSD VM); web `.zip` (wasm + `index.html`, see `packaging/web/README.md`); `SHA256SUMS.txt`. +- **Cut a release:** bump the version on `main`, then push `main` to `release` (`git push origin main:release`). Every push to `release` runs `.github/workflows/release.yml` and creates or updates the draft GitHub Release `CADCraft v`. A `workflow_dispatch` run with `version: X.Y.Z-rc.N` makes a test build. A dispatch on any other branch is a dry run: the unsigned jobs (version, Linux, Flatpak, FreeBSD, web) build, the `release` environment refuses the signing jobs (macOS, Windows), and no release is drafted. +- **Artifacts:** macOS universal `.dmg` (Developer ID signed, notarized, stapled) and CLI `.zip`; Windows x64, x86 and arm64 `.msi` + portable `.zip` (Azure Trusted Signing); Linux x86_64 and aarch64 `.AppImage` (+ `.AppImage.zsync` for AppImageUpdate delta updates), `.flatpak` bundle (repackages the tarball, `packaging/linux/flatpak-bundle.sh`), `.deb`, `.rpm`, `.tar.gz` (+ the from-source Flathub manifest in `packaging/linux/flatpak/`); FreeBSD x86_64 `.tar.gz` (built in a FreeBSD VM); web `.zip` (wasm + `index.html`, see `packaging/web/README.md`); `SHA256SUMS.txt`. - **Secrets:** the twelve signing secrets live in the `release` environment (deployable only from the `release` branch, which only org admins and release-managers can push). All are optional: a missing one produces unsigned artifacts with a warning. - **File types:** `.dxf` and `.dwg` (macOS document types, Windows "Open with", Linux MIME types). - **Local packaging test:** `packaging/macos/package.sh` (ad-hoc signed DMG), `packaging/linux/package.sh`, `packaging/web/package.sh`. diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh new file mode 100755 index 000000000..9baccf92c --- /dev/null +++ b/packaging/linux/flatpak-bundle.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Repackage a CADCraft Linux tarball as a single-file Flatpak bundle: +# +# $DIST/cadcraft--linux-.flatpak +# +# Usage: packaging/linux/flatpak-bundle.sh [--no-test] [TARBALL] +# +# TARBALL defaults to $DIST/cadcraft--linux-.tar.gz from package.sh. The bundle +# is built for the host architecture (x86_64 or aarch64), which must match the tarball's. +# Needs flatpak, flatpak-builder and the SVG pixbuf loader (librsvg2-common) for the host's +# `appstreamcli compose`; the freedesktop runtime and SDK named in the manifest are +# installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and +# `cadcraft-cli --version` is run inside the sandbox as a smoke test. +# Manifest: packaging/linux/flatpak/ai.storyteller.cadcraft.bundle.yml. +set -euo pipefail +# shellcheck source=../env.sh +. "$(dirname "${BASH_SOURCE[0]}")/../env.sh" +HERE="$ROOT/packaging/linux" +APP_ID=ai.storyteller.cadcraft +FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo + +TEST=1 +TARBALL="" +while [ $# -gt 0 ]; do + case "$1" in + --no-test) TEST=0; shift ;; + -h | --help) sed -n '2,14p' "$0"; exit 0 ;; + -*) echo "unknown argument: $1" >&2; exit 2 ;; + *) TARBALL="$1"; shift ;; + esac +done + +ARCH="$(uname -m)" +case "$ARCH" in + x86_64) ;; + aarch64 | arm64) ARCH=aarch64 ;; + *) echo "unsupported architecture $ARCH" >&2; exit 2 ;; +esac +BASENAME="cadcraft-$VERSION-linux-$ARCH" +TARBALL="${TARBALL:-$DIST/$BASENAME.tar.gz}" +[ -f "$TARBALL" ] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; } +for tool in flatpak flatpak-builder; do + command -v "$tool" >/dev/null || { echo "error: $tool not found (apt install flatpak flatpak-builder librsvg2-common)" >&2; exit 1; } +done + +echo "==> CADCraft $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL")" + +WORK="$CARGO_TARGET_DIR/flatpak-bundle" +rm -rf "$WORK" +mkdir -p "$WORK/stage" +tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1 +[ -x "$WORK/stage/bin/cadcraft" ] || { echo "error: $TARBALL has no bin/cadcraft" >&2; exit 1; } +cp "$HERE/flatpak/$APP_ID.bundle.yml" "$WORK/$APP_ID.yml" + +flatpak remote-add --user --if-not-exists flathub "$FLATHUB" +# --disable-rofiles-fuse: no FUSE in containers and CI runners. +flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --force-clean \ + --default-branch=stable --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$APP_ID.yml" + +OUT="$DIST/$BASENAME.flatpak" +# --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing. +flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable +echo "wrote $OUT" + +if [ "$TEST" = 1 ]; then + flatpak install --user -y --noninteractive --reinstall "$OUT" + flatpak info --user "$APP_ID" + flatpak run --command=cadcraft-cli "$APP_ID" --version + flatpak run --command=sh "$APP_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/mime/packages /app/share/icons/hicolor/256x256/apps' +fi +echo "==> done" +ls -lh "$OUT" diff --git a/packaging/linux/flatpak/ai.storyteller.cadcraft.bundle.yml b/packaging/linux/flatpak/ai.storyteller.cadcraft.bundle.yml new file mode 100644 index 000000000..b6a64d8fb --- /dev/null +++ b/packaging/linux/flatpak/ai.storyteller.cadcraft.bundle.yml @@ -0,0 +1,50 @@ +# Flatpak manifest for the single-file bundle attached to every GitHub release +# (cadcraft--linux-.flatpak). Build it with packaging/linux/flatpak-bundle.sh. +# +# It repackages the release's own Linux tarball (cadcraft--linux-.tar.gz, built +# on Ubuntu 22.04 by package.sh) instead of compiling Rust inside flatpak-builder: no network and +# no vendored crate sources during the build, a few seconds instead of many minutes, and +# byte-for-byte the same binaries as the AppImage/deb/rpm. The script unpacks the tarball into +# `stage/` next to a copy of this file. The binaries need glibc >= 2.35 and load X11, Wayland, +# xkbcommon and Vulkan at runtime; the freedesktop runtime has all of them, and the GPU driver +# comes from its org.freedesktop.Platform.GL extension. +# +# ai.storyteller.cadcraft.yml (same directory) is the from-source manifest for Flathub. Keep +# runtime, runtime-version, sdk and finish-args identical in both (packaging-lint checks this). +id: ai.storyteller.cadcraft +runtime: org.freedesktop.Platform +runtime-version: '26.08' +sdk: org.freedesktop.Sdk +command: cadcraft +finish-args: + # Display: Wayland first; X11 only when no Wayland compositor is running. + - --socket=wayland + - --socket=fallback-x11 + # X11 shared memory (MIT-SHM). Without it the X11 fallback is slow or fails. + - --share=ipc + # GPU access for the wgpu canvas (Vulkan, or GL as a fallback). + - --device=dri + # Open/Save dialogs go through the file-chooser portal (rfd) and drag-and-drop through the + # document portal, so picked files work anywhere without broad filesystem access. Documents + # and Pictures are granted so drawings passed by path (the command line, Open Recent, xrefs + # and images next to a DXF) work in the usual places. + - --filesystem=xdg-documents + - --filesystem=xdg-pictures + # Deliberately not granted: network (the optional --control server listens on 127.0.0.1 in + # the sandbox; `flatpak override --user --share=network ai.storyteller.cadcraft` exposes it to + # host agents) and home/host filesystem access. +modules: + - name: cadcraft + buildsystem: simple + build-commands: + - install -Dm755 bin/cadcraft /app/bin/cadcraft + - install -Dm755 bin/cadcraft-cli /app/bin/cadcraft-cli + - install -Dm644 share/applications/ai.storyteller.cadcraft.desktop /app/share/applications/ai.storyteller.cadcraft.desktop + # .dxf and .dwg. + - install -Dm644 share/mime/packages/ai.storyteller.cadcraft.xml /app/share/mime/packages/ai.storyteller.cadcraft.xml + # Already has the release's version and date substituted by package.sh. + - install -Dm644 share/metainfo/ai.storyteller.cadcraft.metainfo.xml /app/share/metainfo/ai.storyteller.cadcraft.metainfo.xml + - mkdir -p /app/share/icons /app/share/doc && cp -R share/icons/hicolor /app/share/icons/ && cp -R share/doc/cadcraft /app/share/doc/ + sources: + - type: dir + path: stage diff --git a/packaging/linux/flatpak/ai.storyteller.cadcraft.yml b/packaging/linux/flatpak/ai.storyteller.cadcraft.yml index 99d96c10c..e70d80009 100644 --- a/packaging/linux/flatpak/ai.storyteller.cadcraft.yml +++ b/packaging/linux/flatpak/ai.storyteller.cadcraft.yml @@ -8,22 +8,32 @@ # flatpak run ai.storyteller.cadcraft # # For Flathub, replace the `dir` source with a `git` source pinned to a release tag and commit. +# The single-file .flatpak attached to each release comes from ai.storyteller.cadcraft.bundle.yml, +# which repackages the prebuilt release binaries. Keep runtime-version and finish-args identical. id: ai.storyteller.cadcraft runtime: org.freedesktop.Platform -runtime-version: '25.08' +runtime-version: '26.08' sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable command: cadcraft finish-args: - - --share=ipc + # Display: Wayland first; X11 only when no Wayland compositor is running. - --socket=wayland - --socket=fallback-x11 + # X11 shared memory (MIT-SHM). Without it the X11 fallback is slow or fails. + - --share=ipc + # GPU access for the wgpu canvas (Vulkan, or GL as a fallback). - --device=dri - # Open/Save dialogs use the file-chooser portal (rfd), and drag-and-drop uses the document - # portal, so broad filesystem access isn't needed. Pictures is granted for opening files by - # path from the command line. + # Open/Save dialogs go through the file-chooser portal (rfd) and drag-and-drop through the + # document portal, so picked files work anywhere without broad filesystem access. Documents + # and Pictures are granted so drawings passed by path (the command line, Open Recent, xrefs + # and images next to a DXF) work in the usual places. + - --filesystem=xdg-documents - --filesystem=xdg-pictures + # Deliberately not granted: network (the optional --control server listens on 127.0.0.1 in + # the sandbox; `flatpak override --user --share=network ai.storyteller.cadcraft` exposes it to + # host agents) and home/host filesystem access. build-options: append-path: /usr/lib/sdk/rust-stable/bin modules: @@ -34,8 +44,9 @@ modules: CARGO_HOME: /run/build/cadcraft/cargo CARGO_NET_OFFLINE: 'true' build-commands: - - cargo --offline build --release --locked -p cadcraft + - cargo --offline build --release --locked -p cadcraft -p cadcraft-cli - install -Dm755 target/release/cadcraft /app/bin/cadcraft + - install -Dm755 target/release/cadcraft-cli /app/bin/cadcraft-cli - install -Dm644 packaging/linux/ai.storyteller.cadcraft.desktop /app/share/applications/ai.storyteller.cadcraft.desktop - install -Dm644 packaging/linux/ai.storyteller.cadcraft.mime.xml /app/share/mime/packages/ai.storyteller.cadcraft.xml - mkdir -p /app/share/icons && cp -R assets/app-icon/hicolor /app/share/icons/ diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index ae321430a..80225bf09 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -17,9 +17,9 @@ vendor: Learning Machines LLC homepage: https://getartcraft.com/apps/cadcraft license: MIT OR Apache-2.0 description: |- - Open-source, native image editor that works the way Photoshop users expect. - Layers, masks, adjustment layers, layer styles, type and brushes; opens and - saves layered PSD/PSB files; 8/16/32-bit documents; GPU compositing (wgpu). + Open-source computer-aided design and drafting: draft, dimension and plot 2D + drawings with a familiar command line, object snaps, layers, dimensions, hatches + and blocks. Opens and saves DXF and DWG; exports SVG and PNG. Includes cadcraft-cli, a headless converter and command runner. # The binaries link only glibc and libgcc_s directly. Windowing (X11/Wayland, xkbcommon) and the diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index 0a1d72786..008c52304 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -2,6 +2,7 @@ # Build and package CADCraft for Linux ( is x86_64 or aarch64): # # $DIST/cadcraft--linux-.AppImage any distro with glibc >= the build host's +# $DIST/cadcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) # $DIST/cadcraft--linux-.deb Debian, Ubuntu, Mint, Pop!_OS, ... # $DIST/cadcraft--linux-.rpm Fedora, openSUSE, RHEL, ... # $DIST/cadcraft--linux-.tar.gz plain FHS-style tree (bin/, share/) @@ -10,7 +11,8 @@ # # Needs: cargo; nfpm for deb/rpm (https://nfpm.goreleaser.com); appimagetool for the AppImage # (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. +# glibc 2.35) so the binaries run on newer ones. Optional: desktop-file-validate, appstreamcli, +# zsyncmake (the zsync package) for the AppImage's .zsync. set -euo pipefail # shellcheck source=../env.sh . "$(dirname "${BASH_SOURCE[0]}")/../env.sh" @@ -108,11 +110,29 @@ if has appimage; then chmod +x "$TOOL" fi fi - OUT="$DIST/$BASENAME.AppImage" + # Absolute, because appimagetool runs in $DIST below (CARGO_TARGET_DIR or APPIMAGETOOL may be + # relative). + OUT="$(cd "$DIST" && pwd)/$BASENAME.AppImage" + APPDIR="$(cd "$APPDIR" && pwd)" + TOOL="$(cd "$(dirname "$TOOL")" && pwd)/$(basename "$TOOL")" + # A .zsync left by an earlier run would hide a missing zsyncmake and describe another file. + rm -f "$OUT.zsync" + # Update information: AppImageUpdate, AppImageLauncher and the like read it from the file and + # fetch only the blocks that changed in a newer release, through the .zsync published next to + # each AppImage on GitHub Releases. `latest` is the newest published release that is not a + # pre-release. A fork's builds point at its own releases through GITHUB_REPOSITORY. + REPO="${GITHUB_REPOSITORY:-storytold/cadcraft}" + UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest|cadcraft-*-linux-$ARCH.AppImage.zsync" # Extract-and-run: works without FUSE (containers, CI). The output embeds the static runtime, - # so users don't need libfuse2 either. - ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream "$APPDIR" "$OUT" + # so users don't need libfuse2 either. With zsyncmake on the host (CI installs the zsync + # package) appimagetool also writes the .zsync, into its working directory, hence the cd. + (cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream -u "$UPDATE_INFO" "$APPDIR" "$OUT") echo "wrote $OUT" + if [ -s "$OUT.zsync" ]; then + echo "wrote $OUT.zsync" + else + warn "zsyncmake not found, so $OUT.zsync was not written; AppImage delta updates need it" + fi fi "$STAGE/usr/bin/cadcraft-cli" --version