[gnome-sound-recorder/bilelmoussaoui/dual-installation] build: set up dual installation



commit 0cd5cd1bd8149ba1ab3829a793a7501332837ce0
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed May 29 12:54:29 2019 +0200

    build: set up dual installation

 .gitlab-ci.yml                                     |  3 ++-
 build-aux/meson_post_install.py                    |  4 +++-
 data/appdata/meson.build                           | 12 +++++++++--
 ...n => org.gnome.SoundRecorder.appdata.xml.in.in} |  4 ++--
 data/meson.build                                   | 21 ++++++++++++-------
 ...op.in => org.gnome.SoundRecorder.desktop.in.in} |  2 +-
 data/org.gnome.SoundRecorder.gschema.xml.in        |  2 +-
 meson.build                                        | 24 +++++++++++++++++++---
 meson_options.txt                                  | 10 +++++++++
 org.gnome.SoundRecorder.json                       |  5 ++++-
 po/POTFILES.in                                     |  4 ++--
 src/application.js                                 |  2 ++
 src/meson.build                                    |  8 +++++++-
 ...> org.gnome.SoundRecorder.src.gresource.xml.in} |  2 +-
 14 files changed, 80 insertions(+), 23 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f1a2d0..ffbcbd1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,8 +8,9 @@ flatpak:
     variables:
         MANIFEST_PATH: "org.gnome.SoundRecorder.json"
         FLATPAK_MODULE: "gnome-sound-recorder"
+        MESON_ARGS: "-Dprofile=development"
         RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
-        APP_ID: "org.gnome.SoundRecorder"
+        APP_ID: "org.gnome.SoundRecorderDevel"
     extends: .flatpak
 
 review:
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
index 897a1db..7555f69 100755
--- a/build-aux/meson_post_install.py
+++ b/build-aux/meson_post_install.py
@@ -7,11 +7,13 @@ import sys
 destdir = os.environ.get('DESTDIR', '')
 datadir = sys.argv[1]
 bindir = os.path.normpath(destdir + os.sep + sys.argv[2])
+pkgdatadir = sys.argv[3]
+application_id = sys.argv[4]
 
 if not os.path.exists(bindir):
   os.makedirs(bindir)
 
-src = os.path.join(datadir, 'gnome-sound-recorder', 'org.gnome.SoundRecorder')
+src = os.path.join(pkgdatadir, application_id)
 dest = os.path.join(bindir, 'gnome-sound-recorder')
 subprocess.call(['ln', '-s', '-f', src, dest])
 
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
index a5a78c2..97ac7d2 100644
--- a/data/appdata/meson.build
+++ b/data/appdata/meson.build
@@ -1,11 +1,19 @@
+appdata_conf = configuration_data()
+appdata_conf.set('app-id', application_id)
+
 appdata_file = i18n.merge_file(
   'appdata-file',
-  input: '@0  appdata xml in'.format(application_id),
+  input: configure_file(
+       input: 'org.gnome.SoundRecorder.appdata.xml.in.in',
+       output: '@BASENAME@',
+       configuration: appdata_conf
+       ),
   output: '@0  appdata xml'.format(application_id),
   po_dir: po_dir,
   install: true,
   install_dir: join_paths(sound_recorder_datadir, 'metainfo')
 )
+
 appstream_util = find_program('appstream-util', required: false)
 if appstream_util.found()
   test(
@@ -14,4 +22,4 @@ if appstream_util.found()
       'validate-relax', '--nonet', appdata_file.full_path()
     ]
   )
-endif
\ No newline at end of file
+endif
diff --git a/data/appdata/org.gnome.SoundRecorder.appdata.xml.in 
b/data/appdata/org.gnome.SoundRecorder.appdata.xml.in.in
similarity index 94%
rename from data/appdata/org.gnome.SoundRecorder.appdata.xml.in
rename to data/appdata/org.gnome.SoundRecorder.appdata.xml.in.in
index a73f988..518c0b5 100644
--- a/data/appdata/org.gnome.SoundRecorder.appdata.xml.in
+++ b/data/appdata/org.gnome.SoundRecorder.appdata.xml.in.in
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Copyright 2014 Richard Hughes <richard hughsie com> -->
 <component type="desktop-application">
-  <id>org.gnome.SoundRecorder</id>
+  <id>@app-id@</id>
   <name>Sound Recorder</name>
   <summary>A simple, modern sound recorder for GNOME</summary>
   <project_license>GPL-2.0+</project_license>
