1
1
# Development notes:
2
- # - To build the snap run `snapcraft clean` and `snapcraft`
2
+ # - To build the snap run `snapcraft clean` and `snapcraft --debug --verbosity verbose `
3
3
# - To install local snap `snap install ./buzz_*.snap --dangerous`
4
+ # - To check for issues `snapcraft lint buzz_*.snap`
4
5
name : buzz
5
6
base : core22
6
7
version : git
@@ -22,43 +23,6 @@ architectures:
22
23
- build-on : amd64
23
24
24
25
parts :
25
- desktop-qt5 :
26
- source : https://github.com/ubuntu/snapcraft-desktop-helpers.git
27
- source-subdir : qt
28
- plugin : make
29
- make-parameters : [ "FLAVOR=qt5" ]
30
- build-packages :
31
- - build-essential
32
- - qtbase5-dev
33
- - dpkg-dev
34
- stage-packages :
35
- - libxkbcommon0
36
- - fonts-ubuntu
37
- - dmz-cursor-theme
38
- - light-themes
39
- - adwaita-icon-theme
40
- - gnome-themes-standard
41
- - shared-mime-info
42
- - libqt5gui5
43
- - libgdk-pixbuf2.0-0
44
- - libqt5svg5 # for loading icon themes which are svg
45
- - libglib2.0-0
46
- - xdg-user-dirs
47
- override-prime : |
48
- craftctl default
49
- glib-compile-schemas usr/share/glib-2.0/schemas
50
-
51
- platform-modules :
52
- plugin : nil
53
- stage-packages :
54
- - appmenu-gtk3-module
55
- - libcanberra-gtk3-module
56
-
57
- qt5-gtk-platform :
58
- plugin : nil
59
- stage-packages :
60
- - qt5-gtk-platformtheme
61
-
62
26
alsa-pulseaudio :
63
27
plugin : dump
64
28
source : .
@@ -81,19 +45,30 @@ parts:
81
45
82
46
buzz :
83
47
plugin : python
48
+ python-packages :
49
+ - numpy==1.26.4 # version from .lock file so sox can install
50
+ - typing-extensions==4.12.2 # version from .lock file so sox can install
84
51
source : .
85
52
build-packages :
86
53
- portaudio19-dev
54
+ - build-essential
55
+ - git
56
+ - sox
87
57
stage-packages :
58
+ # Theme support and platform modules
59
+ - qt5-gtk-platformtheme
60
+ - qt6-gtk-platformtheme
61
+ - appmenu-gtk3-module
62
+ - appmenu-gtk-module-common
63
+ - libcanberra-gtk3-module
88
64
# Audio
89
65
- ffmpeg
90
66
- libportaudio2
91
67
- libpulse0
92
- - libasound2
93
68
- libasound2-plugins
94
69
- libasound2-plugins-extra
95
70
- libyaml-dev
96
- - libegl1-mesa
71
+ - libegl1
97
72
- gstreamer1.0-plugins-good
98
73
- gstreamer1.0-plugins-base-apps
99
74
- gstreamer1.0-pulseaudio
@@ -114,45 +89,62 @@ parts:
114
89
- libxcb-cursor0
115
90
# GPU
116
91
- libglu1-mesa
117
- override-build : |
92
+ override-build : |
93
+ # Run default build commands
118
94
craftctl default
119
- pip install poetry
120
- make translation_mo
121
- pip install .
95
+
96
+ # Update ctranslate to ensure it has no execstack issues
122
97
pip uninstall -y ctranslate2
123
- pip install https://github.com/raivisdejus/CTranslate2-no-execstack/releases/download/v4.2.1/ ctranslate2-4.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
98
+ pip install ctranslate2==4.6.0
124
99
125
100
# Clean caches to reclaim space on CI
126
101
apt-get autoremove -y
127
102
apt-get clean
128
103
pip cache purge
129
- echo "yes" | poetry cache clear --all .
130
104
131
- # Build
132
- python3 build.py
133
105
mkdir $CRAFT_PART_INSTALL/buzz
134
106
cp $CRAFT_PART_BUILD/buzz/whisper_cpp.py $CRAFT_PART_INSTALL/buzz/
135
107
cp $CRAFT_PART_BUILD/buzz/libwhisper.so $CRAFT_PART_INSTALL/buzz/
136
- after : [ desktop-qt5 ]
108
+
109
+ mkdir -p $SNAPCRAFT_PRIME/bin
110
+ cp $CRAFT_PART_BUILD/flatpak/run-buzz.sh $SNAPCRAFT_PRIME/bin/run-buzz.sh
111
+ chmod +x $SNAPCRAFT_PRIME/bin/run-buzz.sh
112
+
113
+ mkdir -p $SNAPCRAFT_PRIME/usr/share/applications/
114
+ cp buzz.desktop $SNAPCRAFT_PRIME/usr/share/applications/buzz.desktop
137
115
138
- desktop-file :
139
- plugin : dump
140
- source : .
141
- organize :
142
- buzz.desktop : usr/share/applications/buzz.desktop
116
+ # This part removes all the files in this snap which already exist in
117
+ # connected content and base snaps. Since these files will be available
118
+ # at runtime from the content and base snaps, they do not need to be
119
+ # included in this snap itself.
120
+ #
121
+ # More info: https://forum.snapcraft.io/t/reducing-the-size-of-desktop-snaps/17280#heading--cleanup-part
122
+ cleanup :
123
+ after : # Make this part run last; list all your other parts here
124
+ - buzz
125
+ - alsa-pulseaudio
126
+ plugin : nil
127
+ build-snaps : # List all content-snaps and base snaps you're using here
128
+ - core22
129
+ - gnome-42-2204-sdk
130
+ override-prime : |
131
+ set -eux
132
+ for snap in core22 gnome-42-2204-sdk; do # List all content-snaps and base snaps you're using here
133
+ cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \;
134
+ done
143
135
144
136
apps :
145
137
buzz :
146
- command : bin/desktop-launch python3 -m buzz
138
+ extensions : [gnome]
139
+ command : bin/run-buzz.sh
147
140
desktop : usr/share/applications/buzz.desktop
148
141
environment :
149
142
PATH : $SNAP/usr/bin:$SNAP/bin:$PATH
150
- LD_LIBRARY_PATH : $SNAP/lib/python3.10/site-packages/nvidia/cudnn/lib:$SNAP/lib/python3.10/site-packages/PyQt6:$SNAP/lib/python3.10/site-packages/PyQt6/Qt6/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP:$LD_LIBRARY_PATH
151
- PYTHONPATH : $SNAP/lib/python3.10/site-packages/PyQt6:$SNAP/lib/python3.10/site-packages/PyQt6/Qt6/lib:$SNAP/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.10/site-packages:$SNAP/usr/local/lib/python3.10/dist-packages:$SNAP/usr/lib/python3.10/dist-packages:$PYTHONPATH
152
- # Fallback to XWayland if running in a Wayland session.
153
- DISABLE_WAYLAND : 1
154
- # Use GTK3 cursor theme, icon theme and open/save file dialogs.
155
- QT_QPA_PLATFORMTHEME : gtk3
143
+ LD_LIBRARY_PATH : $SNAP/lib/python3.10/site-packages/nvidia/cudnn/lib:$SNAP/lib/python3.10/site-packages/PyQt6:$SNAP/lib/python3.10/site-packages/PyQt6/Qt6/lib:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:$SNAP:$LD_LIBRARY_PATH
144
+ PYTHONPATH : $SNAP/lib/python3.10/site-packages/PyQt6:$SNAP/lib/python3.10/site-packages/PyQt6/Qt6/lib:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:$SNAP/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.10/site-packages:$SNAP/usr/local/lib/python3.10/dist-packages:$SNAP/usr/lib/python3.10/dist-packages:$PYTHONPATH
145
+ QT_QPA_PLATFORMTHEME : ' gnome'
146
+ GTK_USE_PORTAL : ' 1'
147
+ GDK_DEBUG : ' portals'
156
148
QT_MEDIA_BACKEND : gstreamer
157
149
ALSA_CONFIG_PATH : $SNAP/etc/asound.conf
158
150
XDG_CONFIG_DIRS : $SNAP/etc/xdg:$XDG_CONFIG_DIRS
0 commit comments