File fix-meson-build.patch of Package tilix

From 776019ed1b98d2b573e7040f9f6acef26d92d389 Mon Sep 17 00:00:00 2001
From: Matthias Eliasson <matthias.eliasson@gmail.com>
Date: Sat, 6 Jun 2020 00:32:04 +0200
Subject: [PATCH] Make tilix build with meson

---
 .gitignore                        |   2 -
 data/man/meson.build              |   1 +
 data/man/{tilix => tilix.1}       |   0
 data/meson.build                  |  61 +++++++-------
 data/scripts/install-man-pages.sh |  24 ++++++
 meson.build                       | 133 +++++++++++++++---------------
 meson_post_install.py             |   4 +-
 po/LINGUAS                        |  32 +++++++
 8 files changed, 160 insertions(+), 97 deletions(-)
 create mode 100644 data/man/meson.build
 rename data/man/{tilix => tilix.1} (100%)
 create mode 100644 data/scripts/install-man-pages.sh
 create mode 100644 po/LINGUAS

diff --git a/.gitignore b/.gitignore
index a372875b..5111a71e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,5 +50,3 @@ po/remove-potcdate.sin
 po/stamp-po
 po/*.gmo
 po/remove-potcdate.sed
-# Generated/Updated by install.sh and autogen.sh
-po/LINGUAS
diff --git a/data/man/meson.build b/data/man/meson.build
new file mode 100644
index 00000000..1681e5cb
--- /dev/null
+++ b/data/man/meson.build
@@ -0,0 +1 @@
+install_man('tilix')
\ No newline at end of file
diff --git a/data/man/tilix b/data/man/tilix.1
similarity index 100%
rename from data/man/tilix
rename to data/man/tilix.1
diff --git a/data/meson.build b/data/meson.build
index 4fdc6ea3..69571b54 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,14 +1,26 @@
-
 # install the icons
 install_data(
     'icons/hicolor/scalable/apps/@0@.svg'.format(meson.project_name()),
-    install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps')
+    install_dir: iconsdir / 'scalable' / 'apps'
 )
 install_data(
     'icons/hicolor/scalable/apps/@0@-symbolic.svg'.format(meson.project_name()),
-    install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps')
+    install_dir: iconsdir / 'symbolic' / 'apps'
 )
 
+# Install the desktop file
+desktop_file = i18n.merge_file(
+    '@0@.desktop'.format(meson.project_name()),
+    output: '@BASENAME@',
+    input: 'pkg/desktop/@0@.desktop.in'.format(meson.project_name()),
+    po_dir: meson.source_root() / 'po',
+    type: 'desktop',
+    install: true,
+    install_dir: appdir
+)
+
+# Install manual page
+install_man(['man/tilix.1'])
 
 # Validate desktop file
 desktop_file_validate = find_program('desktop-file-validate', required:false)
@@ -16,18 +28,18 @@ if desktop_file_validate.found()
   test (
     'Validate desktop file',
     desktop_file_validate,
-    args: join_paths(meson.current_build_dir (), '@0@.desktop'.format(meson.project_name()))
+    args: desktop_file.full_path()
   )
 endif
 
-# Install the desktop file
-i18n.merge_file(
-    output: '@0@.desktop'.format(meson.project_name()),
-    input: 'pkg/desktop/@0@.desktop.in'.format(meson.project_name()),
-    po_dir: join_paths(meson.source_root(), 'po'),
-    type: 'desktop',
+# Install the AppData file
+appdata_file = i18n.merge_file(
+    '@0@.appdata.xml'.format(meson.project_name()),
+    output: '@BASENAME@',
+    input: 'appdata/@0@.appdata.xml.in'.format(meson.project_name()),
+    po_dir: meson.source_root() / 'po',
     install: true,
-    install_dir: join_paths(get_option('datadir'), 'applications')
+    install_dir: datadir / 'metainfo'
 )
 
 # Validate AppData file
@@ -36,19 +48,10 @@ if appstream_util.found()
   test (
     'Validate appdata file',
     appstream_util,
-    args: ['validate-relax', '--nonet', join_paths(meson.current_build_dir (), '@0@.appdata.xml'.format(meson.project_name()))]
+    args: ['validate-relax', '--nonet', appdata_file.full_path()]
   )
 endif
 
-# Install the AppData file
-i18n.merge_file(
-    output: '@0@.appdata.xml'.format(meson.project_name()),
-    input: 'appdata/@0@.appdata.xml.in'.format(meson.project_name()),
-    po_dir: join_paths(meson.source_root(), 'po'),
-    install: true,
-    install_dir: join_paths(get_option('datadir'), 'metainfo')
-)
-
 # Build resources
 gresource = gnome.compile_resources(
     'tilix',
@@ -56,13 +59,13 @@ gresource = gnome.compile_resources(
     gresource_bundle: true,
     install: true,
     source_dir: 'resources/',
-    install_dir: join_paths(get_option('datadir'), 'tilix/resources')
+    install_dir: pkgdatadir / 'resources'
 )
 
 # Install GSchemas
 install_data(
   'gsettings/@0@.gschema.xml'.format(meson.project_name()),
-  install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
+  install_dir: schemadir
 )
 
 # Color schemes
@@ -77,28 +80,28 @@ install_data(
         'schemes/solarized-light.json',
         'schemes/tango.json',
     ],
-    install_dir: join_paths(get_option('datadir'), 'tilix/schemes')
+    install_dir: pkgdatadir / 'schemes'
 )
 
 # Scripts
 install_data(
     'scripts/tilix_int.sh',
-    install_dir: join_paths(get_option('datadir'), 'tilix/scripts')
+    install_dir: pkgdatadir / 'scripts'
 )
 
 # Copying Nautilus extension
 install_data(
     'nautilus/open-tilix.py',
-    install_dir: join_paths(get_option('datadir'), 'nautilus-python/extensions')
+    install_dir: datadir / 'nautilus-python' / 'extensions'
 )
 
 # Copy D-Bus service descriptor
 conf = configuration_data()
-conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
+conf.set('bindir', bindir)
 
 configure_file(
   input: 'dbus/@0@.service.in'.format(meson.project_name()),
-  output: 'dbus/@0@.service'.format(meson.project_name()),
+  output: '@BASENAME@',
   configuration: conf,
-  install_dir: join_paths(get_option('datadir'), 'dbus-1/services')
+  install_dir: datadir / 'dbus-1' / 'services'
 )
diff --git a/data/scripts/install-man-pages.sh b/data/scripts/install-man-pages.sh
new file mode 100644
index 00000000..ac354fa4
--- /dev/null
+++ b/data/scripts/install-man-pages.sh
@@ -0,0 +1,24 @@
+#!/bin/env sh
+
+# Determine PREFIX.
+if [ -z "$1" ]; then
+    if [ -n "$PREFIX" ]; then
+        PREFIX='/usr'
+    fi
+else
+    PREFIX="$1"
+fi
+export PREFIX
+
+echo "Installing man pages"
+install -Dm 644 'data/man/tilix' "$PREFIX/share/man/man1/tilix.1"
+gzip -f "$PREFIX/share/man/man1/tilix.1"
+
+if type po4a-translate >/dev/null 2>&1; then
+    for f in data/man/po/*.man.po; do
+        LOCALE=$(basename "$f" .man.po)
+        install -d "$PREFIX/share/man/$LOCALE/man1"
+        po4a-translate -k 0 -f man -m data/man/tilix -p "data/man/po/$LOCALE.man.po" -l "$PREFIX/share/man/$LOCALE/man1/tilix.1"
+        gzip -f "$PREFIX/share/man/$LOCALE/man1/tilix.1"
+    done
+fi
diff --git a/meson.build b/meson.build
index feff315a..b83d72b3 100644
--- a/meson.build
+++ b/meson.build
@@ -1,20 +1,17 @@
 project(
     'com.gexperts.Tilix', 'd',
-    version: '1.8.5',
+    version: '1.9.3',
     license: 'MPL2',
-    meson_version: '>= 0.48.0'
+    default_options: 'buildtype=debugoptimized',
+    meson_version: '>= 0.50.0'
 )
 
 compiler = meson.get_compiler('d')
 
 message('Using compiler ' + compiler.get_id())
 
-if compiler.get_id() == 'gcc'
-    error('Tilix can not be compiled with GDC at time, since the standard library version of all GDC versions is currently (2016) too old. Sorry.')
-endif
-
- if compiler.get_id() == 'llvm'
-  extra_args = ['-vcolumns','-d-version=StdLoggerDisableTrace']
+if compiler.get_id() == 'llvm'
+  extra_args = ['-vcolumns']
   d_link_args = []
 else
   extra_args = []
@@ -24,84 +21,88 @@ endif
 gnome = import('gnome')
 i18n = import('i18n')
 
+prefix = get_option('prefix')
+bindir = prefix / get_option('bindir')
+datadir = prefix / get_option('datadir')
+pkgdatadir = datadir / 'tilix' # TODO: this probably should be meson.project_name() eventually
+schemadir = datadir / 'glib-2.0' / 'schemas'
+iconsdir = datadir / 'icons' / 'hicolor'
+appdir = datadir / 'applications'
+
 tilix_sources = [
-    'source/secretc/secrettypes.d',
-    'source/secretc/secret.d',
-    'source/app.d',
-    'source/x11/X.d',
-    'source/x11/Xlib.d',
-    'source/secret/SchemaAttribute.d',
-    'source/secret/Item.d',
-    'source/secret/Schema.d',
-    'source/secret/Service.d',
-    'source/secret/Prompt.d',
-    'source/secret/Collection.d',
-    'source/secret/Secret.d',
-    'source/secret/Value.d',
-    'source/gx/util/array.d',
-    'source/gx/util/path.d',
-    'source/gx/util/string.d',
+    'source/gx/gtk/actions.d',
     'source/gx/gtk/cairo.d',
     'source/gx/gtk/clipboard.d',
-    'source/gx/gtk/x11.d',
-    'source/gx/gtk/resource.d',
-    'source/gx/gtk/vte.d',
-    'source/gx/gtk/actions.d',
-    'source/gx/gtk/threads.d',
+    'source/gx/gtk/color.d',
     'source/gx/gtk/dialog.d',
+    'source/gx/gtk/resource.d',
     'source/gx/gtk/settings.d',
+    'source/gx/gtk/threads.d',
     'source/gx/gtk/util.d',
-    'source/gx/gtk/color.d',
-    'source/gx/tilix/appwindow.d',
-    'source/gx/tilix/terminal/advpaste.d',
-    'source/gx/tilix/terminal/search.d',
-    'source/gx/tilix/terminal/regex.d',
+    'source/gx/gtk/vte.d',
+    'source/gx/gtk/x11.d',
+    'source/gx/i18n/l10n.d',
+    'source/gx/tilix/bookmark/bmchooser.d',
+    'source/gx/tilix/bookmark/bmeditor.d',
+    'source/gx/tilix/bookmark/bmtreeview.d',
+    'source/gx/tilix/bookmark/manager.d',
+    'source/gx/tilix/prefeditor/advdialog.d',
+    'source/gx/tilix/prefeditor/bookmarkeditor.d',
+    'source/gx/tilix/prefeditor/common.d',
+    'source/gx/tilix/prefeditor/prefdialog.d',
+    'source/gx/tilix/prefeditor/profileeditor.d',
+    'source/gx/tilix/prefeditor/titleeditor.d',
     'source/gx/tilix/terminal/actions.d',
     'source/gx/tilix/terminal/activeprocess.d',
-    'source/gx/tilix/terminal/terminal.d',
+    'source/gx/tilix/terminal/advpaste.d',
+    'source/gx/tilix/terminal/exvte.d',
     'source/gx/tilix/terminal/layout.d',
+    'source/gx/tilix/terminal/monitor.d',
     'source/gx/tilix/terminal/password.d',
+    'source/gx/tilix/terminal/regex.d',
+    'source/gx/tilix/terminal/search.d',
+    'source/gx/tilix/terminal/terminal.d',
     'source/gx/tilix/terminal/util.d',
-    'source/gx/tilix/terminal/exvte.d',
-    'source/gx/tilix/terminal/monitor.d',
-    'source/gx/tilix/sidebar.d',
-    'source/gx/tilix/customtitle.d',
-    'source/gx/tilix/prefeditor/bookmarkeditor.d',
-    'source/gx/tilix/prefeditor/profileeditor.d',
-    'source/gx/tilix/prefeditor/common.d',
-    'source/gx/tilix/prefeditor/prefdialog.d',
-    'source/gx/tilix/prefeditor/titleeditor.d',
-    'source/gx/tilix/prefeditor/advdialog.d',
-    'source/gx/tilix/preferences.d',
     'source/gx/tilix/application.d',
-    'source/gx/tilix/shortcuts.d',
+    'source/gx/tilix/appwindow.d',
+    'source/gx/tilix/closedialog.d',
+    'source/gx/tilix/cmdparams.d',
     'source/gx/tilix/colorschemes.d',
-    'source/gx/tilix/session.d',
-    'source/gx/tilix/constants.d',
     'source/gx/tilix/common.d',
-    'source/gx/tilix/cmdparams.d',
+    'source/gx/tilix/constants.d',
+    'source/gx/tilix/customtitle.d',
     'source/gx/tilix/encoding.d',
-    'source/gx/tilix/closedialog.d',
-    'source/gx/tilix/bookmark/manager.d',
-    'source/gx/tilix/bookmark/bmchooser.d',
-    'source/gx/tilix/bookmark/bmeditor.d',
-    'source/gx/tilix/bookmark/bmtreeview.d',
-    'source/gx/i18n/l10n.d'
+    'source/gx/tilix/preferences.d',
+    'source/gx/tilix/session.d',
+    'source/gx/tilix/shortcuts.d',
+    'source/gx/tilix/sidebar.d',
+    'source/gx/util/array.d',
+    'source/gx/util/path.d',
+    'source/gx/util/string.d',
+    'source/secret/Collection.d',
+    'source/secret/Item.d',
+    'source/secret/Prompt.d',
+    'source/secret/Schema.d',
+    'source/secret/SchemaAttribute.d',
+    'source/secret/Secret.d',
+    'source/secret/Service.d',
+    'source/secret/Value.d',
+    'source/secretc/secret.d',
+    'source/secretc/secrettypes.d',
+    'source/x11/X.d',
+    'source/x11/Xlib.d',
+    'source/app.d'
 ]
 
 source_root = meson.source_root()
 sources_dir = include_directories('source/')
 
 # Dependencies
-# Note relying on dub to fetch and build dependencies before running meson build is temporary due to a bug in Meson 0.48
-# gtkd_dep = dependency('gtkd-3', version: '>= 3.8.5')
-# vted_dep = dependency('vted-3', version: '>= 3.8.5')
-
-gtkd_dep = dependency('gtk-d:gtkd', version: '>=3.8.5', method: 'dub')
-vted_dep = dependency('gtk-d:vte', version: '>=3.8.5', method: 'dub')
+gtkd_dep = dependency('gtkd-3', version: '>=3.8.5')
+vted_dep = dependency('vted-3', version: '>=3.8.5')
 xlib_dep = dependency('x11')
 libunwind_dep = dependency('libunwind')
-msgfmt = find_program('msgfmt')
+libsecret_dep = dependency('libsecret-1', required: false)
 
 subdir('po')
 subdir('data')
@@ -113,8 +114,10 @@ executable('tilix',
     dependencies : [gtkd_dep,
                     vted_dep,
                     xlib_dep,
-                    libunwind_dep],
+                    libunwind_dep,
+                    libsecret_dep],
     d_args: extra_args,
+    d_module_versions: ['StdLoggerDisableTrace'],
     link_args: d_link_args,
     install : true
 )
@@ -130,4 +133,4 @@ executable('tilix',
 #)
 #test('tilix_test', tilix_test_exe)
 
-meson.add_install_script('meson_post_install.py')
\ No newline at end of file
+meson.add_install_script('meson_post_install.py')
diff --git a/meson_post_install.py b/meson_post_install.py
index b5f7b3d7..1d4c91bb 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -8,4 +8,6 @@ if not environ.get('DESTDIR', ''):
     print('Updating icon cache...')
     call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
     print("compiling new schemas")
-    call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas/')])
\ No newline at end of file
+    call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas/')])
+    print("Updating desktop database")
+    call(["update-desktop-database", path.join(DATA_DIR, 'applications')])
\ No newline at end of file
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 00000000..d569cef7
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1,32 @@
+ak
+ar_MA
+ar
+bg
+cs
+de
+el
+en
+eo
+es
+fi
+fr
+he
+hu
+id
+it
+ja
+ko
+it
+nb_NO
+nl
+pl
+pt_BR
+pt_PT
+ru
+sr
+sv
+tr
+uk
+vi
+zh_CN
+zh_TW
\ No newline at end of file
-- 
2.26.2

openSUSE Build Service is sponsored by