@@ -33,7 +33,7 @@
     <kudo>HiDpiIcon</kudo>
     <kudo>ModernToolkit</kudo>
   </kudos>
-  <launchable type="destkop-id">org.gnome.SoundRecorder</launchable>
+  <launchable type="destkop-id">@app-id@.desktop</launchable>
   <url type="homepage">https://wiki.gnome.org/Apps/SoundRecorder</url>
   <url type="bugtracker">https://gitlab.gnome.org/GNOME/gnome-sound-recorder/issues</url>
   <url type="donation">https://www.gnome.org/friends/</url>
diff --git a/data/meson.build b/data/meson.build
index abee44d..2f417ae 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,18 +1,26 @@
 icon_dir = join_paths('icons', 'hicolor', 'scalable', 'apps')
 install_data(
-  join_paths(icon_dir, '@0@.svg'.format(application_id)),
+  join_paths(icon_dir, 'org.gnome.SoundRecorder.svg'),
+  rename: '@0@.svg'.format(application_id),
   install_dir: join_paths(sound_recorder_datadir, icon_dir)
 )
 
 icon_dir = join_paths('icons', 'hicolor', 'symbolic', 'apps')
 install_data(
-  join_paths(icon_dir, '@0 -symbolic svg'.format(application_id)),
+  join_paths(icon_dir, 'org.gnome.SoundRecorder-symbolic.svg'),
+  rename: '@0 -symbolic svg'.format(application_id),
   install_dir: join_paths(sound_recorder_datadir, icon_dir)
 )
 
