Rework Flatpak and Snap

This commit is contained in:
Unrud 2020-01-04 03:18:48 +01:00
parent f93806b469
commit 7934a06207
2 changed files with 40 additions and 45 deletions

View file

@ -40,11 +40,8 @@ modules:
- install -Dm0755 -t /app/bin src/github.com/unrud/remote-touchpad/desktop/remote-touchpad-wait-on-error - install -Dm0755 -t /app/bin src/github.com/unrud/remote-touchpad/desktop/remote-touchpad-wait-on-error
- install -Dm0644 -t /app/share/metainfo src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.appdata.xml - install -Dm0644 -t /app/share/metainfo src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.appdata.xml
- install -Dm0644 -t /app/share/applications src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.desktop - install -Dm0644 -t /app/share/applications src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.desktop
- install -Dm0644 src/github.com/unrud/remote-touchpad/desktop/remote-touchpad_64.png - |
/app/share/icons/hicolor/64x64/apps/com.github.unrud.RemoteTouchpad.png for s in 64 128 256 512; do
- install -Dm0644 src/github.com/unrud/remote-touchpad/desktop/remote-touchpad_128.png install -Dm0644 src/github.com/unrud/remote-touchpad/desktop/remote-touchpad_${s}.png \
/app/share/icons/hicolor/128x128/apps/com.github.unrud.RemoteTouchpad.png /app/share/icons/hicolor/${s}x${s}/apps/com.github.unrud.RemoteTouchpad.png
- install -Dm0644 src/github.com/unrud/remote-touchpad/desktop/remote-touchpad_256.png done
/app/share/icons/hicolor/256x256/apps/com.github.unrud.RemoteTouchpad.png
- install -Dm0644 src/github.com/unrud/remote-touchpad/desktop/remote-touchpad_512.png
/app/share/icons/hicolor/512x512/apps/com.github.unrud.RemoteTouchpad.png

View file

@ -1,20 +1,27 @@
name: remote-touchpad name: remote-touchpad
adopt-info: remote-touchpad
title: Remote Touchpad
# WORKAROUND: Snapcraft doesn't normalize whitespaces in description from AppStream
description: |
Control mouse and keyboard from the webbrowser of a smartphone (or any other device with a touchscreen).
To take control open the displayed URL or scan the QR code.
Supports Flatpak's RemoteDesktop portal (experimental), Windows and X11.
# WORKAROUND: Snapcraft doesn't accept GPL-3.0-or-later # WORKAROUND: Snapcraft doesn't accept GPL-3.0-or-later
license: GPL-3.0 license: GPL-3.0
version: unset
version-script: remote-touchpad --version
icon: desktop/remote-touchpad_128.png
confinement: strict
grade: stable grade: stable
adopt-info: remote-touchpad
base: core18 base: core18
confinement: strict
apps:
remote-touchpad:
command: bin/remote-touchpad
plugs:
- network-bind
- desktop
- x11
remote-touchpad-wait-on-error:
command: usr/bin/remote-touchpad-wait-on-error
plugs:
- network-bind
- desktop
- x11
common-id: com.github.unrud.RemoteTouchpad
desktop: share/applications/com.github.unrud.RemoteTouchpad.desktop
parts: parts:
remote-touchpad: remote-touchpad:
@ -30,30 +37,21 @@ parts:
stage-packages: stage-packages:
- libxt6 - libxt6
- libxtst6 - libxtst6
parse-info: [desktop/com.github.unrud.RemoteTouchpad.appdata.xml]
override-pull: | override-pull: |
snapcraftctl pull snapcraftctl pull
# WORKAROUND: Snapcraft Go Plugin doesn't set buildtags for go-get # WORKAROUND: Snapcraft Go Plugin doesn't set buildtags for go-get
GOPATH="$(realpath "${SNAPCRAFT_PART_SRC}/../go")" GOPATH="$(realpath "${SNAPCRAFT_PART_SRC}/../go")"
env --chdir="$GOPATH/src" GOPATH="$GOPATH" go get -t -d -tags 'portal x11' ./github.com/Unrud/remote-touchpad/... env --chdir="$GOPATH/src" GOPATH="$GOPATH" go get -t -d -tags 'portal x11' ./github.com/Unrud/remote-touchpad/...
# WORKAROUND: Point icon to the correct location
sed -e 's|Icon=com.github.unrud.RemoteTouchpad|Icon=/usr/share/icons/hicolor/512x512/apps/com.github.unrud.RemoteTouchpad.png|' -i desktop/com.github.unrud.RemoteTouchpad.desktop
override-build: | override-build: |
# WORKAROUND: Snap doesn't export icons
sed -i 's,^\(Icon=\).*,\1${SNAP}/meta/gui/icon.png,' desktop/com.github.unrud.RemoteTouchpad.desktop
snapcraftctl build snapcraftctl build
install -Dm0755 -t "${SNAPCRAFT_PART_INSTALL}/bin" desktop/remote-touchpad-wait-on-error install -Dm0755 -t "${SNAPCRAFT_PART_INSTALL}/usr/bin" desktop/remote-touchpad-wait-on-error
install -Dm0644 -t "${SNAPCRAFT_PART_INSTALL}/share/applications" desktop/com.github.unrud.RemoteTouchpad.desktop install -Dm0644 -t "${SNAPCRAFT_PART_INSTALL}/usr/share/metainfo" desktop/com.github.unrud.RemoteTouchpad.appdata.xml
install -Dm0644 -t "${SNAPCRAFT_PART_INSTALL}/usr/share/applications" desktop/com.github.unrud.RemoteTouchpad.desktop
apps: for s in 64 128 256 512; do
remote-touchpad: install -Dm0644 desktop/remote-touchpad_${s}.png "${SNAPCRAFT_PART_INSTALL}/usr/share/icons/hicolor/${s}x${s}/apps/com.github.unrud.RemoteTouchpad.png"
command: bin/remote-touchpad done
plugs: # WORKAROUND: Version is not extracted from AppStream
- network-bind snapcraftctl set-version "$(${SNAPCRAFT_PART_INSTALL}/bin/remote-touchpad --version)"
- desktop parse-info: [usr/share/metainfo/com.github.unrud.RemoteTouchpad.appdata.xml]
- x11
remote-touchpad-wait-on-error:
command: bin/remote-touchpad-wait-on-error
desktop: share/applications/com.github.unrud.RemoteTouchpad.desktop
plugs:
- network-bind
- desktop
- x11