diff --git a/README.md b/README.md index 0ec6540ba..7268b3d3d 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ Installers and executables are code-signed. | Flatpak | `designcraft--linux-x86_64.flatpak` | `designcraft--linux-aarch64.flatpak` | Sandboxed; `flatpak install --user ` | | Debian/Ubuntu | `designcraft--linux-x86_64.deb` | `designcraft--linux-aarch64.deb` | | | Fedora/RHEL/openSUSE | `designcraft--linux-x86_64.rpm` | `designcraft--linux-aarch64.rpm` | | +| Arch Linux/Manjaro | `designcraft--linux-x86_64.pkg.tar.zst` | `designcraft--linux-aarch64.pkg.tar.zst` | `sudo pacman -U `; installs as `ai.storyteller.designcraft`, replacing an AUR package | | Tarball | `designcraft--linux-x86_64.tar.gz` | `designcraft--linux-aarch64.tar.gz` | Unpack anywhere | RISC-V (riscv64): `designcraft--linux-riscv64.tar.gz` only, cross-compiled; needs glibc 2.39+ (Ubuntu 24.04 or newer). diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index e2ce72b10..350db2e0f 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -1,4 +1,4 @@ -# .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages +# .deb/.rpm/Arch packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages # the file tree, substitutes its path for ${STAGE} (nfpm doesn't expand env vars in `src`) and # exports VERSION and NFPM_ARCH. # @@ -53,6 +53,24 @@ overrides: - libXrandr - mesa-vulkan-drivers - xdg-desktop-portal + # Named ai.storyteller.designcraft, not designcraft: the AUR already has designcraft, designcraft-bin and + # designcraft-git, and an AUR helper treats any installed package with an AUR name as its own and + # rebuilds it on the next update. ArtCraft Launcher also uses the bundle id to tell this package + # (which it updates with `pacman -U`) from an AUR build (which it leaves to the AUR helper). + # nfpm has no optdepends for Arch, so the recommends above have no equivalent here. + archlinux: + depends: + - glibc + - gcc-libs + - hicolor-icon-theme + - libxkbcommon + - vulkan-icd-loader + provides: + - designcraft + conflicts: + - designcraft + - designcraft-bin + - designcraft-git contents: - src: ${STAGE}/usr/bin/designcraft diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index fd7fc4ef8..d6391a9cd 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -5,11 +5,12 @@ # $DIST/designcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) # $DIST/designcraft--linux-.deb Debian, Ubuntu, Mint, Pop!_OS, ... # $DIST/designcraft--linux-.rpm Fedora, openSUSE, RHEL, ... +# $DIST/designcraft--linux-.pkg.tar.zst Arch, Manjaro, EndeavourOS, ... # $DIST/designcraft--linux-.tar.gz plain FHS-style tree (bin/, share/) # -# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"] +# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm arch tar"] # -# Needs: cargo; nfpm for deb/rpm (https://nfpm.goreleaser.com); appimagetool for the AppImage +# Needs: cargo; nfpm for deb/rpm/arch (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, # zsyncmake (the zsync package) for the AppImage's .zsync. @@ -20,12 +21,12 @@ HERE="$ROOT/packaging/linux" APP_ID=ai.storyteller.designcraft SKIP_BUILD=0 -FORMATS="appimage deb rpm tar" +FORMATS="appimage deb rpm arch tar" 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,16p' "$0"; exit 0 ;; *) echo "unknown argument: $1" >&2; exit 2 ;; esac done @@ -85,8 +86,8 @@ if has tar; then echo "wrote $DIST/$BASENAME.tar.gz" fi -# ---- .deb / .rpm -------------------------------------------------------------------------------- -if has deb || has rpm; then +# ---- .deb / .rpm / .pkg.tar.zst ----------------------------------------------------------------- +if has deb || has rpm || has arch; then command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; } export VERSION export NFPM_ARCH="$DEB_ARCH" @@ -95,6 +96,14 @@ if has deb || has rpm; then for fmt in deb rpm; do if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi done + # The Arch package is named by the bundle id (see `archlinux` in nfpm.yaml), which nfpm can't + # override per format, and `archlinux.packager` isn't env-expanded, so both are written here. + if has arch; then + sed "s|^name: designcraft\$|name: $APP_ID|" "$WORK/nfpm.yaml" >"$WORK/nfpm-arch.yaml" + grep -qx "name: $APP_ID" "$WORK/nfpm-arch.yaml" || { echo "error: couldn't rename the Arch package" >&2; exit 1; } + printf 'archlinux:\n packager: "%s"\n' "$DESIGNCRAFT_MAINTAINER" >>"$WORK/nfpm-arch.yaml" + (cd "$ROOT" && nfpm package -f "$WORK/nfpm-arch.yaml" -p archlinux -t "$DIST/$BASENAME.pkg.tar.zst") + fi fi # ---- AppImage -----------------------------------------------------------------------------------