+desktop_conf = configuration_data()
+desktop_conf.set('app-id', application_id)
 desktop_file = i18n.merge_file(
   'desktop',
-  input: '@0  desktop in'.format(application_id),
+  input: configure_file(
+       input: 'org.gnome.SoundRecorder.desktop.in.in',
+       output: '@BASENAME@',
+       configuration: desktop_conf
+),
   output: '@0@.desktop'.format(application_id),
   install: true,
   install_dir: join_paths(sound_recorder_datadir, 'applications'),
@@ -31,10 +39,9 @@ if desktop_file_validate.found()
 endif
 
 gsettings_conf = configuration_data()
-gsettings_conf.set('GETTEXT_PACKAGE', meson.project_name ())
-gsettings_conf.set('APP_ID', application_id)
+gsettings_conf.set('app-id', application_id)
 configure_file(
-  input: '@0  gschema xml in'.format(application_id),
+  input: 'org.gnome.SoundRecorder.gschema.xml.in',
   output: '@0  gschema xml'.format(application_id),
   configuration: gsettings_conf,
   install: true,
@@ -43,7 +50,7 @@ configure_file(
 
 gnome.compile_resources(
   application_id + '.data',
-  application_id + '.data.gresource.xml',
+  'org.gnome.SoundRecorder.data.gresource.xml',
   gresource_bundle: true,
   install_dir: sound_recorder_pkgdatadir,
   install: true
diff --git a/data/org.gnome.SoundRecorder.desktop.in b/data/org.gnome.SoundRecorder.desktop.in.in
similarity index 94%
rename from data/org.gnome.SoundRecorder.desktop.in
rename to data/org.gnome.SoundRecorder.desktop.in.in
index 2f9db35..0bb63f3 100644
--- a/data/org.gnome.SoundRecorder.desktop.in
+++ b/data/org.gnome.SoundRecorder.desktop.in.in
@@ -3,7 +3,7 @@ Type=Application
 Name=Sound Recorder
 Comment=Record sound via the microphone and play it back
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.SoundRecorder
+Icon=@app-id@
 Categories=GNOME;GTK;Audio;AudioVideo;
 # Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list 
MUST also end with a semicolon!
 Keywords=Audio;Application;Record;
diff --git a/data/org.gnome.SoundRecorder.gschema.xml.in b/data/org.gnome.SoundRecorder.gschema.xml.in
index 921de54..7749882 100644
--- a/data/org.gnome.SoundRecorder.gschema.xml.in
+++ b/data/org.gnome.SoundRecorder.gschema.xml.in
@@ -1,5 +1,5 @@
 <schemalist>
-  <schema id="@APP_ID@" path="/org/gnome/SoundRecorder/" gettext-domain="@GETTEXT_PACKAGE@">
+  <schema id="@app-id@" path="/org/gnome/SoundRecorder/" gettext-domain="gnome-sound-recorder">
     <key name="window-size" type="ai">
       <default>[780, 480]</default>
       <summary>Window size</summary>
diff --git a/meson.build b/meson.build
index 31e284c..8e006e4 100644
--- a/meson.build
+++ b/meson.build
@@ -2,10 +2,26 @@ project(
   'gnome-sound-recorder',
   version: '3.32.0',
   license: 'GPL2+',
-  meson_version: '>= 0.46.0'
+  meson_version: '>= 0.50.0'
 )
 
-application_id = 'org.gnome.SoundRecorder'
+if get_option('profile') == 'development'
+  profile = 'Devel'
+  name_suffix = ' (Development)'
+  vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
+  if vcs_tag == ''
+    version_suffix = '-devel'
+  else
+    version_suffix = '-@0@'.format (vcs_tag)
+  endif
+else
+  profile = ''
+  name_suffix = ''
+  version_suffix = ''
+endif
+application_id = 'org.gnome.SoundRecorder@0@'.format(profile)
+
+
 
 sound_recorder_prefix = get_option('prefix')
 sound_recorder_bindir = join_paths(sound_recorder_prefix, get_option('bindir'))
@@ -36,5 +52,7 @@ subdir('po')
 meson.add_install_script(
   join_paths('build-aux', 'meson_post_install.py'),
   sound_recorder_datadir,
-  sound_recorder_bindir
+  sound_recorder_bindir,
+  sound_recorder_pkgdatadir,
+  application_id
 )
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..4ec13df
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,10 @@
+option(
+        'profile',
+        type: 'combo',
+        choices: [
+                'default',
+                'development'
+        ],
+        value: 'default'
+)
+
diff --git a/org.gnome.SoundRecorder.json b/org.gnome.SoundRecorder.json
index 8c82157..4edae0b 100644
--- a/org.gnome.SoundRecorder.json
+++ b/org.gnome.SoundRecorder.json
@@ -1,5 +1,5 @@
 {
-    "app-id" : "org.gnome.SoundRecorder",
+    "app-id" : "org.gnome.SoundRecorderDevel",
     "runtime" : "org.gnome.Platform",
     "runtime-version" : "master",
     "sdk" : "org.gnome.Sdk",
@@ -23,6 +23,9 @@
         {
             "name" : "gnome-sound-recorder",
             "buildsystem": "meson",
+            "config-opts": [
+               "-Dprofile=development"
+            ],
             "sources" : [
                 {
                     "type" : "git",
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2394455..355df57 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,6 @@
-data/appdata/org.gnome.SoundRecorder.appdata.xml.in
+data/appdata/org.gnome.SoundRecorder.appdata.xml.in.in
 data/org.gnome.SoundRecorder.gschema.xml.in
-data/org.gnome.SoundRecorder.desktop.in
+data/org.gnome.SoundRecorder.desktop.in.in
 src/audioProfile.js
 src/application.js
 src/fileUtil.js
diff --git a/src/application.js b/src/application.js
index 587bb1d..5149272 100644
--- a/src/application.js
+++ b/src/application.js
@@ -84,6 +84,8 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
 
     vfunc_activate() {
         (this.window = new MainWindow.MainWindow({ application: this })).show();
+        if (pkg.name.endsWith('Devel'))
+            this.window.get_style_context().add_class("devel");
     }
 
     onWindowDestroy() {
diff --git a/src/meson.build b/src/meson.build
index 8936a05..d368a41 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -13,9 +13,15 @@ configure_file(
   configuration: app_conf
 )
 
+source_res_conf = configuration_data()
+source_res_conf.set('profile', profile)
 gnome.compile_resources(
   application_id + '.src',
-  'org.gnome.SoundRecorder.src.gresource.xml',
+  configure_file(
+       input: 'org.gnome.SoundRecorder.src.gresource.xml.in',
+       output: '@BASENAME@',
+       configuration: source_res_conf
+),
   source_dir: '.',
   gresource_bundle: true,
   install: true,
diff --git a/src/org.gnome.SoundRecorder.src.gresource.xml b/src/org.gnome.SoundRecorder.src.gresource.xml.in
similarity index 86%
rename from src/org.gnome.SoundRecorder.src.gresource.xml
rename to src/org.gnome.SoundRecorder.src.gresource.xml.in
index ee9296c..7fb1ff4 100644
--- a/src/org.gnome.SoundRecorder.src.gresource.xml
+++ b/src/org.gnome.SoundRecorder.src.gresource.xml.in
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/SoundRecorder/js">
+  <gresource prefix="/org/gnome/SoundRecorder@profile@/js">
     <file>application.js</file>
     <file>audioProfile.js</file>
     <file>fileUtil.js</file>


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