[neon/snap-packaging/gtk-theme-breeze-snap] /: Initial attempt.

Scarlett Moore null at kde.org
Wed Jul 31 00:33:25 BST 2024


Git commit 6beb44e93c4221eefa60d8b8d14fe5e0f461febb by Scarlett Moore.
Committed on 30/07/2024 at 23:30.
Pushed by scarlettmoore into branch 'master'.

Initial attempt.

A  +8    -0    debian/.gitlab-ci-neon.yml
A  +72   -0    snapcraft.yaml
A  +21   -0    utils/split-gtk-theme.sh
A  +17   -0    utils/update-icon-cache.sh

https://invent.kde.org/neon/snap-packaging/gtk-theme-breeze-snap/-/commit/6beb44e93c4221eefa60d8b8d14fe5e0f461febb

diff --git a/debian/.gitlab-ci-neon.yml b/debian/.gitlab-ci-neon.yml
new file mode 100644
index 0000000..ab2589a
--- /dev/null
+++ b/debian/.gitlab-ci-neon.yml
@@ -0,0 +1,8 @@
+# SPDX-FileCopyrightText: none
+# SPDX-License-Identifier: CC0-1.0
+
+include:
+  - project: sysadmin/ci-utilities
+    file:
+#      - /gitlab-templates/snap-snapcraft-destructive.yml
+      - /gitlab-templates/snap-snapcraft-lxd.yml
diff --git a/snapcraft.yaml b/snapcraft.yaml
new file mode 100644
index 0000000..2c9eddb
--- /dev/null
+++ b/snapcraft.yaml
@@ -0,0 +1,72 @@
+name: gtk-theme-breeze
+architectures:
+  - build-on: amd64
+    run-on: all
+version: '22.04.16'
+summary: Yaru MATE is the default theme for Ubuntu MATE 21.04 and newer.
+description: |
+  Snap of the Yaru MATE GTK theme.
+
+# We build against Ubuntu 20.04 packages, but use the "bare" base as
+# we don't want to force installation of a large base snap.
+build-base: core20
+base: bare
+
+grade: stable
+confinement: strict
+
+slots:
+  gtk-2-themes:
+    interface: content
+    source:
+      read:
+        - $SNAP/share/gtk2/Breeze
+        - $SNAP/share/gtk2/Breeze-Dark
+  gtk-3-themes:
+    interface: content
+    source:
+      read:
+        - $SNAP/share/themes/Breeze
+        - $SNAP/share/themes/Breeze-Dark
+
+parts:
+  base:
+    after: [utils]
+    plugin: nil
+    stage-snaps:
+    - qt-common-themes-sdk/latest/stable
+    stage:
+    - -usr/lib/*/libdrm*
+    - -usr/share/doc/libdrm*
+    override-prime: |
+        set -eux
+        craftctl default
+        cd $CRAFT_PRIME
+        find . -type f,l -name "*.h" -exec bash -c "rm -f {}*" \;
+  breeze-gtk:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - qt-common-themes-sdk
+    stage:
+    - share/themes/Breeze
+    - share/themes/Breeze-Dark
+    - share/gtk2/*/gtk-2.0
+    - share/themes/*/gtk-3*
+    - share/themes/*/gtk-4*
+    override-build: |
+      cp -rfv /snap/qt-common-themes-sdk/current/share $CRAFT_PART_INSTALL
+      craftctl default
+      $CRAFT_STAGE/split-gtk-theme.sh $CRAFT_PART_INSTALL
+      # Make assets available to both GTK 3 and GTK 2 themes after split
+      cp -a $CRAFT_PART_INSTALL/share/themes/Breeze/assets $CRAFT_PART_INSTALL/share/gtk2/Breeze/
+      cp -a $CRAFT_PART_INSTALL/share/themes/Breeze-Dark/assets $CRAFT_PART_INSTALL/share/gtk2/Breeze-Dark/
+
+  utils:
+    plugin: dump
+    source: utils
+    prime:
+      - -*
+    build-packages:
+      - try: [gtk-update-icon-cache]
+      - else: [libgtk-3-bin]
diff --git a/utils/split-gtk-theme.sh b/utils/split-gtk-theme.sh
new file mode 100755
index 0000000..73a1175
--- /dev/null
+++ b/utils/split-gtk-theme.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -eux
+
+basedir="$1"
+gtk2dir="$basedir/share/gtk2"
+themesdir="$basedir/share/themes"
+
+for theme in "$themesdir"/*; do
+    if [ ! -d "$theme" ]; then
+        continue
+    fi
+    themename="$(basename "$theme")"
+    for subdir in "$theme"/gtk-2*; do
+        if [ -d "$subdir" ]; then
+            mkdir -p "$gtk2dir/$themename"
+            mv "$subdir" "$gtk2dir/$themename/"
+        fi
+    done
+done
+
diff --git a/utils/update-icon-cache.sh b/utils/update-icon-cache.sh
new file mode 100755
index 0000000..38061eb
--- /dev/null
+++ b/utils/update-icon-cache.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -eux
+
+basedir="$1"
+
+# Don't include panel icons to reduce size as they aren't
+# generally useful in the snap.
+if [ -d "$basedir" ]; then
+    find "$basedir" -name panel -exec rm -rf {} +
+fi
+
+for dir in "$basedir"/*/; do
+    if [ -f "$dir/index.theme" ]; then
+        gtk-update-icon-cache -q "$dir"
+    fi
+done


More information about the Neon-commits mailing list