[dconf-editor: 1/3] Add flatpak build




commit 3e0d151c6ca4eda39154aaaa7b5b3225bfe246cd
Author: Maximiliano Sandoval R <msandova protonmail com>
Date:   Tue Jul 12 19:23:22 2022 +0200

    Add flatpak build
    
    Fixes: https://gitlab.gnome.org/GNOME/dconf-editor/-/issues/20

 build-aux/ca.desrt.dconf-editor.json | 66 ++++++++++++++++++++++++++++++++++++
 build-aux/dconf-override.patch       | 23 +++++++++++++
 build-aux/start-dconf-editor.sh      | 25 ++++++++++++++
 3 files changed, 114 insertions(+)
---
diff --git a/build-aux/ca.desrt.dconf-editor.json b/build-aux/ca.desrt.dconf-editor.json
new file mode 100644
index 00000000..4684c3df
--- /dev/null
+++ b/build-aux/ca.desrt.dconf-editor.json
@@ -0,0 +1,66 @@
+{
+    "id": "ca.desrt.dconf-editor",
+    "runtime": "org.gnome.Platform",
+    "runtime-version": "master",
+    "sdk": "org.gnome.Sdk",
+    "command": "start-dconf-editor",
+    "finish-args": [
+        "--share=ipc",
+        "--socket=fallback-x11",
+        "--socket=wayland",
+        "--talk-name=ca.desrt.dconf",
+        "--filesystem=xdg-run/dconf",
+        "--filesystem=host:ro",
+        "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
+        "--env=GIO_EXTRA_MODULES=/app/lib/gio/modules/",
+        "--talk-name=org.freedesktop.Flatpak",
+        "--talk-name=org.gnome.SettingsDaemon.Color"
+    ],
+    "modules": [
+        {
+            "name": "dconf",
+            "buildsystem": "meson",
+            "config-opts": ["-Dbash_completion=false", "-Dman=false"],
+            "cleanup": [
+                "/include",
+                "/lib/pkgconfig",
+                "/libexec",
+                "/share/dbus-1"
+            ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://download.gnome.org/sources/dconf/0.40/dconf-0.40.0.tar.xz";,
+                    "sha256": "cf7f22a4c9200421d8d3325c5c1b8b93a36843650c9f95d6451e20f0bcb24533"
+                },
+                {
+                    "type": "patch",
+                    "path": "dconf-override.patch"
+                }
+            ]
+        },
+        {
+            "name": "scripts",
+            "buildsystem": "simple",
+            "build-commands": [
+                "install -Dm 755 start-dconf-editor.sh /app/bin/start-dconf-editor"
+            ],
+            "sources": [
+                {
+                    "type": "file",
+                    "path": "start-dconf-editor.sh"
+                }
+            ]
+        },
+        {
+            "name": "dconf-editor",
+            "buildsystem": "meson",
+            "sources": [
+                {
+                    "type": "dir",
+                    "path": "../"
+                }
+            ]
+        }
+    ]
+}
diff --git a/build-aux/dconf-override.patch b/build-aux/dconf-override.patch
new file mode 100644
index 00000000..0e95c229
--- /dev/null
+++ b/build-aux/dconf-override.patch
@@ -0,0 +1,23 @@
+diff --git a/engine/dconf-engine-source-user.c b/engine/dconf-engine-source-user.c
+index 1657875..e4f8786 100644
+--- a/engine/dconf-engine-source-user.c
++++ b/engine/dconf-engine-source-user.c
+@@ -39,11 +39,17 @@ dconf_engine_source_user_open_gvdb (const gchar *name)
+ {
+   GvdbTable *table;
+   gchar *filename;
++  const gchar *override;
++
++  override = g_getenv ("DCONF_USER_CONFIG_DIR");
++  if (override == NULL)
++    filename = g_build_filename (g_get_user_config_dir (), "dconf", name, NULL);
++  else
++    filename = g_build_filename (g_get_home_dir (), override, name, NULL);
+ 
+   /* This can fail in the normal case of the user not having any
+    * settings.  That's OK and it shouldn't be considered as an error.
+    */
+-  filename = g_build_filename (g_get_user_config_dir (), "dconf", name, NULL);
+   table = gvdb_table_new (filename, FALSE, NULL);
+   g_free (filename);
+ 
diff --git a/build-aux/start-dconf-editor.sh b/build-aux/start-dconf-editor.sh
new file mode 100644
index 00000000..8b6d2f81
--- /dev/null
+++ b/build-aux/start-dconf-editor.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/bash
+
+IFS=: read -ra host_data_dirs < <(flatpak-spawn --host sh -c 'echo $XDG_DATA_DIRS')
+
+# To avoid potentially muddying up $XDG_DATA_DIRS too much, we link the schema paths
+# into a temporary directory.
+bridge_dir=$XDG_RUNTIME_DIR/dconf-bridge
+mkdir -p "$bridge_dir"
+
+for dir in "${host_data_dirs[@]}"; do
+  if [[ "$dir" == /usr/* ]]; then
+    dir=/run/host/"$dir"
+  fi
+
+  schemas="$dir/glib-2.0/schemas"
+  if [[ -d "$schemas" ]]; then
+    bridged=$(mktemp -d XXXXXXXXXX -p "$bridge_dir")
+    mkdir -p "$bridged"/glib-2.0
+    ln -s "$schemas" "$bridged"/glib-2.0
+    XDG_DATA_DIRS=$XDG_DATA_DIRS:"$bridged"
+  fi
+done
+
+export XDG_DATA_DIRS
+exec dconf-editor "$@"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]