Skip to content

Commit cf0f89b

Browse files
authored
add GUI to snap builds (#1445)
1 parent 1557ba9 commit cf0f89b

File tree

3 files changed

+118
-9
lines changed

3 files changed

+118
-9
lines changed

.github/workflows/ubuntu.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ jobs:
112112
steps:
113113
- name: Checkout repository
114114
uses: actions/checkout@v4
115+
with:
116+
fetch-depth: 0
117+
fetch-tags: true
115118

116119
- name: Build
117120
uses: snapcore/action-build@v1

snap/local/gpsbabelfe.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# avoid warning message:
4+
# Qt: Session management error: Could not open network socket
5+
# This occurs with an xrdp session, e.g. Xorg.
6+
7+
export -n SESSION_MANAGER
8+
9+
# Avoid issues with WSL2 https://github.com/microsoft/WSL/issues/11261, https://github.com/microsoft/WSL/issues/12616
10+
# This can be fixed more generally with viruscamp's wslg-runtime-dir.service.
11+
# Supposedly fixed in WSL prerelease 2.5.1, release 2.5.7 has been tested.
12+
if [ -n "$XDG_RUNTIME_DIR" ]; then
13+
if [ -S "$XDG_RUNTIME_DIR/../${WAYLAND_DISPLAY:-wayland-0}" ]; then
14+
if [ ! -e "$XDG_RUNTIME_DIR/${WAYLAND_DISPLAY:-wayland-0}" ]; then
15+
ln -s "$XDG_RUNTIME_DIR/../${WAYLAND_DISPLAY:-wayland-0}" "$XDG_RUNTIME_DIR/${WAYLAND_DISPLAY:-wayland-0}"
16+
fi
17+
fi
18+
fi
19+
20+
exec "$@"

snap/snapcraft.yaml

100755100644
Lines changed: 95 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: gpsbabel # you probably want to 'snapcraft register <name>'
22
base: core24 # the base snap is the execution environment for this snap
3-
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
4-
summary: "Convert, manipulate and transfer GPS data"
3+
summary: "Convert, manipulate and transfer GPS data."
54
description: |
65
Convert, manipulate and transfer data from GPS programs or GPS
76
recievers. Open source and supported on macOS, Windows and Linux.
@@ -16,21 +15,58 @@ confinement: strict # use 'strict' once you have the right plugs and slots
1615

1716
apps:
1817
gpsbabel:
18+
extensions: [gnome]
1919
plugs:
2020
- home
2121
- raw-usb
2222
- removable-media
2323
- serial-port
2424
command: usr/bin/gpsbabel
25+
gpsbabelfe:
26+
# avoid issues with fonts replaced by empty squares
27+
# avoid issue: pxbackend-WARNING **: 08:18:06.724: GNOME desktop detected but no schemes installed, aborting.
28+
extensions: [gnome]
29+
plugs:
30+
- desktop
31+
- desktop-legacy
32+
- network-status
33+
- home
34+
- removable-media
35+
- network
36+
- opengl
37+
- unity7
38+
- wayland
39+
- x11
40+
command-chain:
41+
- usr/bin/gpsbabelfe.sh
42+
command: usr/bin/gpsbabelfe
43+
environment:
44+
# QT_DEBUG_PLUGINS: 1
45+
# bug https://forum.snapcraft.io/t/libpxbackend-1-0-so-cannot-open-shared-object-file-no-such-file-or-directory/44263
46+
# error while loading shared libraries: libpxbackend-1.0.so: cannot open shared object file: No such file or directory
47+
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libproxy
48+
49+
plugs:
50+
# avoid FATAL:credentials.cc(122)] Check failed: . : Permission denied (13) with map preview
51+
# requires manual connection
52+
browser-sandbox: # gpsbabelfe
53+
interface: browser-support
54+
allow-sandbox: true
2555

2656
# remap the ubuntu qt6 install directories to the snap.
2757
layout:
2858
/usr/share/qt6:
2959
symlink: $SNAP/usr/share/qt6
3060
/usr/lib/qt6:
3161
symlink: $SNAP/usr/lib/qt6
32-
/usr/lib/x86_64-linux-gnu/qt6:
33-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/qt6
62+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6:
63+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6
64+
# XKB_CONFIG_ROOT, QT_XKB_CONFIG_ROOT not enough to prevent "xkbcommon: ERROR: Couldn't find file "rules/evdev" in include paths"
65+
# to overcome this symlink /usr/share/X11/xkb
66+
# see https://bugreports.qt.io/browse/QTBUG-105124
67+
# supposedly fixed in Qt 6.5.
68+
/usr/share/X11/xkb:
69+
symlink: $SNAP/gnome-platform/usr/share/X11/xkb
3470

3571
adopt-info: gpsbabel
3672
parts:
@@ -46,15 +82,13 @@ parts:
4682
override-pull: |
4783
craftctl default
4884
# add install command to CMakeLists.txt
49-
echo "install(TARGETS gpsbabel CONFIGURATIONS Release RUNTIME DESTINATION /usr/bin)" >> CMakeLists.txt
50-
# no gui
51-
sed -i -e's/add_subdirectory(gui)/#add_subdirectory(gui)/' CMakeLists.txt
85+
echo "install(TARGETS gpsbabel gpsbabelfe CONFIGURATIONS Release RUNTIME DESTINATION /usr/bin)" >> CMakeLists.txt
86+
echo "install(PROGRAMS snap/local/gpsbabelfe.sh DESTINATION /usr/bin)" >> CMakeLists.txt
5287
# jam repo sha into GITHUB_SHA
5388
sed -i -e"/GB.SHA/i set(ENV{GITHUB_SHA} \"$(git log -1 --format=%h)\")" gbversion.cmake
5489
# set snap version
5590
# ensure version has at most 32 characters
56-
craftctl set version=$(git log -1 --format='LinuxInstaller-%ad-%h' --date=format:%Y%m%d)
57-
91+
craftctl set version="$(git describe | sed -e 's/gpsbabel_//' -e 's/_/./g')"
5892
build-packages:
5993
- git
6094
- vim
@@ -67,9 +101,61 @@ parts:
67101
- libudev-dev
68102
- qt6-base-dev
69103
- qt6-5compat-dev
104+
- qt6-serialport-dev
105+
- libx11-xcb-dev
106+
- libxkbcommon-dev
107+
- qt6-tools-dev
108+
- qt6-translations-l10n
109+
- qt6-webengine-dev
110+
- qt6-wayland
111+
70112
stage-packages:
71113
- zlib1g
72114
- libshp4
73115
- libusb-1.0-0
74116
- libqt6core6
75117
- libqt6core5compat6
118+
- libqt6gui6
119+
- libqt6network6
120+
- libqt6serialport6
121+
- libqt6widgets6
122+
- libqt6xml6
123+
- libqt6webenginewidgets6
124+
- libqt6webenginecore6
125+
- libqt6webenginecore6-bin
126+
- qt6-translations-l10n
127+
- qt6-qpa-plugins
128+
- qt6-wayland
129+
130+
gpu-2404:
131+
after: [gpsbabel]
132+
source: https://github.com/canonical/gpu-snap.git
133+
plugin: dump
134+
override-prime: |
135+
craftctl default
136+
${CRAFT_PART_SRC}/bin/gpu-2404-cleanup mesa-2404
137+
prime:
138+
- bin/gpu-2404-wrapper
139+
140+
cleanup:
141+
after:
142+
- gpsbabel
143+
- gpu-2404
144+
plugin: nil
145+
build-snaps: # List all content-snaps and base snaps you're using here
146+
- core24
147+
- gnome-46-2404
148+
- mesa-2404
149+
override-prime: |
150+
set -eux
151+
for snap in "core24" "gnome-46-2404" "mesa-2404"; do # List all content-snaps and base snaps you're using here
152+
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \;
153+
done
154+
155+
lint:
156+
ignore:
157+
- library:
158+
# these are all required by libQt6WebEngineCore.so.6.4.2
159+
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libharfbuzz-subset.so.0.*
160+
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libharfbuzz.so.0.*
161+
- usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpsl.so.5.*

0 commit comments

Comments
 (0)