So I recently found a terminal named BlackBox https://gitlab.gnome.org/raggesilver/blackbox and wanted to get it installed to my workstation but found it only has a flatpak and I couldn’t find a way to build it without pulling a lot of dev packages to my system. So I attempted to build it with snap, as follows
name: blackbox # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: "0.13.2-git" # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
blackbox:
command: usr/bin/blackbox
desktop: usr/share/applications/com.raggesilver.BlackBox.desktop
environment:
LD_LIBRARY_PATH: $SNAP/usr/lib64:$LD_LIBRARY_PATH
extensions:
- gnome
plugs:
- gsettings
common-id: com.raggesilver.BlackBox
parts:
vendor-marble-gtk:
plugin: dump
source: ./vendors/marble-gtk
libicu71:
source: http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu71_71.1-3ubuntu1_amd64.deb
source-type: deb
plugin: dump
libvte-2.91-gtk4-0:
source: http://mirrors.kernel.org/ubuntu/pool/main/v/vte2.91/libvte-2.91-gtk4-0_0.70.0-1_amd64.deb
source-type: deb
plugin: dump
libvte-2.91-gtk4-dev:
source: http://mirrors.kernel.org/ubuntu/pool/main/v/vte2.91/libvte-2.91-gtk4-dev_0.70.0-1_amd64.deb
source-type: deb
plugin: dump
libadwaita-1-0:
source: http://mirrors.kernel.org/ubuntu/pool/main/liba/libadwaita-1/libadwaita-1-0_1.2.0-1ubuntu2_amd64.deb
source-type: deb
plugin: dump
libadwaita-1-dev:
source: http://mirrors.kernel.org/ubuntu/pool/main/liba/libadwaita-1/libadwaita-1-dev_1.2.0-1ubuntu2_amd64.deb
source-type: deb
plugin: dump
librsvg2-2:
source: http://mirrors.kernel.org/ubuntu/pool/main/libr/librsvg/librsvg2-2_2.54.4+dfsg-1ubuntu1_amd64.deb
source-type: deb
plugin: dump
librsvg2-dev:
source: http://mirrors.kernel.org/ubuntu/pool/main/libr/librsvg/librsvg2-dev_2.54.4+dfsg-1ubuntu1_amd64.deb
source-type: deb
plugin: dump
blackbox:
after:
- vendor-marble-gtk
- libicu71
- libvte-2.91-gtk4-0
- libvte-2.91-gtk4-dev
- libadwaita-1-0
- libadwaita-1-dev
- librsvg2-2
- librsvg2-dev
source: https://gitlab.gnome.org/raggesilver/blackbox.git
plugin: meson
meson-parameters:
- --prefix=/usr
- --buildtype=release
build-environment:
- PKG_CONFIG_PATH: "$SNAPCRAFT_STAGE/usr/lib64/pkgconfig:$SNAPCRAFT_STAGE/usr/lib/x86_64-linux-gnu/pkgconfig"
- VALAFLAGS: " --vapidir $SNAPCRAFT_STAGE/usr/share/vala/vapi"
- LD_LIBRARY_PATH: "$SNAPCRAFT_STAGE/usr/lib64:$SNAPCRAFT_STAGE/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu"
- VALAC: "/usr/bin/valac"
build-packages:
- meson
- ninja-build
- valac
- gettext
- cmake
- libgtk-4-dev
#- libadwaita-1-dev
#- libvte-2.91-gtk4-dev
- libjson-glib-dev
#- librsvg2-dev
- libgee-0.8-dev
- libxml2-dev
override-stage: |
craftctl default
cp -r $CRAFT_PART_SRC/data $CRAFT_STAGE/data
override-prime: |
craftctl default
cp -r $CRAFT_STAGE/data $CRAFT_PRIME/data
sed -i 's|Icon=com.raggesilver.BlackBox|Icon=${SNAP}/data/icons/hicolor/scalable/apps/com.raggesilver.BlackBox.svg|' ${CRAFT_PRIME}/usr/share/applications/com.raggesilver.BlackBox.desktop
sed -i 's|$(/usr/libexec/vte-urlencode-cwd)|$(${SNAP}/usr/libexec/vte-urlencode-cwd)|' ${CRAFT_PRIME}/etc/profile.d/vte-2.91.sh
stage-packages:
- libgtk-4-1
- libgee-0.8-2
- libjson-glib-1.0-0
- libvte-2.91-common
parse-info: [usr/share/metainfo/com.raggesilver.BlackBox.appdata.xml]
slots:
gnome-text-editor:
interface: dbus
bus: session
name: com.raggesilver.BlackBox
It also requires a rpm package I downloaded and extracted from https://fedora.pkgs.org/37/terra/marble-gtk-0:42.alpha0-1.fc37.x86_64.rpm.html
Overall it was a frustrating journey throughout the attempt (a lot of things didn’t work properly when I use core22
), and I am still not sure if the resulting application is working as intended (it keeps saying /usr/libexec/vte-urlencode-cwd
is not found for instance, and it will not access files outside my home directory), but it is now running at least. I am sure there are a lot of things that could be done better though (for instance, I probably shouldn’t have to cheat by pulling deb for kinetic).
Some of the references I found useful:
- /docs/parts-environment-variables
- /blog/zero-to-snap-rev-up-your-packaging
- /docs/gtk4-applications
- forum/t/micro-howto-migrate-from-core20-to-core22/30188 (only realized i need to manually define meson and ninja-build in build-packages)
- /docs/parts-lifecycle (keep checking if things are done properly in every stage)