[gnome-photos/wip/rishi/build-flag-for-flatpak: 5/5] build, flatpak: Add an option for installing Flatpak-specific files




commit 5893dab9704acc2680a12a37637b4c3f849e7070
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 12 15:54:20 2021 +0100

    build, flatpak: Add an option for installing Flatpak-specific files
    
    When running as a Flatpak, the application can use a private instance
    of Tracker 3's filesystem miner on hosts without Tracker 3. This
    requires a few extra files to be installed that are otherwise not
    necessary.
    
    This should make it easier for downstream distributors to ensure the
    correctness of builds, without having to understand too many details.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/174

 data/meson.build              | 46 ++++++++++++++++++++++---------------------
 flatpak/org.gnome.Photos.json |  2 +-
 meson.build                   |  1 +
 meson_options.txt             |  1 +
 4 files changed, 27 insertions(+), 23 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 96201dad..6e7192e0 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -45,34 +45,36 @@ configure_file(
   install_dir: dbus_services_dir,
 )
 
-tracker_domain_conf = configuration_data()
-tracker_domain_conf.set('application_id', photos_namespace)
-tracker_domain_conf.set('libexecdir', photos_libexecdir)
+if photos_flatpak_enabled
+  tracker_domain_conf = configuration_data()
+  tracker_domain_conf.set('application_id', photos_namespace)
+  tracker_domain_conf.set('libexecdir', photos_libexecdir)
 
-domain_ontology_rule = photos_namespace + '.rule'
+  domain_ontology_rule = photos_namespace + '.rule'
 
-configure_file(
-  input: domain_ontology_rule + '.in',
-  output: domain_ontology_rule,
-  configuration: tracker_domain_conf,
-  install: true,
-  install_dir: join_paths(photos_datadir, 'tracker3-miners', 'domain-ontologies'),
-)
-
-tracker_domain_services = [
-  'Tracker3.Miner.Extract',
-  'Tracker3.Miner.Files'
-]
-
-foreach service: tracker_domain_services
   configure_file(
-    input: '@0@.@1  service in'.format(photos_namespace, service),
-    output: '@0@.@1@.service'.format(photos_namespace, service),
+    input: domain_ontology_rule + '.in',
+    output: domain_ontology_rule,
     configuration: tracker_domain_conf,
     install: true,
-    install_dir: dbus_services_dir,
+    install_dir: join_paths(photos_datadir, 'tracker3-miners', 'domain-ontologies'),
   )
-endforeach
+
+  tracker_domain_services = [
+    'Tracker3.Miner.Extract',
+    'Tracker3.Miner.Files'
+  ]
+
+  foreach service: tracker_domain_services
+    configure_file(
+      input: '@0@.@1  service in'.format(photos_namespace, service),
+      output: '@0@.@1@.service'.format(photos_namespace, service),
+      configuration: tracker_domain_conf,
+      install: true,
+      install_dir: dbus_services_dir,
+    )
+  endforeach
+endif
 
 install_data(
   photos_namespace + '.search-provider.ini',
diff --git a/flatpak/org.gnome.Photos.json b/flatpak/org.gnome.Photos.json
index a7a3bae8..443fb61e 100644
--- a/flatpak/org.gnome.Photos.json
+++ b/flatpak/org.gnome.Photos.json
@@ -283,7 +283,7 @@
         {
             "name": "gnome-photos",
             "buildsystem": "meson",
-            "config-opts": [ "-Ddogtail=false" ],
+            "config-opts": [ "-Ddogtail=false", "-Dflatpak=true" ],
             "sources": [
                 {
                     "type": "git",
diff --git a/meson.build b/meson.build
index 868f5c7c..b65822b9 100644
--- a/meson.build
+++ b/meson.build
@@ -23,6 +23,7 @@ photos_installed_test_execdir = join_paths(photos_libexecdir, 'installed-tests',
 photos_namespace = 'org.gnome.Photos'
 
 photos_buildtype = get_option('buildtype')
+photos_flatpak_enabled = get_option('flatpak')
 photos_installed_tests_enabled = get_option('installed_tests')
 photos_manuals_enabled = get_option('manuals')
 
diff --git a/meson_options.txt b/meson_options.txt
index ea67113d..edfab991 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
 option('dogtail', type: 'boolean', value: true, description: 'test using dogtail')
+option('flatpak', type: 'boolean', value: false, description: 'Enable building for Flatpaks')
 option('installed_tests', type: 'boolean', value: false, description: 'Enable installation of some test 
cases')
 option('manuals', type: 'boolean', value: false, description: 'Enable manual pages')


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