[gnome-weather] meson: Fix things missed in review



commit 09eb0546342fff99196f66963c648dc839b700f4
Author: Christopher Davis <brainblasted disroot org>
Date:   Sun Jan 27 01:51:02 2019 -0500

    meson: Fix things missed in review
    
    * Define DATA_DIR correctly
    * pkgdatadir is no longer used
    * remove icons/Makefile.am
    * Properly format extra tags for .desktop file
    * Install data to correct directory & icons
    * Use APP_ID instead of PACKAGE_NAME for services

 data/icons/Makefile.am                             | 24 ---------------
 data/icons/meson.build                             |  2 +-
 data/meson.build                                   | 34 +++++++++++++---------
 ...=> org.gnome.Weather.Application.desktop.in.in} |  4 +--
 data/org.gnome.Weather.Application.service.in      |  4 +--
 .../org.gnome.Weather.BackgroundService.service.in |  4 +--
 meson.build                                        |  1 -
 src/meson.build                                    |  9 ++++--
 8 files changed, 35 insertions(+), 47 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
index d247f3e..67dea9e 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -1,4 +1,4 @@
-datadir = join_paths('share', 'icons')
+datadir = join_paths(get_option('datadir'), 'icons')
 icondir = join_paths('hicolor', 'scalable', 'apps')
 if get_option('profile') == 'development'
 install_data (
diff --git a/data/meson.build b/data/meson.build
index f9147aa..4a7f2c2 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,10 +1,9 @@
 gnome = import('gnome')
+podir = join_paths(meson.source_root(), 'po')
 
 data_conf = configuration_data()
-data_conf.set('application_id', application_id)
-data_conf.set('PACKAGE_NAME', meson.project_name())
+data_conf.set('APP_ID', application_id)
 data_conf.set('DATA_DIR', DATA_DIR)
-data_conf.set('pkgdatadir', pkgdatadir)
 
 message('Compiling resources')
 
@@ -33,15 +32,24 @@ install_data(
 )
 
 # Building desktop file
+msgfmt = find_program('msgfmt')
 desktop_conf = configuration_data()
-desktop = i18n.merge_file(
-       'desktop',
-       input: application_id_stable + '.Application.desktop.in',
-       output: application_id + '.Application.desktop',
-       po_dir: join_paths(meson.source_root(), 'po'),
-       type: 'desktop',
-       install: true,
-       install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'applications')
+desktop_conf.set('APP_ID', application_id)
+desktop = custom_target(
+  'desktop-file',
+  input: configure_file(
+    input: '@0  Application desktop in in'.format(application_id_stable),
+    output: '@0  Application desktop in'.format(application_id_stable),
+    configuration: desktop_conf,
+  ),
+  output: '@0@.Application.desktop'.format(application_id),
+  install: true,
+  install_dir: join_paths(get_option('datadir'), 'applications'),
+  command: [msgfmt, '--desktop',
+    '--template', '@INPUT@', '-d', podir, '-o', '@OUTPUT@',
+    '--keyword=X-Geoclue-Reason',
+    '--keyword=Name', '--keyword=Comment', '--keyword=Keywords'
+  ]
 )
 
 # Validating desktop file
@@ -71,7 +79,7 @@ configure_file(
        output: application_id + '.Application.service',
        configuration: data_conf,
        install: true,
-       install_dir: join_paths(DATA_DIR, 'dbus-1', 'services')
+       install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services')
 )
 
 configure_file(
@@ -79,7 +87,7 @@ configure_file(
        output: application_id + '.BackgroundService.service',
        configuration: data_conf,
        install: true,
-       install_dir: join_paths(DATA_DIR, 'dbus-1', 'services')
+       install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services')
 )
 
 # Search Provider
diff --git a/data/org.gnome.Weather.Application.desktop.in b/data/org.gnome.Weather.Application.desktop.in.in
similarity index 77%
rename from data/org.gnome.Weather.Application.desktop.in
rename to data/org.gnome.Weather.Application.desktop.in.in
index ed3b9a2..4adb6bc 100644
--- a/data/org.gnome.Weather.Application.desktop.in
+++ b/data/org.gnome.Weather.Application.desktop.in.in
@@ -2,8 +2,8 @@
 Type=Application
 Name=Weather
 Comment=Show weather conditions and forecast
-Icon=org.gnome.Weather
-Exec=gapplication launch org.gnome.Weather.Application
+Icon=@APP_ID@
+Exec=gapplication launch @APP_ID@.Application
 DBusActivatable=true
 StartupNotify=true
 Categories=GNOME;GTK;Utility;Core;
diff --git a/data/org.gnome.Weather.Application.service.in b/data/org.gnome.Weather.Application.service.in
index 966e758..b1d9729 100644
--- a/data/org.gnome.Weather.Application.service.in
+++ b/data/org.gnome.Weather.Application.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
-Name=@PACKAGE_NAME@.Application
-Exec=@pkgdatadir@/@PACKAGE_NAME@.Application --gapplication-service
+Name=@APP_ID@.Application
+Exec=@DATA_DIR@/@APP_ID@.Application --gapplication-service
diff --git a/data/org.gnome.Weather.BackgroundService.service.in 
b/data/org.gnome.Weather.BackgroundService.service.in
index 484a690..72d6e70 100644
--- a/data/org.gnome.Weather.BackgroundService.service.in
+++ b/data/org.gnome.Weather.BackgroundService.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
-Name=@PACKAGE_NAME@.BackgroundService
-Exec=@pkgdatadir@/@PACKAGE_NAME@.BackgroundService
+Name=@APP_ID@.BackgroundService
+Exec=@DATA_DIR@/@APP_ID@.BackgroundService
diff --git a/meson.build b/meson.build
index 0bfef04..cf5653d 100644
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,6 @@ LIBEXEC_DIR = join_paths(get_option('prefix'), get_option('libexecdir'))
 EXTENSION_DIR = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name())
 DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), application_id)
 BIN_DIR = join_paths(get_option('prefix'), get_option('bindir'))
-pkgdatadir = join_paths(DATA_DIR, meson.project_name())
 
 # Profiles
 if get_option('profile') == 'development'
diff --git a/src/meson.build b/src/meson.build
index 3bce183..90cfd5c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -5,7 +5,7 @@ source_conf.set('PACKAGE_VERSION', meson.project_version())
 source_conf.set('libdir', EXTENSION_DIR)
 source_conf.set('prefix', prefix)
 
-configure_file(
+application = configure_file(
        input: application_id_stable + '.Application.in',
        output: application_id + '.Application',
        configuration: source_conf,
@@ -21,7 +21,7 @@ configure_file(
        install_dir: DATA_DIR
 )
 
-gnome.compile_resources(
+application_sources = gnome.compile_resources(
        application_id_stable + '.Application.src',
        application_id_stable + '.Application.src.gresource.xml',
        gresource_bundle: true,
@@ -36,3 +36,8 @@ gnome.compile_resources(
        install: true,
        install_dir: DATA_DIR
 )
+
+run_target('run',
+  command: application,
+  depends: application_sources
+)


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