Linux packaging: Debian package, AppImage script, release workflow
- CPack DEB configuration (cmake/Packaging.cmake): dependencies from dpkg-shlibdeps, udisks2 recommended, strip. - AppStream metadata, installed with the desktop file and the icons; tools/release.sh adds each release to it. - tools/appimage.sh: AppImage of the GTK interface and openpu-cli with linuxdeploy and its GTK plugin (x86_64 and aarch64). - Release workflow: .deb, AppImage and openpu-cli tarball for x86_64 and arm64, attached to the release of a vX.Y.Z tag, or kept as artifacts on a manual run. tools/release.sh edits the release when the workflow created it first. - The GTK interface finds its translations next to the executable (../share/locale), for relocatable installs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
1 parent
bbc3bb3896
commit
ce7316af29
11 files changed
+261
-8
No files matched your search
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Builds OpenPU-<version>-<arch>.AppImage (GTK interface + openpu-cli) with linuxdeploy and its GTK
|
||||
# plugin, in the current directory. Runs on x86_64 and aarch64; no FUSE needed.
|
||||
#
|
||||
# usage: tools/appimage.sh [build-dir]
|
||||
# The linuxdeploy tools are downloaded once into $OPENPU_APPIMAGE_TOOLS (default ~/.cache/openpu-appimage).
|
||||
set -eu
|
||||
|
||||
SRC=$(cd "$(dirname "$0")/.." && pwd)
|
||||
BUILD=${1:-$SRC/../build-openpu/appimage}
|
||||
OUT=$(pwd)
|
||||
ARCH=$(uname -m)
|
||||
TOOLS=${OPENPU_APPIMAGE_TOOLS:-$HOME/.cache/openpu-appimage}
|
||||
LINUXDEPLOY=$TOOLS/linuxdeploy-$ARCH.AppImage
|
||||
GTK_PLUGIN=$TOOLS/linuxdeploy-plugin-gtk.sh
|
||||
|
||||
mkdir -p "$TOOLS"
|
||||
fetch() { # url file
|
||||
[ -s "$2" ] || { curl -fsSL -o "$2.part" "$1" && mv "$2.part" "$2"; }
|
||||
chmod +x "$2"
|
||||
}
|
||||
fetch "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$ARCH.AppImage" "$LINUXDEPLOY"
|
||||
fetch "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" "$GTK_PLUGIN"
|
||||
|
||||
cmake -S "$SRC" -B "$BUILD" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOPENPU_UI_GTK=ON -DOPENPU_BUILD_TESTS=OFF
|
||||
cmake --build "$BUILD"
|
||||
APPDIR=$BUILD/AppDir
|
||||
rm -rf "$APPDIR"
|
||||
DESTDIR=$APPDIR cmake --install "$BUILD" --strip
|
||||
|
||||
VERSION=$("$APPDIR/usr/bin/openpu-cli" --version | awk '{print $2}')
|
||||
ID=io.github.openpu.OpenPU
|
||||
cd "$OUT"
|
||||
# linuxdeploy finds its plugins next to itself or in PATH.
|
||||
PATH=$TOOLS:$PATH APPIMAGE_EXTRACT_AND_RUN=1 DEPLOY_GTK_VERSION=4 LINUXDEPLOY_OUTPUT_VERSION=$VERSION \
|
||||
"$LINUXDEPLOY" --appdir "$APPDIR" --plugin gtk --output appimage \
|
||||
--executable "$APPDIR/usr/bin/openpu" --executable "$APPDIR/usr/bin/openpu-cli" \
|
||||
--desktop-file "$APPDIR/usr/share/applications/$ID.desktop" \
|
||||
--icon-file "$APPDIR/usr/share/icons/hicolor/256x256/apps/$ID.png"
|
||||
ls -l "$OUT"/OpenPU-*.AppImage
|
||||
+11
-2
@@ -25,7 +25,11 @@ grep -q "^project(openpu VERSION $VERSION " CMakeLists.txt || { echo "cannot upd
|
||||
sed -i "s/^## \[Unreleased\]$/## [Unreleased]\n\n## [$VERSION] - $TODAY/" CHANGELOG.md
|
||||
sed -i "s|^\[Unreleased\]: \(.*\)/compare/v[0-9.]*\.\.\.HEAD$|[Unreleased]: \1/compare/v$VERSION...HEAD\n[$VERSION]: \1/releases/tag/v$VERSION|" CHANGELOG.md
|
||||
|
||||
git add CMakeLists.txt CHANGELOG.md
|
||||
# AppStream metadata lists the releases, newest first.
|
||||
sed -i "s|^ <releases>$| <releases>\n <release version=\"$VERSION\" date=\"$TODAY\"/>|" data/io.github.openpu.OpenPU.metainfo.xml
|
||||
grep -q "<release version=\"$VERSION\"" data/io.github.openpu.OpenPU.metainfo.xml || { echo "cannot update the metainfo" >&2; exit 1; }
|
||||
|
||||
git add CMakeLists.txt CHANGELOG.md data/io.github.openpu.OpenPU.metainfo.xml
|
||||
# RELEASE_TRAILER: optional trailer lines appended to the release commit message (e.g. co-authors).
|
||||
git commit -q -m "release: v$VERSION" ${RELEASE_TRAILER:+-m "$RELEASE_TRAILER"}
|
||||
# Plain string comparison (not a regex: "[" and "." in the heading would be special).
|
||||
@@ -43,7 +47,12 @@ done
|
||||
GH=$(command -v gh || command -v gh.exe || true)
|
||||
[ -z "$GH" ] && [ -x "/c/Program Files/GitHub CLI/gh.exe" ] && GH="/c/Program Files/GitHub CLI/gh.exe"
|
||||
if [ -n "$GH" ]; then
|
||||
printf '%s\n' "$NOTES" | "$GH" release create "v$VERSION" --verify-tag --title "OpenPU $VERSION" --notes-file -
|
||||
# The release workflow may have created the release already (to attach the binaries).
|
||||
if "$GH" release view "v$VERSION" >/dev/null 2>&1; then
|
||||
printf '%s\n' "$NOTES" | "$GH" release edit "v$VERSION" --title "OpenPU $VERSION" --notes-file -
|
||||
else
|
||||
printf '%s\n' "$NOTES" | "$GH" release create "v$VERSION" --verify-tag --title "OpenPU $VERSION" --notes-file -
|
||||
fi
|
||||
else
|
||||
echo "gh not found: create the GitHub release for v$VERSION by hand" >&2
|
||||
fi
|
||||
Reference in new issue
Block a user