Skip to content

Commit 8ec3a61

Browse files
committed
snap: Build with gtk4-layer-shell and dependencies
1 parent 1c3693c commit 8ec3a61

File tree

2 files changed

+244
-11
lines changed

2 files changed

+244
-11
lines changed

snap/snapcraft.yaml

+242-11
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,241 @@ parts:
6464
prime:
6565
- -*
6666

67+
buildenv:
68+
plugin: nil
69+
build-environment: &buildenv
70+
- ACLOCAL_PATH: $CRAFT_STAGE/usr/share/aclocal
71+
- XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/share
72+
- LD_LIBRARY_PATH: "$CRAFT_STAGE/usr/lib:\
73+
$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR\
74+
${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
75+
- PKG_CONFIG_PATH:
76+
"$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pkgconfig:\
77+
$CRAFT_STAGE/usr/lib/pkgconfig:\
78+
$CRAFT_STAGE/usr/share/pkgconfig\
79+
${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
80+
- GI_TYPELIB_PATH: "$CRAFT_STAGE/usr/lib/girepository-1.0:\
81+
$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/girepository-1.0\
82+
${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
83+
84+
ninja:
85+
plugin: nil
86+
source: https://github.com/ninja-build/ninja.git
87+
source-tag: "v1.12.1"
88+
source-depth: 1
89+
override-build: |
90+
rm -rf build
91+
rm -f ninja
92+
rm -f ninja_bootstrap
93+
sed -i 's_^#!/usr/bin/env python$_#!/usr/bin/env python3_g' configure.py
94+
./configure.py --bootstrap
95+
mv ninja ninja_bootstrap
96+
rm -rf build
97+
./ninja_bootstrap
98+
rm -f ninja_bootstrap
99+
mkdir -p $CRAFT_PART_INSTALL/usr/bin
100+
mv ninja $CRAFT_PART_INSTALL/usr/bin/
101+
build-environment: *buildenv
102+
build-packages:
103+
- python3
104+
prime:
105+
- -*
106+
107+
meson-deps:
108+
after: [ninja]
109+
plugin: nil
110+
source: https://github.com/mesonbuild/meson.git
111+
source-tag: "1.6.0"
112+
source-depth: 1
113+
override-build: |
114+
python3 -m pip install --break-system-packages .
115+
mkdir -p $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages
116+
rm -rf $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages/meson*
117+
python3 -m pip install --target=$CRAFT_PART_INSTALL/usr --break-system-packages .
118+
mv $CRAFT_PART_INSTALL/usr/meson* $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages/
119+
sed -i "s%^#!/usr/bin/python3$%#!/usr/bin/env python3%g" /usr/local/bin/meson
120+
sed -i "s%^#!/usr/bin/python3$%#!/usr/bin/env python3%g" $CRAFT_PART_INSTALL/usr/bin/meson
121+
build-environment: *buildenv
122+
build-packages:
123+
- python3-pip
124+
prime:
125+
- -*
126+
127+
pixman:
128+
after: [meson-deps]
129+
source: https://gitlab.freedesktop.org/pixman/pixman.git
130+
source-tag: "pixman-0.44.2"
131+
source-depth: 1
132+
plugin: meson
133+
meson-parameters:
134+
- --prefix=/usr
135+
- -Doptimization=3
136+
- -Dgtk=disabled
137+
- -Dtests=disabled
138+
- -Ddemos=disabled
139+
build-attributes: [enable-patchelf]
140+
build-environment: *buildenv
141+
prime:
142+
- usr/lib/*/libpix*.so.*
143+
144+
cairo:
145+
after: [pixman, meson-deps]
146+
source: https://gitlab.freedesktop.org/cairo/cairo.git
147+
source-tag: "1.18.4"
148+
source-depth: 1
149+
plugin: meson
150+
meson-parameters:
151+
- --prefix=/usr
152+
- -Doptimization=3
153+
- -Dxlib=enabled
154+
- -Dpng=enabled
155+
- -Dxcb=enabled
156+
- -Dtee=enabled
157+
- -Dzlib=enabled
158+
- -Dtests=disabled
159+
build-attributes: [enable-patchelf]
160+
build-environment: *buildenv
161+
build-packages:
162+
- libfontconfig1-dev
163+
- libfreetype-dev
164+
- libx11-dev
165+
- libxext-dev
166+
- libxcb1-dev
167+
- libxcb-render0-dev
168+
- libxcb-shm0-dev
169+
- libsm-dev
170+
- zlib1g-dev
171+
- liblzo2-dev
172+
- libxml2-dev
173+
prime:
174+
- usr/lib/*/libcairo*.so.*
175+
176+
gtk4:
177+
after: [meson-deps, cairo]
178+
source: https://gitlab.gnome.org/GNOME/gtk.git
179+
source-tag: "4.18.2"
180+
source-depth: 1
181+
plugin: meson
182+
meson-parameters:
183+
- --prefix=/usr
184+
- -Doptimization=3
185+
- -Ddebug=false
186+
- -Dbroadway-backend=true
187+
- -Dx11-backend=true
188+
- -Dwayland-backend=true
189+
- -Dwin32-backend=false
190+
- -Dmacos-backend=false
191+
- -Dintrospection=enabled
192+
- -Ddocumentation=false
193+
- -Dbuild-examples=false
194+
- -Dbuild-tests=false
195+
- -Dmedia-gstreamer=disabled
196+
- -Dbuild-demos=false
197+
- -Dbuild-testsuite=false
198+
- -Dbuild-examples=false
199+
- -Dbuild-tests=false
200+
- -Dprint-cups=enabled
201+
organize:
202+
usr/lib/gtk-4.0: usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gtk-4.0
203+
build-attributes: [enable-patchelf]
204+
build-environment: *buildenv
205+
build-packages:
206+
- libxkbcommon-dev
207+
- libcups2-dev
208+
- libcolord-dev
209+
- libdrm-dev
210+
- libegl-dev
211+
- libxrandr-dev
212+
- libxcursor-dev
213+
- libxcomposite-dev
214+
- libxdamage-dev
215+
- libxfixes-dev
216+
- libxi-dev
217+
- libxkbfile-dev
218+
- libxml2-utils
219+
- libvulkan-dev
220+
- glslc
221+
- libgraphene-1.0-dev
222+
- libxinerama-dev
223+
- gobject-introspection
224+
- gir1.2-freedesktop-dev
225+
- shared-mime-info
226+
prime:
227+
- -usr/lib/*/*/4.0.0/media/libmedia-gstreamer.so
228+
- usr/lib/*/libepoxy.so.*
229+
- usr/lib/*/libfribidi.so.*
230+
- usr/lib/*/libharfbuzz*.so.*
231+
- usr/lib/*/libgtk-4.so.*
232+
- usr/lib/*/libgdk*.so.*
233+
- usr/lib/*/libpango*.so.*
234+
- usr/lib/*/libwayland*.so.*
235+
236+
gtk4-layer-shell:
237+
after: [meson-deps, gtk4]
238+
source: https://github.com/wmww/gtk4-layer-shell.git
239+
source-tag: "v1.1.0"
240+
source-depth: 1
241+
plugin: meson
242+
meson-parameters:
243+
- --prefix=/usr
244+
- -Doptimization=3
245+
- -Dintrospection=false
246+
- -Dvapi=false
247+
build-attributes: [enable-patchelf]
248+
build-environment: *buildenv
249+
prime:
250+
- usr/lib/*/libgtk4-layer-shell.so*
251+
252+
libadwaita:
253+
after: [meson-deps, gtk4]
254+
source: https://gitlab.gnome.org/GNOME/libadwaita.git
255+
source-tag: "1.6.5"
256+
source-depth: 1
257+
plugin: meson
258+
meson-parameters:
259+
- --prefix=/usr
260+
- -Doptimization=3
261+
- -Dintrospection=enabled
262+
- -Dvapi=false
263+
- -Dgtk_doc=false
264+
- -Dtests=false
265+
- -Dexamples=false
266+
build-attributes: [enable-patchelf]
267+
build-environment: *buildenv
268+
build-packages:
269+
- libsass-dev
270+
- sassc
271+
- libyaml-dev
272+
- libzstd-dev
273+
- libsystemd-dev
274+
- gperf
275+
- libappstream-dev
276+
prime:
277+
- usr/lib/*/libadwaita*.so.*
278+
67279
ghostty:
280+
after: [gtk4-layer-shell, libadwaita, zig]
68281
source: .
69-
after: [zig]
70282
plugin: nil
71283
build-attributes: [enable-patchelf]
284+
build-environment: *buildenv
72285
build-packages:
73286
- blueprint-compiler
74-
- libgtk-4-dev
75-
- libadwaita-1-dev
76-
# TODO: Add when the Snap is updated to Ubuntu 24.10+
77-
# - gtk4-layer-shell
78287
- libxml2-utils
79288
- git
80289
- patchelf
81290
- gettext
82291
override-build: |
83292
craftctl set version=$(git describe --abbrev=8)
84-
$CRAFT_PART_SRC/../../zig/src/zig build -Dpatch-rpath=\$ORIGIN/../usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR -Doptimize=ReleaseFast
293+
$CRAFT_PART_SRC/../../zig/src/zig build -Dpatch-rpath=\$ORIGIN/../usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR -Doptimize=ReleaseFast -fsys=gtk4-layer-shell
85294
cp -rp zig-out/* $CRAFT_PART_INSTALL/
86295
sed -i 's|Icon=com.mitchellh.ghostty|Icon=/snap/ghostty/current/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png|g' $CRAFT_PART_INSTALL/share/applications/com.mitchellh.ghostty.desktop
87296
88297
libs:
89298
plugin: nil
90299
build-attributes: [enable-patchelf]
91300
stage-packages:
92-
- libadwaita-1-0
93301
- libglib2.0-0t64
94-
- libgtk-4-1
95-
- libgtk-4-media-gstreamer
96302
- ibus-gtk4
97303
- libpciaccess0
98304
- libtinfo6
@@ -103,7 +309,19 @@ parts:
103309
- libunistring5
104310
- librsvg2-2
105311
- librsvg2-common
106-
- libgdk-pixbuf-2.0-0
312+
- libxcb-randr0
313+
- libwayland-server0
314+
- libxshmfence1
315+
- libxcb-xfixes0
316+
- libxcb-sync1
317+
- libxcb-present0
318+
- libxcb-dri3-0
319+
- libxcb-dri2-0
320+
- libglapi-mesa
321+
- libx11-xcb1
322+
- libxmlb2
323+
- libstemmer0d
324+
- libappstream5
107325
- on amd64:
108326
[
109327
i965-va-driver,
@@ -113,6 +331,18 @@ parts:
113331
libdrm-radeon1,
114332
]
115333
stage:
334+
- -usr/lib/*/*/4.0.0
335+
- -usr/lib/*/libgtk-4.so.*
336+
- -usr/lib/*/libpix*.so.*
337+
- -usr/lib/*/libcairo*.so.*
338+
- -usr/lib/*/libepoxy.so.*
339+
- -usr/lib/*/libfribidi.so.*
340+
- -usr/lib/*/libgdk_pixbuf-2.0.so.*
341+
- -usr/lib/*/libharfbuzz*.so.*
342+
- -usr/lib/*/libpango*.so.*
343+
- -usr/lib/*/libwayland*.so.*
344+
- -usr/share/gtk-4.0
345+
- -usr/lib/*/libgallium*so
116346
# The libraries in dri need no-patchelf, so they come from the mesa-unpatched part
117347
- -usr/lib/*/dri
118348

@@ -130,9 +360,10 @@ parts:
130360
# The libraries in dri need no-patchelf, so they come from the mesa-unpatched part
131361
- usr/lib/*/*.so*
132362
- usr/lib/*/dri/libdril_dri.so
133-
- -usr/lib/*/libxml2.so.*
134363
- -usr/lib/*/libgallium*so
364+
- -usr/lib/*/libxml2.so.*
135365
- -usr/lib/*/dri
366+
- -usr/lib/*/libwayland*.so.*
136367

137368
mesa-gl1-dri:
138369
plugin: nil

typos.toml

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ extend-exclude = [
2525
"*.data",
2626
"*.xib",
2727
"src/cli/lorem_ipsum.txt",
28+
# Ignore packaging as it caches some package names
29+
"snap/snapcraft.yaml",
2830
]
2931

3032
[default]

0 commit comments

Comments
 (0)