From 1970103ec43e7580e40f8e3ce06082b7c1248ba7 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Thu, 22 Jun 2023 15:36:34 +0200 Subject: [PATCH 1/2] Remove geocode --- snapcraft.yaml | 56 +++++++------------------------------------------- 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index 346efe1..c54a3d6 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -37,55 +37,7 @@ apps: parts: - buildenv: - plugin: nil - build-environment: &buildenv - - PATH: $CRAFT_STAGE/usr/bin:$PATH - - ACLOCAL_PATH: $CRAFT_STAGE/usr/share/aclocal - - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/share:$XDG_DATA_DIRS - - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/vala-0.54:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH - - GDK_PIXBUF_MODULE_FILE: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0/2.10.0/loaders.cache - - PKG_CONFIG_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$CRAFT_STAGE/usr/lib/pkgconfig:$CRAFT_STAGE/usr/share/pkgconfig:$PKG_CONFIG_PATH - - libgeocode: - source: https://gitlab.gnome.org/GNOME/geocode-glib.git - source-tag: '3.26.4' - source-depth: 1 -# ext:updatesnap -# version-format: -# lower-than: '3.27' -# no-9x-revisions: true - plugin: meson - meson-parameters: - - --prefix=/usr - - --buildtype=release - - -Denable-installed-tests=false - - -Denable-introspection=true - - -Denable-gtk-doc=false - - -Dsoup2=true - build-packages: - - libnghttp2-dev - - libgweather: - after: [ libgeocode ] - source: https://gitlab.gnome.org/GNOME/libgweather.git - source-tag: '4.1.1' -# ext:updatesnap -# version-format: -# lower-than: '4.2' -# no-9x-revisions: true - source-depth: 1 - plugin: meson - meson-parameters: - - --prefix=/usr - - --buildtype=release - - -Dintrospection=true - - -Dgtk_doc=false - - -Dtests=false - - -Dsoup2=true - gnome-clocks: - after: [ libgweather ] source: https://gitlab.gnome.org/GNOME/gnome-clocks.git source-tag: '44.0' # ext:updatesnap @@ -111,7 +63,13 @@ parts: override-pull: | craftctl default craftctl set version=$(git describe --tags --abbrev=10) - build-environment: *buildenv + build-environment: + - PATH: $CRAFT_STAGE/usr/bin:$PATH + - ACLOCAL_PATH: $CRAFT_STAGE/usr/share/aclocal + - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/share:$XDG_DATA_DIRS + - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/vala-0.54:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH + - GDK_PIXBUF_MODULE_FILE: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0/2.10.0/loaders.cache + - PKG_CONFIG_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$CRAFT_STAGE/usr/lib/pkgconfig:$CRAFT_STAGE/usr/share/pkgconfig:$PKG_CONFIG_PATH stage-packages: - libgeoclue-2-0 override-build: | From 93d7212279154f7d6877a3325cde5271c20e2c16 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Thu, 22 Jun 2023 17:03:17 +0200 Subject: [PATCH 2/2] Remove unneeded files This patch uses snapbuildtools to remove files that are already in core22, gnome-42-2204, or gtk-common-themes. It reduces the size of the snap from 1.5 to 1.1 MBytes. --- snapcraft.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index c54a3d6..47076e3 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -36,8 +36,16 @@ apps: desktop: usr/share/applications/org.gnome.clocks.desktop parts: + snapbuildtools: + source: https://github.com/sergio-costas/snap-build-tools.git + source-depth: 1 + plugin: nil + override-pull: | + craftctl default + $CRAFT_PART_SRC/install gnome-clocks: + after: [snapbuildtools] source: https://gitlab.gnome.org/GNOME/gnome-clocks.git source-tag: '44.0' # ext:updatesnap @@ -72,7 +80,9 @@ parts: - PKG_CONFIG_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$CRAFT_STAGE/usr/lib/pkgconfig:$CRAFT_STAGE/usr/share/pkgconfig:$PKG_CONFIG_PATH stage-packages: - libgeoclue-2-0 + build-snaps: [core22, gtk-common-themes, gnome-42-2204] override-build: | + $CRAFT_PROJECT_DIR/snapbuildtools/remove_common.py core22 gtk-common-themes gnome-42-2204 craftctl default sed -i 's|Icon=org.gnome.clocks$|Icon=${SNAP}/meta/gui/org.gnome.clocks.svg|g' $CRAFT_PART_INSTALL/usr/share/applications/org.gnome.clocks.desktop mkdir -p $CRAFT_PART_INSTALL/meta/gui @@ -83,7 +93,6 @@ parts: plugin: nil override-prime: | set -eux - rm -rf usr/share/doc rm -rf usr/share/man rm -rf usr/libexec/*/installed-tests @@ -93,8 +102,5 @@ parts: rm -rf usr/include rm -rf usr/lib/$CRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0 rm -rf usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig - find . -type d -empty -delete - for snap in "core22" "gtk-common-themes" "gnome-42-2204"; do - cd "/snap/$snap/current" && find . -type f,l -name *.so.* -exec rm -f "$CRAFT_PRIME/{}" \; - done + glib-compile-schemas $CRAFT_PRIME/usr/share/glib-2.0/schemas \ No newline at end of file