[meld] Rework meson build with top-level path variables



commit d69b0eee655f2541a1e695c46b23308e348df636
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Sep 21 09:25:02 2019 +1000

    Rework meson build with top-level path variables

 data/icons/meson.build | 11 ------
 data/meson.build       | 90 ++++++++++++++++++++++++++------------------------
 gettext/its/mime.its   |  7 ++++
 gettext/its/mime.loc   |  7 ++++
 meson.build            | 22 ++++++++++--
 5 files changed, 80 insertions(+), 57 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 4f91b9cc..10aed2ee 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,12 +1,20 @@
+
+# Install schema file
+install_data(
+  '@0  gschema xml'.format(application_id),
+  install_dir: schemadir
+)
+
 # Install desktop file
 desktop_file = i18n.merge_file(
   input: '@0  desktop in'.format(application_id),
   output: '@0@.desktop'.format(application_id),
-  po_dir: join_paths(meson.source_root(), 'po'),
+  po_dir: podir,
   type: 'desktop',
   install: true,
-  install_dir: join_paths(get_option('datadir'), 'applications')
+  install_dir: desktopdir,
 )
+
 # Validate Desktop file
 desktop_file_validate = find_program('desktop-file-validate', required: false)
 if desktop_file_validate.found()
@@ -16,18 +24,20 @@ if desktop_file_validate.found()
     args: desktop_file.full_path()
   )
 endif
+
 # Install AppData file
 appdata_file = i18n.merge_file(
   input: '@0  appdata xml in'.format(application_id),
   output: '@0  appdata xml'.format(application_id),
-  po_dir: join_paths(meson.source_root(), 'po'),
+  po_dir: podir,
   install: true,
-  install_dir: join_paths(get_option('datadir'), 'appdata')
+  install_dir: appdatadir,
 )
+
 # Validate AppData file
 appstreamcli = find_program('appstream-util', required: false)
 if appstreamcli.found()
-  test (
+  test(
     'Validate appdata file',
     appstreamcli,
     args: [
@@ -36,56 +46,48 @@ if appstreamcli.found()
      ]
   )
 endif
-# Install Schehma file
-install_data(
-  '@0  gschema xml'.format(application_id),
-  install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+
+# Install mimetypes
+appdata_file = i18n.merge_file(
+  input: join_paths('mime', '@0  xml in'.format(application_id)),
+  output: '@0@.xml'.format(application_id),
+  po_dir: podir,
+  data_dirs: itsdir,
+  install: true,
+  install_dir: mimedatadir,
 )
+
 # Install CSS file
 install_data(
     [
         files('meld.css')
     ],
-    install_dir: join_paths(get_option('datadir'), meson.project_name())
+    install_dir: join_paths(pkgdatadir)
 )
-# Install the UI files
-install_data(
-    [
-        'ui/application.ui',
-        'ui/appmenu-fallback.xml',
-        'ui/dirdiff-ui.xml',
-        'ui/dirdiff.ui',
-        'ui/EditableList.ui',
-        'ui/encoding-selector.ui',
-        'ui/filediff-ui.xml',
-        'ui/filediff.ui',
-        'ui/findbar.ui',
-        'ui/language-selector.ui',
-        'ui/meldapp-ui.xml',
-        'ui/meldapp.ui',
-        'ui/patch-dialog.ui',
-        'ui/preferences.ui',
-        'ui/shortcuts.ui',
-        'ui/tab-placeholder.ui',
-        'ui/vcview-ui.xml',
-        'ui/vcview.ui'
-    ],
-    install_dir: join_paths(get_option('datadir'), meson.project_name(), 'ui')
-)
-# Install the styles files
+
+# Install GtkSourceview style files
 install_data(
     [
         'styles/meld-base.xml',
         'styles/meld-dark.xml'
     ],
-    install_dir: join_paths(get_option('datadir'), meson.project_name(), 'styles')
+    install_dir: join_paths(pkgdatadir, 'styles')
 )
-# Install the mimetypes
-appdata_file = i18n.merge_file(
-  input: join_paths('mime', '@0  xml in'.format(application_id)),
-  output: '@0@.xml'.format(application_id),
-  po_dir: join_paths(meson.source_root(), 'po'),
-  install: true,
-  install_dir: join_paths(get_option('datadir'), 'mime', 'packages')
+
+# Install icons
+icon_sizes = ['scalable']
+
+foreach i : icon_sizes
+  install_data(
+    join_paths('icons/hicolor', i , 'apps', application_id + '.svg'),
+    install_dir: join_paths(icondir, 'hicolor', i , 'apps'),
+    rename: '@0@.svg'.format(application_id)
+  )
+endforeach
+
+# Install the symbolic icon
+install_data(
+    join_paths('icons/hicolor/symbolic/apps', application_id + '-symbolic.svg'),
+    install_dir: join_paths(icondir, 'hicolor', 'symbolic', 'apps'),
+    rename: '@0 -symbolic svg'.format(application_id)
 )
-subdir('icons')
\ No newline at end of file
diff --git a/gettext/its/mime.its b/gettext/its/mime.its
new file mode 100644
index 00000000..f058c537
--- /dev/null
+++ b/gettext/its/mime.its
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<its:rules xmlns:its="http://www.w3.org/2005/11/its";
+           version="2.0">
+  <its:translateRule selector="/mime-info" translate="no"/>
+  <its:translateRule selector="//comment" translate="yes"/>
+</its:rules>
+
diff --git a/gettext/its/mime.loc b/gettext/its/mime.loc
new file mode 100644
index 00000000..20d63f5e
--- /dev/null
+++ b/gettext/its/mime.loc
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<locatingRules>
+  <locatingRule name="mime" pattern="*.xml">
+    <documentRule localName="mime-info" target="mime.its"/>
+  </locatingRule>
+</locatingRules>
+
diff --git a/meson.build b/meson.build
index 48abafe0..cbb3e64b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,8 @@
-project('meld', version: '3.19.1',
-    meson_version: '>=0.46.0')
+project(
+    'meld',
+    version: '3.21.0',
+    meson_version: '>=0.46.0',
+)
 
 application_id = 'org.gnome.meld'
 
@@ -16,7 +19,22 @@ dependency('gtk+-3.0', version: '>= 3.20')
 dependency('glib-2.0', version: '>= 2.48')
 dependency('gtksourceview-3.0', version: '>= 3.20.0')
 
+prefix = get_option('prefix')
+
+bindir = join_paths(prefix, get_option('bindir'))
+datadir = join_paths(prefix, get_option('datadir'))
+libexecdir = join_paths(prefix, get_option('libexecdir'))
+localedir = join_paths(prefix, get_option('localedir'))
+
+appdatadir = join_paths(datadir, 'metainfo')
+desktopdir = join_paths(datadir, 'applications')
+icondir = join_paths(datadir, 'icons')
+mimedatadir = join_paths(datadir, 'mime', 'packages')
+pkgdatadir = join_paths(datadir, meson.project_name())
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
 
+itsdir = join_paths(meson.current_source_dir(), 'gettext')
+podir = join_paths(meson.current_source_dir(), 'po')
 
 subdir('data')
 subdir('help')


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