snapx-bin: add package (0.4.0-1)
This commit is contained in:
1 parent
b37fa50d17
commit
41c6862577
3 files changed
+92
No files matched your search
@@ -0,0 +1,18 @@
|
||||
pkgbase = snapx-bin
|
||||
pkgdesc = Screenshot tool that handles images, text, and video - ShareX fork, Avalonia UI (upstream binary)
|
||||
pkgver = 0.4.0
|
||||
pkgrel = 1
|
||||
url = https://github.com/SnapXL/SnapX
|
||||
arch = x86_64
|
||||
license = GPL-3.0-or-later
|
||||
depends = glibc
|
||||
depends = gcc-libs
|
||||
depends = hicolor-icon-theme
|
||||
provides = snapx-ui
|
||||
conflicts = snapx-ui
|
||||
options = !strip
|
||||
options = !debug
|
||||
source = https://github.com/Felitendo/PKGBUILDS/releases/download/snapx-bin-0.4.0/snapx-bin-0.4.0.tar.zst
|
||||
sha256sums = d2098cac542bca82e68be0a4fa98db22f2d84d35c683d18582382dc9206eb5ee
|
||||
|
||||
pkgname = snapx-bin
|
||||
@@ -0,0 +1,22 @@
|
||||
# Maintainer: Felitendo
|
||||
# This PKGBUILD is updated automatically:
|
||||
# https://github.com/Felitendo/PKGBUILDS
|
||||
|
||||
pkgname=snapx-bin
|
||||
pkgver=0.4.0
|
||||
pkgrel=1
|
||||
pkgdesc="Screenshot tool that handles images, text, and video - ShareX fork, Avalonia UI (upstream binary)"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/SnapXL/SnapX"
|
||||
license=('GPL-3.0-or-later')
|
||||
depends=('glibc' 'gcc-libs' 'hicolor-icon-theme')
|
||||
provides=('snapx-ui')
|
||||
conflicts=('snapx-ui')
|
||||
options=('!strip' '!debug')
|
||||
source=("https://github.com/Felitendo/PKGBUILDS/releases/download/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.zst")
|
||||
sha256sums=('d2098cac542bca82e68be0a4fa98db22f2d84d35c683d18582382dc9206eb5ee')
|
||||
|
||||
package() {
|
||||
cp -a "$srcdir/usr" "$pkgdir/"
|
||||
cp -a "$srcdir/opt" "$pkgdir/"
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
# snapx-bin - SnapX (https://github.com/SnapXL/SnapX), screenshot/sharing
|
||||
# tool forked from ShareX, C#/.NET Avalonia UI.
|
||||
#
|
||||
# Upstream ships a self-contained Linux bundle per (pre)release, but the
|
||||
# asset names embed build metadata (e.g. ...-0.4.0-alpha.0+g7eafb0f-X64...)
|
||||
# that cannot be derived from the version alone. build_artifact() therefore
|
||||
# resolves the asset by pattern via the GitHub API and repackages it under
|
||||
# our own predictable name. All upstream releases are marked prerelease, so
|
||||
# latest_version() reads the release list instead of /latest.
|
||||
|
||||
UPSTREAM_REPO="SnapXL/SnapX"
|
||||
|
||||
BUILD_DEPS=()
|
||||
|
||||
latest_version() {
|
||||
gh api "repos/$UPSTREAM_REPO/releases" --jq '.[0].tag_name' | sed 's/^v//'
|
||||
}
|
||||
|
||||
# build_artifact <version> <output-file>
|
||||
build_artifact() {
|
||||
local ver="$1" outfile="$2"
|
||||
local workdir destdir asset
|
||||
workdir="$(mktemp -d)"
|
||||
destdir="$(mktemp -d)"
|
||||
|
||||
asset="$(gh api "repos/$UPSTREAM_REPO/releases/tags/v$ver" --jq '.assets[].name' \
|
||||
| grep '^SnapX-UI-Release-Linux-' | grep -v musl | grep -- '-X64\.tar\.zst$')"
|
||||
[[ "$(wc -l <<< "$asset")" -eq 1 ]] || { echo "expected exactly one UI asset, got: $asset" >&2; return 1; }
|
||||
|
||||
gh release download "v$ver" -R "$UPSTREAM_REPO" --pattern "$asset" --dir "$workdir"
|
||||
mkdir -p "$destdir/opt/snapx"
|
||||
tar -xf "$workdir/$asset" -C "$destdir/opt/snapx"
|
||||
chmod 755 "$destdir/opt/snapx/snapx-ui"
|
||||
|
||||
# upstream's launcher resolves its own directory, so a symlink from
|
||||
# /usr/bin would break it - use a wrapper instead
|
||||
mkdir -p "$destdir/usr/bin"
|
||||
cat > "$destdir/usr/bin/snapx-ui" << 'EOF'
|
||||
#!/bin/sh
|
||||
exec /opt/snapx/snapx-ui "$@"
|
||||
EOF
|
||||
chmod 755 "$destdir/usr/bin/snapx-ui"
|
||||
|
||||
# desktop file, icons and metainfo from the source tree
|
||||
curl -sfL "https://github.com/$UPSTREAM_REPO/archive/refs/tags/v$ver.tar.gz" | tar -xz -C "$workdir"
|
||||
cp -a "$workdir/SnapX-$ver/packaging/usr/share" "$destdir/usr/"
|
||||
|
||||
tar --zstd --sort=name --owner=0 --group=0 --numeric-owner --mtime='@0' \
|
||||
-cf "$outfile" -C "$destdir" usr opt
|
||||
|
||||
rm -rf "$workdir" "$destdir"
|
||||
}
|
||||
Reference in new issue
Block a user