[gnome-weather/wip/christopherdavis/dual-install: 6/7] build: set up dual-install for flatpak
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/wip/christopherdavis/dual-install: 6/7] build: set up dual-install for flatpak
- Date: Wed, 10 Apr 2019 18:03:55 +0000 (UTC)
commit bc2e17ff9b24f3f34bcbbbec919f648173d31519
Author: Christopher Davis <brainblasted disroot org>
Date: Wed Mar 6 02:28:53 2019 -0500
build: set up dual-install for flatpak
Sets up dual installation with profiles and different
application IDs.
data/meson.build | 26 ++++++++++++++--------
....xml.in => org.gnome.Weather.appdata.xml.in.in} | 5 +++--
data/org.gnome.Weather.search-provider.ini | 6 -----
data/org.gnome.Weather.search-provider.ini.in | 6 +++++
meson.build | 12 ++++++++--
meson_post_install.py | 3 ++-
org.gnome.Weather.json | 7 ++++--
src/app/main.js | 9 ++++++--
src/app/window.js | 14 ++++++++++--
src/meson.build | 20 ++++++++++++-----
src/org.gnome.Weather.BackgroundService.in | 2 +-
...Weather.BackgroundService.src.gresource.xml.in} | 2 +-
....xml => org.gnome.Weather.src.gresource.xml.in} | 2 +-
src/service/searchProvider.js | 9 ++++++--
14 files changed, 87 insertions(+), 36 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 5ac2163..f6692b6 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -3,16 +3,16 @@ podir = join_paths(meson.source_root(), 'po')
gnome.compile_resources(
- '@0@.data'.format(default_id),
- '@0 data gresource xml'.format(weather_id),
+ '@0@.data'.format(weather_id),
+ '@0 data gresource xml'.format(default_id),
gresource_bundle: true,
install_dir: weather_pkgdatadir,
install: true
)
gnome.compile_resources(
- '@0 BackgroundService data'.format(default_id),
- '@0 BackgroundService data gresource xml'.format(weather_id),
+ '@0 BackgroundService data'.format(weather_id),
+ '@0 BackgroundService data gresource xml'.format(default_id),
gresource_bundle: true,
install_dir: weather_pkgdatadir,
install: true
@@ -57,12 +57,17 @@ endif
# Building app data
appdata_conf = configuration_data()
+appdata_conf.set('app_id', weather_id)
appdata = i18n.merge_file(
'appdata',
- input: '@0 appdata xml in'.format(default_id),
+ input: configure_file(
+ input: '@0 appdata xml in in'.format(default_id),
+ output: '@0 appdata xml in'.format(default_id),
+ configuration: appdata_conf
+ ),
output: '@0 appdata xml'.format(weather_id),
install: true,
- install_dir: join_paths(join_paths('share'), 'metainfo'),
+ install_dir: join_paths(weather_datadir, 'metainfo'),
po_dir: join_paths(meson.source_root(), 'po')
)
@@ -80,6 +85,7 @@ endif
service_conf = configuration_data()
service_conf.set('APP_ID', weather_id)
service_conf.set('DATA_DIR', weather_pkgdatadir)
+service_conf.set('PROFILE', profile)
weather_servicedir = join_paths(weather_datadir, 'dbus-1', 'services')
configure_file(
@@ -99,9 +105,11 @@ configure_file(
)
# Search Provider
-install_data(
- default_id + '.search-provider.ini',
+configure_file(
+ input: '@0 search-provider ini in'.format(default_id),
+ output: '@0 search-provider ini'.format(weather_id),
+ configuration: service_conf,
+ install: true,
install_dir: join_paths(weather_datadir, 'gnome-shell', 'search-providers')
)
-
subdir('icons')
diff --git a/data/org.gnome.Weather.appdata.xml.in b/data/org.gnome.Weather.appdata.xml.in.in
similarity index 94%
rename from data/org.gnome.Weather.appdata.xml.in
rename to data/org.gnome.Weather.appdata.xml.in.in
index 1008b1c..6ee5494 100644
--- a/data/org.gnome.Weather.appdata.xml.in
+++ b/data/org.gnome.Weather.appdata.xml.in.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Giovanni Campagna -->
<component type="desktop">
- <id>org.gnome.Weather</id>
+ <id>@app_id@</id>
<name>Weather</name>
<summary>Show weather conditions and forecast</summary>
<metadata_license>CC0-1.0</metadata_license>
@@ -36,13 +36,14 @@
<image height="555"
width="704">https://gitlab.gnome.org/GNOME/gnome-weather/raw/master/misc/screenshots/world-popover.png</image>
</screenshot>
</screenshots>
- <launchable type="desktop-id">org.gnome.Weather.desktop</launchable>
+ <launchable type="desktop-id">@app_id@.desktop</launchable>
<url type="homepage">https://wiki.gnome.org/Apps/Weather</url>
<url type="bugtracker">https://gitlab.gnome.org/GNOME/gnome-weather/issues</url>
<update_contact>christopherdavis_at_gnome.org</update_contact>
<translation type="gettext">org.gnome.Weather</translation>
<provides>
<id>org.gnome.Weather.Application.desktop</id>
+ <id>org.gnome.Weather.desktop</id>
</provides>
<releases>
<release date="2019-03-11" version="3.32.0"/>
diff --git a/data/org.gnome.Weather.search-provider.ini.in b/data/org.gnome.Weather.search-provider.ini.in
new file mode 100644
index 0000000..0e57c24
--- /dev/null
+++ b/data/org.gnome.Weather.search-provider.ini.in
@@ -0,0 +1,6 @@
+[Shell Search Provider]
+DesktopId=@APP_ID@.desktop
+BusName=@APP_ID@.BackgroundService
+ObjectPath=/org/gnome/Weather@PROFILE@/BackgroundService
+Version=2
+DefaultDisabled=true
diff --git a/meson.build b/meson.build
index a6ad692..c693f53 100644
--- a/meson.build
+++ b/meson.build
@@ -17,10 +17,17 @@ dependency('gweather-3.0', version: '>= 3.28')
# Profiles
if get_option('profile') == 'development'
profile = 'Devel'
- name_suffix = ' (Development)'
+ name_prefix = '(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 = ''
+ name_prefix = ''
+ version_suffix = ''
endif
default_id = 'org.gnome.Weather'
@@ -43,4 +50,5 @@ meson.add_install_script(
weather_datadir,
weather_pkgdatadir,
weather_bindir,
+ weather_id
)
diff --git a/meson_post_install.py b/meson_post_install.py
index 750d76e..77040d7 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -8,11 +8,12 @@ destdir = os.environ.get('DESTDIR', '')
datadir = sys.argv[1]
pkgdatadir = sys.argv[2]
bindir = os.path.join(destdir + os.sep + sys.argv[3])
+app_id = sys.argv[4]
if not os.path.exists(bindir):
os.makedirs(bindir)
-src = os.path.join(pkgdatadir, 'org.gnome.Weather')
+src = os.path.join(pkgdatadir, app_id)
dest = os.path.join(bindir, 'gnome-weather')
subprocess.call(['ln', '-s', '-f', src, dest])
diff --git a/org.gnome.Weather.json b/org.gnome.Weather.json
index 1cfce46..7a4f850 100644
--- a/org.gnome.Weather.json
+++ b/org.gnome.Weather.json
@@ -1,5 +1,5 @@
{
- "app-id" : "org.gnome.Weather",
+ "app-id" : "org.gnome.WeatherDevel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
@@ -30,7 +30,7 @@
"*.la",
"*.a"
],
- "desktop-file-name-prefix": [ "(Development) " ],
+ "desktop-file-name-prefix": "(Development) ",
"modules": [
{
"name" : "geocode-glib",
@@ -78,6 +78,9 @@
{
"name" : "gnome-weather",
"buildsystem" : "meson",
+ "config-opts" : [
+ "-Dprofile=development"
+ ],
"sources" : [
{
"type" : "git",
diff --git a/src/app/main.js b/src/app/main.js
index 799dc71..f5bd75c 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -49,8 +49,13 @@ const Application = GObject.registerClass(
_init() {
super._init({ application_id: pkg.name,
flags: (Gio.ApplicationFlags.CAN_OVERRIDE_APP_ID | Gio.ApplicationFlags.FLAGS_NONE)
});
- GLib.set_application_name(_("Weather"));
- Gtk.Window.set_default_icon_name("org.gnome.Weather");
+
+ let name_prefix = '';
+ if (pkg.name.endsWith('Devel')) {
+ name_prefix = '(Development) ';
+ }
+ GLib.set_application_name(name_prefix + _("Weather"));
+ Gtk.Window.set_default_icon_name(pkg.name);
}
_onQuit() {
diff --git a/src/app/window.js b/src/app/window.js
index 3757dc6..c1bde7c 100644
--- a/src/app/window.js
+++ b/src/app/window.js
@@ -115,6 +115,11 @@ var MainWindow = GObject.registerClass(
for (let i = 0; i < this._pageWidgets[Page.CITY].length; i++)
this._pageWidgets[Page.CITY][i].hide();
+ if (pkg.name.endsWith('Devel')) {
+ let ctx = this.get_style_context();
+ ctx.add_class('devel')
+ }
+
this._showingDefault = false;
}
@@ -235,6 +240,11 @@ var MainWindow = GObject.registerClass(
'Tech Haven Ministries',
'Jim Pennucci' ];
+ let name_prefix = '';
+ if (pkg.name.endsWith('Devel')) {
+ name_prefix = '(Development) ';
+ }
+
let copyright = 'Copyright 2013-2015 The Weather Developers';
let attribution = this._cityView.info ? this._cityView.info.get_attribution() : '';
copyright += attribution ? '\n' + attribution : '';
@@ -242,10 +252,10 @@ var MainWindow = GObject.registerClass(
{ artists: artists,
authors: [ 'Giovanni Campagna <gcampagna src gnome org>' ],
translator_credits: _("translator-credits"),
- program_name: _("Weather"),
+ program_name: name_prefix + _("Weather"),
comments: _("A weather application"),
license_type: Gtk.License.GPL_2_0,
- logo_icon_name: 'org.gnome.Weather',
+ logo_icon_name: pkg.name,
version: pkg.version,
website: 'https://wiki.gnome.org/Apps/Weather',
wrap_license: true,
diff --git a/src/meson.build b/src/meson.build
index c52cf7f..ee2eaf2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,9 +1,11 @@
source_conf = configuration_data()
source_conf.set('GJS', find_program('gjs').path())
-source_conf.set('VERSION', meson.project_version())
+source_conf.set('VERSION', meson.project_version() + version_suffix)
source_conf.set('APP_ID', weather_id)
source_conf.set('libdir', weather_extensiondir)
source_conf.set('prefix', weather_prefix)
+source_conf.set('profile', profile)
+source_conf.set('name_prefix', name_prefix)
application = configure_file(
input: '@0@.in'.format(default_id),
@@ -22,16 +24,24 @@ configure_file(
)
application_sources = gnome.compile_resources(
- '@0@.src'.format(default_id),
- '@0 src gresource xml'.format(default_id),
+ '@0@.src'.format(weather_id),
+ configure_file(
+ input: '@0 src gresource xml in'.format(default_id),
+ output: '@0 src gresource xml'.format(default_id),
+ configuration: source_conf,
+ ),
gresource_bundle: true,
install: true,
install_dir: weather_pkgdatadir
)
gnome.compile_resources(
- '@0 BackgroundService src'.format(default_id),
- '@0 BackgroundService src gresource xml'.format(default_id),
+ '@0 BackgroundService src'.format(weather_id),
+ configure_file(
+ input: '@0 BackgroundService src gresource xml in'.format(default_id),
+ output: '@0 BackgroundService src gresource xml'.format(default_id),
+ configuration: source_conf,
+ ),
gresource_bundle: true,
install: true,
install_dir: weather_pkgdatadir
diff --git a/src/org.gnome.Weather.BackgroundService.in b/src/org.gnome.Weather.BackgroundService.in
index e4029f6..9e44933 100755
--- a/src/org.gnome.Weather.BackgroundService.in
+++ b/src/org.gnome.Weather.BackgroundService.in
@@ -1,5 +1,5 @@
#!@GJS@
-imports.package.init({ name: "@APP_ID",
+imports.package.init({ name: "@APP_ID@",
version: "@VERSION@",
prefix: "@prefix@",
libdir: "@libdir@" });
diff --git a/src/org.gnome.Weather.BackgroundService.src.gresource.xml
b/src/org.gnome.Weather.BackgroundService.src.gresource.xml.in
similarity index 75%
rename from src/org.gnome.Weather.BackgroundService.src.gresource.xml
rename to src/org.gnome.Weather.BackgroundService.src.gresource.xml.in
index d4dcd96..74aedf0 100644
--- a/src/org.gnome.Weather.BackgroundService.src.gresource.xml
+++ b/src/org.gnome.Weather.BackgroundService.src.gresource.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/Weather/BackgroundService/js">
+ <gresource prefix="/org/gnome/Weather@profile@/BackgroundService/js">
<file>service/main.js</file>
<file>service/searchProvider.js</file>
<file>misc/util.js</file>
diff --git a/src/org.gnome.Weather.src.gresource.xml b/src/org.gnome.Weather.src.gresource.xml.in
similarity index 87%
rename from src/org.gnome.Weather.src.gresource.xml
rename to src/org.gnome.Weather.src.gresource.xml.in
index da8b0aa..7234183 100644
--- a/src/org.gnome.Weather.src.gresource.xml
+++ b/src/org.gnome.Weather.src.gresource.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/Weather/js">
+ <gresource prefix="/org/gnome/Weather@profile@/js">
<file>app/city.js</file>
<file>app/currentLocationController.js</file>
<file>app/forecast.js</file>
diff --git a/src/service/searchProvider.js b/src/service/searchProvider.js
index 296b8a6..8936afb 100644
--- a/src/service/searchProvider.js
+++ b/src/service/searchProvider.js
@@ -203,8 +203,13 @@ var SearchProvider = class WeatherSearchProvider {
else
wrappedParam = [];
- Gio.DBus.session.call('org.gnome.Weather',
- '/org/gnome/Weather',
+ profile = '';
+ if (pkg.name.endsWith('Devel')) {
+ profile = 'Devel';
+ }
+
+ Gio.DBus.session.call(pkg.name,
+ '/org/gnome/Weather' + profile,
'org.freedesktop.Application',
'ActivateAction',
new GLib.Variant('(sava{sv})', [action, wrappedParam,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]