Skip to content

Instantly share code, notes, and snippets.

@lucyllewy
Last active July 17, 2019 22:03
Show Gist options
  • Save lucyllewy/e1395167be60456abd33cddde25f07f8 to your computer and use it in GitHub Desktop.
Save lucyllewy/e1395167be60456abd33cddde25f07f8 to your computer and use it in GitHub Desktop.
Example of a snapcraft.yaml created with sc-jsonnet and the accompanying jsonnet file it was created from
local snapcraft = import 'snapcraft.libsonnet';
local alsa = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-alsa/cfbd336/alsa.libsonnet';
local preload = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-preload/7d22e2f/snapcraft-preload.libsonnet';
local desktop = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-desktop-helpers/a7797f1/desktop-helpers.libsonnet';
snapcraft {
name: "gnome-twitch",
"adopt-info": "gnome-twitch",
version: "0.4.2",
summary: "Enjoy Twitch on your GNU/Linux desktop",
description: "Enjoy Twitch on your GNU/Linux desktop
Easily browse and search channels and games. Keep track of your follows whether you have a Twitch account or not. A super fast, hardware-accelerated player plus a fully integrated native chat makes for a fantastic viewing experience. GNOME Twitch is packed with cool features and development is constantly on-going, bringing heaps of new stuff straight to you.
",
grade: "stable",
confinement: "strict",
base: "core18",
architectures:[
{ "build-on": "amd64" },
{ "build-on": "i386" },
],
slots: {
"dbus-gnome-twitch": {
interface: "dbus",
bus: "session",
name: "com.vinszent.GnomeTwitch",
},
},
layout: {
"/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0": {
symlink: "$SNAP/gnome-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0",
},
},
apps: {
"gnome-twitch": {
adapter: "full",
command: "bin/samba-launch $SNAP/usr/bin/gnome-twitch",
desktop: "usr/share/applications/com.vinszent.GnomeTwitch.desktop",
"common-id": "com.vinszent.GnomeTwitch.desktop",
plugs: [
"browser-support",
"desktop",
"gsettings",
"network",
"opengl",
"pulseaudio",
"screen-inhibit-control",
"unity7",
"wayland",
"x11",
],
},
},
parts: {
"samba-launch": {
plugin: "nil",
"override-pull": "
cat > samba-launch <<EOF
#!/bin/bash
export LD_LIBRARY_PATH=\"\\$SNAP/usr/lib/\\$SNAP_LAUNCHER_ARCH_TRIPLET/samba:\\$LD_LIBRARY_PATH\"
exec \"\\$@\"
EOF
",
"override-build": "install -m755 -D -t $SNAPCRAFT_PART_INSTALL/bin samba-launch",
},
"gnome-twitch": {
plugin: "meson",
source: "https://github.com/vinszent/gnome-twitch.git",
"source-tag": "v0.4.2",
"parse-info": ["usr/share/appdata/com.vinszent.GnomeTwitch.appdata.xml"],
"override-pull": "
pip3 install meson
snapcraftctl pull
sed -i 's|^Icon=.*|Icon=/usr/share/icons/hicolor/512x512/apps/com.vinszent.GnomeTwitch.png|' data/com.vinszent.GnomeTwitch.desktop.in
",
"meson-parameters": [
"--buildtype=release",
"--prefix=/usr",
"-Dbuild-player-backends=gstreamer-cairo,gstreamer-opengl,gstreamer-clutter,mpv-opengl",
"-Ddo-post-install=false",
],
"build-packages": [
"gettext",
"gobject-introspection",
"libclutter-gst-3.0-dev",
"libclutter-gtk-1.0-dev",
"libdb5.3-dev",
"libglib2.0-dev",
"libglu1-mesa-dev",
"libjson-glib-dev",
"libmpv-dev",
"libpeas-dev",
"libpulse-dev",
"libsoup2.4-dev",
"libwebkit2gtk-4.0-dev",
"python3-pip",
"python3-setuptools",
"python3-wheel",
],
"stage-packages": [
"gstreamer1.0-clutter-3.0",
"gstreamer1.0-gtk3",
"gstreamer1.0-libav",
"gstreamer1.0-plugins-base",
"gstreamer1.0-plugins-good",
"gstreamer1.0-plugins-bad",
"libglu1-mesa",
"libgpm2",
"libjson-glib-1.0-0",
"libmpv1",
"libslang2",
"samba-libs",
],
},
},
} + desktop.apply("gnome") + preload.apply() + alsa.apply("1.1.9")
adopt-info: gnome-twitch
apps:
gnome-twitch:
adapter: full
command: bin/samba-launch $SNAP/usr/bin/gnome-twitch
command-chain:
- bin/desktop-launch
- bin/snapcraft-preload
common-id: com.vinszent.GnomeTwitch.desktop
desktop: usr/share/applications/com.vinszent.GnomeTwitch.desktop
plugs:
- browser-support
- desktop
- gsettings
- network
- opengl
- pulseaudio
- screen-inhibit-control
- unity7
- wayland
- x11
architectures:
- build-on: amd64
- build-on: i386
base: core18
confinement: strict
description: 'Enjoy Twitch on your GNU/Linux desktop
Easily browse and search channels and games. Keep track of your follows whether
you have a Twitch account or not. A super fast, hardware-accelerated player plus
a fully integrated native chat makes for a fantastic viewing experience. GNOME Twitch
is packed with cool features and development is constantly on-going, bringing heaps
of new stuff straight to you.
'
grade: stable
layout:
/etc/asound.conf:
symlink: $SNAP/etc/asound.conf
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0:
symlink: $SNAP/gnome-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0
/usr/lib/alsa-lib:
symlink: $SNAP/usr/lib/alsa-lib
name: gnome-twitch
parts:
alsa-lib-mixin:
configflags:
- --prefix=/usr
plugin: autotools
source: https://www.alsa-project.org/files/pub/lib/alsa-lib-1.1.9.tar.bz2
alsa-mixin:
after:
- alsa-lib-mixin
- alsa-plugins-mixin
build-packages: []
override-build: install -m644 -D -t $SNAPCRAFT_PART_INSTALL/etc asound.conf
override-pull: "\ncat > asound.conf <<EOF\npcm.!default {\n type pulse\n \
\ fallback \"sysdefault\"\n hint {\n show on\n description\
\ \"Default ALSA Output (currently PulseAudio Sound Server)\"\n }\n}\nctl.!default\
\ {\n type pulse\n fallback \"sysdefault\"\n}\nEOF"
plugin: nil
source: https://github.com/diddledan/snapcraft-alsa.git
stage-packages: []
alsa-plugins-mixin:
after:
- alsa-lib-mixin
build-packages:
- libpulse-dev
configflags:
- --prefix=/usr
plugin: autotools
source: https://www.alsa-project.org/files/pub/plugins/alsa-plugins-1.1.9.tar.bz2
stage-packages:
- libpulse0
desktop-gnome:
after:
- alsa-mixin
- alsa-lib-mixin
- alsa-plugins-mixin
build-packages:
- gcc
make-parameters:
- FLAVOR=gtk3
override-build: '
snapcraftctl build
mkdir -pv $SNAPCRAFT_PART_INSTALL/gnome-platform
'
plugin: make
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
stage:
- -usr/share/alsa
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libasound*
stage-packages:
- gcc
gnome-twitch:
after:
- desktop-gnome
- alsa-mixin
- alsa-lib-mixin
- alsa-plugins-mixin
build-packages:
- gettext
- gobject-introspection
- libclutter-gst-3.0-dev
- libclutter-gtk-1.0-dev
- libdb5.3-dev
- libglib2.0-dev
- libglu1-mesa-dev
- libjson-glib-dev
- libmpv-dev
- libpeas-dev
- libpulse-dev
- libsoup2.4-dev
- libwebkit2gtk-4.0-dev
- python3-pip
- python3-setuptools
- python3-wheel
meson-parameters:
- --buildtype=release
- --prefix=/usr
- -Dbuild-player-backends=gstreamer-cairo,gstreamer-opengl,gstreamer-clutter,mpv-opengl
- -Ddo-post-install=false
override-pull: '
pip3 install meson
snapcraftctl pull
sed -i ''s|^Icon=.*|Icon=/usr/share/icons/hicolor/512x512/apps/com.vinszent.GnomeTwitch.png|'' data/com.vinszent.GnomeTwitch.desktop.in
'
parse-info:
- usr/share/appdata/com.vinszent.GnomeTwitch.appdata.xml
plugin: meson
source: https://github.com/vinszent/gnome-twitch.git
source-tag: v0.4.2
stage:
- -usr/share/alsa
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libasound*
stage-packages:
- gstreamer1.0-clutter-3.0
- gstreamer1.0-gtk3
- gstreamer1.0-libav
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad
- libglu1-mesa
- libgpm2
- libjson-glib-1.0-0
- libmpv1
- libslang2
- samba-libs
samba-launch:
after:
- desktop-gnome
- alsa-mixin
- alsa-lib-mixin
- alsa-plugins-mixin
build-packages: []
override-build: install -m755 -D -t $SNAPCRAFT_PART_INSTALL/bin samba-launch
override-pull: '
cat > samba-launch <<EOF
#!/bin/bash
export LD_LIBRARY_PATH="\$SNAP/usr/lib/\$SNAP_LAUNCHER_ARCH_TRIPLET/samba:\$LD_LIBRARY_PATH"
exec "\$@"
EOF
'
plugin: nil
stage:
- -usr/share/alsa
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libasound*
stage-packages: []
snapcraft-preload:
after:
- alsa-mixin
- alsa-lib-mixin
- alsa-plugins-mixin
build-packages:
- gcc-multilib
- g++-multilib
plugin: cmake
source: https://github.com/sergiusens/snapcraft-preload.git
stage:
- -usr/share/alsa
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libasound*
stage-packages: []
plugs:
gnome-3-28-1804:
default-provider: gnome-3-28-1804:gnome-3-28-1804
interface: content
target: $SNAP/gnome-platform
gtk-3-themes:
default-provider: gtk-common-themes:gtk-3-themes
interface: content
target: $SNAP/data-dir/themes
icon-themes:
default-provider: gtk-common-themes:icon-themes
interface: content
target: $SNAP/data-dir/icons
sound-themes:
default-provider: gtk-common-themes:sounds-themes
interface: content
target: $SNAP/data-dir/sounds
slots:
dbus-gnome-twitch:
bus: session
interface: dbus
name: com.vinszent.GnomeTwitch
summary: Enjoy Twitch on your GNU/Linux desktop
version: 0.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment