DISTS: Add snapcraft build recipes

Initial import from https://github.com/snapcrafters/scummvm.

Importing the snapcrafters repository here is the first step in order
to officially take over maintenance of the snap package hosted at
snapcraft.io/scummvm.

For now, please submit PRs to the _snapcrafters_ repository.
This commit is contained in:
Lothar Serra Mari 2020-06-21 12:14:05 +02:00
parent 5520fc436e
commit 1ebbaceeec
12 changed files with 434 additions and 0 deletions

78
dists/snap/README.md Normal file
View File

@ -0,0 +1,78 @@
<h1 align="center">
<img src="https://raw.githubusercontent.com/scummvm/scummvm/master/icons/scummvm.ico" alt="ScummVM">
<br />
ScummVM
</h1>
<p align="center"><b>This is the snap for ScummVM</b>, <i>"ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files."</i>. It works on Ubuntu, Fedora, Debian, and other major Linux
distributions.</p>
<!-- Uncomment and modify this when you are provided a build status badge
<p align="center">
<a href="https://build.snapcraft.io/user/snapcrafters/fork-and-rename-me"><img src="https://build.snapcraft.io/badge/snapcrafters/fork-and-rename-me.svg" alt="Snap Status"></a>
</p>
-->
## Install
sudo snap install scummvm
([Don't have snapd installed?](https://snapcraft.io/docs/core/install))
<!-- Uncomment and modify this when you have a screenshot
![my-snap-name](screenshot.png?raw=true "my-snap-name")
-->
<p align="center">Published for <img src="http://anything.codes/slack-emoji-for-techies/emoji/tux.png" align="top" width="24" /> with :gift_heart: by Snapcrafters</p>
## Remaining tasks
Snapcrafters ([join us](https://forum.snapcraft.io/t/join-snapcrafters/1325))
are working to land snap install documentation and
the [snapcraft.yaml](https://github.com/snapcrafters/fork-and-rename-me/blob/master/snap/snapcraft.yaml)
upstream so ScummVM can authoritatively publish future releases.
- [x] Fork the [Snapcrafters template](https://github.com/snapcrafters/fork-and-rename-me) repository to your own GitHub account.
- If you have already forked the Snapcrafter template to your account and want to create another snap, you'll need to use GitHub's [Import repository](https://github.com/new/import) feature because you can only fork a repository once.
- [x] Rename the forked Snapcrafters template repository
- [x] Update logos and references to `[Project]` and `[my-snap-name]`
- [ ] Create a snap that runs in `devmode`
- [x] Register the snap in the store, **using the preferred upstream name**
- [ ] Add a screenshot to this `README.md`
- [ ] Publish the `devmode` snap in the Snap store edge channel
- [x] Add install instructions to this `README.md`
- [ ] Update snap store metadata, icons and screenshots
- [x] Convert the snap to `strict` confinement, or `classic` confinement if it qualifies
- [ ] Publish the confined snap in the Snap store beta channel
- [x] Update the install instructions in this `README.md`
- [ ] Post a call for testing on the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
- [ ] Ask a [Snapcrafters admin](https://github.com/orgs/snapcrafters/people?query=%20role%3Aowner) to fork your repo into github.com/snapcrafters, transfer the snap name from you to snapcrafters, and configure the repo for automatic publishing into edge on commit
- [ ] Add the provided Snapcraft build badge to this `README.md`
- [x] Publish the snap in the Snap store stable channel
- [x] Update the install instructions in this `README.md`
- [ ] Post an announcement in the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
- [ ] Submit a pull request or patch upstream that adds snap install documentation - [link]()
- [ ] Submit a pull request or patch upstream that adds the `snapcraft.yaml` and any required assets/launchers - [link]()
- [ ] Add upstream contact information to the `README.md`
- If upstream accept the PR:
- [ ] Request upstream create a Snap store account
- [ ] Contact the Snap Advocacy team to request the snap be transferred to upstream
- [ ] Ask the Snap Advocacy team to celebrate the snap - [link]()
If you have any questions, [post in the Snapcraft forum](https://forum.snapcraft.io).
<!--
## The Snapcrafters
| [![Your Name](http://gravatar.com/avatar/bc0bced65e963eb5c3a16cab8b004431/?s=128)](https://github.com/yourname/) |
| :---: |
| [Your Name](https://github.com/yourname/) |
-->
<!-- Uncomment and modify this when you have upstream contacts
## Upstream
| [![Upstream Name](http://gravatar.com/avatar/bc0bced65e963eb5c3a16cab8b004431?s=128)](https://github.com/upstreamname) |
| :---: |
| [Upstream Name](https://github.com/upstreamname) |
-->

View File

@ -0,0 +1,22 @@
#!/bin/sh
if [ "$(id -u)" = "0" ] && [ "$(snapctl get daemon)" = "false" ]
then
# If not configured to run as a daemon we have to stop here
# (There's no "snapctl disable ...")
snapctl stop $SNAP_NAME.daemon
exit 0
fi
mkdir -p "$XDG_RUNTIME_DIR" -m 700
if [ -z "${WAYLAND_DISPLAY}" ]
then WAYLAND_DISPLAY=wayland-0
fi
real_wayland=$(dirname "$XDG_RUNTIME_DIR")/${WAYLAND_DISPLAY}
while [ ! -O "${real_wayland}" ]; do echo waiting for Wayland socket; sleep 4; done
ln -sf "${real_wayland}" "$XDG_RUNTIME_DIR"
exec "$@"

View File

@ -0,0 +1,32 @@
#!/bin/sh
set -x
if [ -z "${XDG_CONFIG_HOME}" ]
then
if [ -z "${HOME}" ]
then XDG_CONFIG_HOME=$SNAP_USER_DATA/.config
else XDG_CONFIG_HOME=${HOME}/.config
fi
fi
# Hook up speech-dispatcher
mkdir -p $XDG_RUNTIME_DIR/speech-dispatcher
$SNAP/usr/bin/speech-dispatcher -d -C "$SNAP/etc/speech-dispatcher" -S "$XDG_RUNTIME_DIR/speech-dispatcher/speechd.sock" -m "$SNAP/usr/lib/speech-dispatcher-modules" -t 30
# We need to do this for the user that launches scummvm, so
# it can't be done on installation
while [ ! -f "${XDG_CONFIG_HOME}/scummvm/.added-games-bundle" ]
do
mkdir -p ${XDG_CONFIG_HOME}/scummvm/
touch ${XDG_CONFIG_HOME}/scummvm/.added-games-bundle
if ! grep -E "comi|drascula|dreamweb|lure|myst|queen|sky|sword" ${XDG_CONFIG_HOME}/scummvm/scummvm.ini
then
# Register the bundled games. We use a "while" loop as we can't easily
# tell when scummvm is finished.
$SNAP/bin/scummvm -p /usr/share/scummvm/ --recursive --add
sleep 1
fi
done
exec $SNAP/bin/scummvm "$@"

View File

@ -0,0 +1,5 @@
#!/bin/sh
if [ -O "$XDG_RUNTIME_DIR/${WAYLAND_DISPLAY:-wayland-0}" ] && [ -e $SNAP_COMMON/wayland.connected ]; then export SDL_VIDEODRIVER=wayland; fi
exec "$@"

View File

@ -0,0 +1,15 @@
[Desktop Entry]
Name=ScummVM
Comment=Interpreter for numerous adventure games and RPGs
Comment[pl]=Interpreter graficznych gier przygodowych
Comment[sv]=Tolk för flera äventyrsspel
Comment[he]=פרשן למספר משחקי הרפתקאות
Comment[de]=Interpreter für zahlreiche Abenteuerspiele und RPGs
Comment[es]=Intérprete para varias aventuras gráficas
Comment[ca]=Intèrpret per diverses aventures gràfiques
Exec=scummvm
Icon=${SNAP}/meta/gui/scummvm.png
Terminal=false
Type=Application
Categories=Game;AdventureGame;
StartupNotify=false

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

2
dists/snap/snap/hooks/configure vendored Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
snapctl restart $SNAP_NAME

View File

@ -0,0 +1,3 @@
#!/bin/sh
touch $SNAP_COMMON/wayland.connected

View File

@ -0,0 +1,3 @@
#!/bin/sh
rm -f $SNAP_COMMON/wayland.connected

12
dists/snap/snap/hooks/install Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -x
if [ "$(snapctl get daemon)" = "" ]
then
# We run as a daemon on core, otherwise configure the daemon to stop
# (There's no "snapctl disable ...")
if grep -q snap_core= /proc/cmdline
then snapctl set daemon=true
else snapctl set daemon=false
fi
fi

View File

@ -0,0 +1,12 @@
#!/bin/sh
set -x
if [ "$(snapctl get daemon)" = "" ]
then
# We run as a daemon on core, otherwise configure the daemon to stop
# (There's no "snapctl disable ...")
if grep -q snap_core= /proc/cmdline
then snapctl set daemon=true
else snapctl set daemon=false
fi
fi

View File

@ -0,0 +1,250 @@
name: scummvm
base: core18
license: GPL-2.0
adopt-info: scummvm
summary: ScummVM
description: |
ScummVM is a program which allows you to run certain classic graphical
point-and-click adventure games, provided you already have their data
files. The clever part about this: ScummVM just replaces the executables
shipped with the game, allowing you to play them on systems for which
they were never designed!
Currently, ScummVM supports a huge library of adventures with over
250 games in total.
It supports many classics published by legendary studios like LucasArts,
Sierra On-Line, Revolution Software, Cyan, Inc. and Westwood Studios.
Next to ground-breaking titles like the Monkey Island series,
Broken Sword, Myst, Blade Runner and countless other games,
you will find some really obscure adventures and truly hidden gems to explore.
confinement: strict
grade: stable
# **Workaround** The following are duplicated for "daemon" (putting them at the top level doesn't work in *this* snap)
plugs:
wayland:
opengl:
alsa:
audio-playback:
network:
network-bind:
removable-media:
apps:
scummvm:
command-chain: ["snap/command-chain/alsa-launch"]
extensions: [gnome-3-28]
command: desktop-launch $SNAP/bin/wayland-if-possible.sh $SNAP/bin/scummvm-launch.sh
plugs:
- wayland
- x11
- opengl
- unity7
- pulseaudio
- alsa
- audio-playback
- network
- network-bind
- removable-media
- home
- gsettings
- mount-observe
environment:
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/libunity/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/pulseaudio/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/speech-dispatcher/"
ESPEAK_DATA_PATH: "$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/espeak-ng-data"
DBUS_FATAL_WARNINGS: 0
daemon:
command: daemon-start.sh $SNAP/bin/scummvm-launch.sh -f
daemon: simple
restart-condition: always
plugs:
- pulseaudio
# **Workaround** The following are duplicated for "daemon" (putting them at the top level doesn't work in *this* snap)
- wayland
- opengl
- alsa
- audio-playback
- network
- network-bind
- removable-media
environment:
SDL_VIDEODRIVER: wayland
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/libunity/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/pulseaudio/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/speech-dispatcher/"
ESPEAK_DATA_PATH: "$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/espeak-ng-data"
PULSE_SYSTEM: 1
PULSE_RUNTIME_PATH: /var/run/pulse
layout:
/usr/share/glvnd/egl_vendor.d:
bind: $SNAP/usr/share/glvnd/egl_vendor.d
/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri:
bind: $SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri
/usr/share/X11/xkb:
bind: $SNAP/usr/share/X11/xkb
/usr/share/scummvm:
bind: $SNAP/usr/share/scummvm
/usr/share/applications:
bind: $SNAP/usr/share/applications
/usr/share/alsa:
bind: $SNAP/usr/share/alsa
parts:
scummvm:
after: [alsa-mixin]
source: https://github.com/scummvm/scummvm.git
override-build: |
last_committed_tag="$(git tag --list | tac | head -n1)"
trimmed_tag="$(echo $last_committed_tag | sed 's/desc\///' | sed 's/git//' | sed 's/^v//')"
last_released_tag="$(snap info scummvm | awk '$1 == "latest/beta:" { print $2 }')"
# If the latest tag from the upstream project has not been released to
# beta, build that tag instead of master.
if [ "${trimmed_tag}" != "${last_released_tag}" ]; then
git fetch
git checkout "${last_committed_tag}"
snapcraftctl set-version $(git -C ../src tag --list | tac | head -n1 | sed 's/desc\///' | sed 's/git//' | sed 's/^v//')
else
snapcraftctl set-version $(git -C ../src describe | sed 's/desc\///')
fi
snapcraftctl build
plugin: autotools
configflags:
- --enable-release
- --enable-tts
- --enable-opl2lpt
- --enable-c++11
- --disable-debug
build-packages:
- libsdl2-dev
- libgtk-3-dev
- libjpeg62-dev
- libmpeg2-4-dev
- liba52-dev
- libogg-dev
- libvorbis-dev
- libflac-dev
- libmad0-dev
- libpng-dev
- libtheora-dev
- libfaad-dev
- libfluidsynth-dev
- libfreetype6-dev
- libfribidi-dev
- zlib1g-dev
- libunity-dev
- libcurl4-openssl-dev
- libsdl2-net-dev
- libieee1284-3-dev
- libspeechd-dev
stage-packages:
- libicu60
- libfaad2
- libflac8
- libfluidsynth1
- libfribidi0
- libgl1-mesa-dri
- libgl1-mesa-glx
- libglu1-mesa
- libwayland-egl1-mesa
- libjpeg62
- libjpeg8
- libmad0
- libmpeg2-4
- libogg0
- libpng16-16
- libpulse0
- libsdl2-2.0-0
- libsndio6.1
- libtheora0
- libvorbis0a
- libvorbisfile3
- zlib1g
- libdbusmenu-glib4
- libdee-1.0-4
- libslang2
- libunity-protocol-private0
- libunity9
- freeglut3
- libcurl4
- libsdl2-net-2.0-0
- liba52-0.7.4
- libieee1284-3
- locales-all
- ttf-ubuntu-font-family
- espeak-ng
- espeak-ng-data
- libspeechd2
- speech-dispatcher
- speech-dispatcher-audio-plugins
- speech-dispatcher-espeak-ng
alsa-mixin:
plugin: nil
source: https://github.com/diddlesnaps/snapcraft-alsa.git
override-pull: |
cat > asound.conf <<EOF
pcm.!default {
type pulse
fallback "sysdefault"
hint {
show on
description "Default ALSA Output (currently PulseAudio Sound Server)"
}
}
ctl.!default {
type pulse
fallback "sysdefault"
}
seq.default {
type hw
}
seq.hw {
type hw
}
EOF
cat > alsa-launch <<EOF
#!/bin/bash
export ALSA_CONFIG_PATH="\$SNAP/etc/asound.conf"
if [ -d "\$SNAP/usr/lib/alsa-lib" ]; then
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/alsa-lib"
elif [ -d "\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib" ]; then
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib"
fi
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio"
# Make PulseAudio socket available inside the snap-specific \$XDG_RUNTIME_DIR
if [ -n "\$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
pulseaudio_sockpath="\$XDG_RUNTIME_DIR/../\$pulsenative"
if [ -S "\$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:\${pulseaudio_sockpath}"
fi
fi
exec "\$@"
EOF
chmod +x alsa-launch
override-build: |
snapcraftctl build
install -m644 -D -t $SNAPCRAFT_PART_INSTALL/etc asound.conf
install -m755 -D -t $SNAPCRAFT_PART_INSTALL/snap/command-chain alsa-launch
build-packages:
- libasound2-dev
stage-packages:
- libasound2
- libasound2-plugins
scripts:
plugin: dump
source: scripts
games:
plugin: dump
source: https://www.scummvm.org/frs/extras/storefront/games-bundle.zip
source-checksum: sha256/5c16f3db7fda3660d1bddb52e76aa27ada8eb8268872f5e045490f3eabb603e1
organize:
games-bundle: usr/share/scummvm/