[neon/snap-packaging/qt-common-themes] /: Initial commit

Scarlett Moore null at kde.org
Thu Jun 27 14:38:33 BST 2024


Git commit 46cf079802a2b6d2437b641a0831bfe099eb526e by Scarlett Moore.
Committed on 27/06/2024 at 13:38.
Pushed by scarlettmoore into branch 'master'.

Initial commit

A  +8    -0    debian/.gitlab-ci-neon.yml
A  +178  -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/qt-common-themes/-/commit/46cf079802a2b6d2437b641a0831bfe099eb526e

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..3c268ef
--- /dev/null
+++ b/snapcraft.yaml
@@ -0,0 +1,178 @@
+name: qt-common-themes
+adopt-info: version-script
+summary: All the qt (common) themes
+description: |
+  A snap that exports the KDE/Qt6 themes and icon themes used on various Linux distros.
+
+# We build against Ubuntu 22.04 packages, but use the "bare" base as
+# we don't want to force installation of a large base snap.
+build-base: core22
+base: bare
+compression: lzo
+
+grade: stable
+confinement: strict
+
+slots:
+  qt-6-themes:
+    interface: content
+    source:
+      read:
+        - $SNAP/usr/share/themes/Breeze
+        - $SNAP/usr/share/themes/Breeze-Dark
+        - $SNAP/usr/share/gtk2/Breeze
+        - $SNAP/usr/share/gtk2/Breeze-Dark
+        - $SNAP/usr/share/kstyle/themes
+  qt-icon-themes:
+    interface: content
+    source:
+      read:
+        - $SNAP/usr/share/icons/breeze_cursors
+        - $SNAP/usr/share/icons/KDE_Classic
+        - $SNAP/usr/share/icons/Oxygen_White
+        - $SNAP/usr/share/icons/Breeze_Light
+        - $SNAP/usr/share/icons/Oxygen_Black
+        - $SNAP/usr/share/icons/Oxygen_Yellow
+        - $SNAP/usr/share/icons/Oxygen_Blue
+        - $SNAP/usr/share/icons/Oxygen_Zion
+        - $SNAP/usr/share/icons/oxygen
+        - $SNAP/usr/share/icons/breeze
+        - $SNAP/usr/share/icons/breeze-dark
+  qt-sound-themes:
+    interface: content
+    source:
+      read:
+        - $SNAP/share/sounds/oxygen
+        - $SNAP/share/sounds/ocean
+
+parts:
+  version-script:
+    plugin: nil
+    source: .
+    build-packages:
+      - git
+    override-build: |
+      craftctl set-version $(git -C $CRAFT_PROJECT_DIR describe --tags 2>/dev/null || echo 0.1)
+
+
+  # Breeze: KDE's default theme
+  breeze:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - qt-common-themes-sdk
+    stage:
+      - usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6/plugins
+      - usr/share/QtCurve
+      - usr/share/color-schemes/
+      - usr/share/kstyle/
+
+  oxygen-icons:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - kf6-core22-sdk
+    stage:
+      - usr/share/icons/oxygen
+    override-build: |
+      snapcraftctl build
+      $SNAPCRAFT_STAGE/update-icon-cache.sh $SNAPCRAFT_PART_INSTALL/share/icons
+
+  # KDE's Breeze cursor themes
+  breeze-icons:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - kf6-core22-sdk
+    stage:
+      - usr/share/icons/breeze
+      - usr/share/icons/breeze-dark
+    override-build: |
+      craftctl default
+      $CRAFT_STAGE/update-icon-cache.sh $CRAFT_PART_INSTALL/share/icons
+
+  breeze-cursors:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - kf6-core22-sdk
+    stage:
+      - usr/share/icons/Breeze_Light
+      - usr/share/icons/breeze_cursors
+    organize:
+      'cursors/Breeze/Breeze/cursors' : 'share/icons/breeze_cursors/cursors'
+      'cursors/Breeze/Breeze/index.theme' : 'share/icons/breeze_cursors/index.theme'
+      'cursors/Breeze/Breeze_Light/cursors' : 'share/icons/Breeze_Light/cursors'
+      'cursors/Breeze/Breeze_Light/index.theme' : 'share/icons/Breeze_Light/index.theme'
+    override-build: |
+      craftctl default
+      $CRAFT_STAGE/update-icon-cache.sh $CRAFT_PART_INSTALL/share/icons
+
+  oxygen-cursors:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - kf6-core22-sdk
+    stage:
+      - usr/share/icons/Oxygen_Black
+      - usr/share/icons/Oxygen_Blue
+      - usr/share/icons/Oxygen_White
+      - usr/share/icons/Oxygen_Yellow
+      - usr/share/icons/Oxygen_Zion
+    organize:
+      'cursors/Oxygen/Oxygen_Black/cursors' : 'share/icons/Oxygen_Black/cursors'
+      'cursors/Oxygen/Oxygen_Black/index.theme' : 'share/icons/Oxygen_Black/index.theme'
+      'cursors/Oxygen/Oxygen_Blue/cursors' : 'share/icons/Oxygen_Blue/cursors'
+      'cursors/Oxygen/Oxygen_Blue/index.theme' : 'share/icons/Oxygen_Blue/index.theme'
+      'cursors/Oxygen/Oxygen_White/cursors' : 'share/icons/Oxygen_White/cursors'
+      'cursors/Oxygen/Oxygen_White/index.theme' : 'share/icons/Oxygen_White/index.theme'
+      'cursors/Oxygen/Oxygen_Yellow/cursors' : 'share/icons/Oxygen_Yellow/cursors'
+      'cursors/Oxygen/Oxygen_Yellow/index.theme' : 'share/icons/Oxygen_Yellow/index.theme'
+      'cursors/Oxygen/Oxygen_Zion/cursors' : 'share/icons/Oxygen_Zion/cursors'
+      'cursors/Oxygen/Oxygen_Zion/index.theme' : 'share/icons/Oxygen_Zion/index.theme'
+    override-build: |
+      craftctl default
+      $CRAFT_STAGE/update-icon-cache.sh $CRAFT_PART_INSTALL/share/icons
+
+  #KDE GTK themes
+  breeze-gtk:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - qt-common-themes-sdk
+    stage:
+    - usr/share/themes/Breeze/assets
+    - usr/share/themes/Breeze/gtk-2.0/
+    - usr/share/themes/Breeze/gtk-3.0/
+    - usr/share/themes/Breeze/settings.ini
+    - usr/share/themes/Breeze-Dark/assets/
+    - usr/share/themes/Breeze-Dark/gtk-2.0/
+    - usr/share/themes/Breeze-Dark/gtk-3.0/
+    override-build: |
+      craftctl default
+      $CRAFT_STAGE/split-gtk-theme.sh $CRAFT_STAGE
+      # Make assets available to both GTK 3 and GTK 2 themes after split
+      cp -a $CRAFT_STAGE/usr/share/themes/Breeze/assets $CRAFT_STAGE/usr/share/gtk2/Breeze/
+      cp -a $CRAFT_STAGE/usr/share/themes/Breeze-Dark/assets $CRAFT_STAGE/usr/share/gtk2/Breeze-Dark/
+
+  oxygen-gtk:
+    after: [utils]
+    plugin: nil
+    build-snaps:
+    - qt-common-themes-sdk
+    stage:
+    - usr/share/themes/oxygen-gtk
+    override-build: |
+      craftctl default
+      $CRAFT_STAGE/split-gtk-theme.sh $CRAFT_STAGE
+      # Make assets available to both GTK 3 and GTK 2 themes after split
+      cp -a $CRAFT_STAGE/usr/share/themes/oxygen-gtk/assets $CRAFT_STAGE/usr/share/gtk2/oxygen-gtk/
+
+  utils:
+    plugin: dump
+    source: utils
+    prime:
+      - -*
+    build-packages:
+      - gtk-update-icon-cache
+
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