[gnome-terminal] build: Replace autotools with meson



commit 79ed7130dcc10ae72d8c598186eb8e53ec805a78
Author: Christian Persch <chpe src gnome org>
Date:   Tue Feb 23 22:34:11 2021 +0100

    build: Replace autotools with meson
    
    Re-done from scratch.

 ChangeLog.README                                   |   16 -
 ChangeLog.pre-2-23                                 | 4754 --------------------
 HACKING                                            |   13 -
 Makefile.am                                        |   89 -
 Makefile.meson                                     |   43 +
 NEWS                                               |  803 ----
 acinclude.m4                                       |  289 --
 autogen.sh                                         |   14 -
 configure.ac                                       |  341 --
 data/Makefile.am                                   |    3 -
 data/icons/Makefile.am                             |   53 -
 data/icons/meson.build                             |   46 +
 data/icons/meson_updateiconcache.py                |   28 +
 data/meson.build                                   |   60 +
 data/meson_desktopfile.py                          |   28 +
 .../org.gnome.Terminal.Nautilus.metainfo.xml.in    |    2 +-
 .../org.gnome.Terminal.desktop.in                  |    1 -
 .../org.gnome.Terminal.metainfo.xml.in             |    0
 data/ui-filter-mnemonics.xslt                      |   30 +
 data/ui-filter-no-mnemonics.xslt                   |   30 +
 git.mk                                             |  227 -
 help/LINGUAS                                       |   17 +
 help/Makefile.am                                   |   51 -
 help/meson.build                                   |   62 +
 man/Makefile.am                                    |   18 -
 man/meson.build                                    |   36 +
 meson.build                                        |  320 ++
 meson_options.txt                                  |   43 +
 po/Makevars                                        |   78 -
 po/POTFILES.in                                     |   16 +-
 po/meson.build                                     |   19 +
 src/Makefile.am                                    |  354 --
 src/gnome-terminal-server.service.in               |   10 +
 src/meson.build                                    |  410 ++
 src/meson_compileschemas.py                        |   28 +
 src/nautilus.map                                   |    9 +
 src/nautilus.symbols                               |    3 -
 src/org.gnome.Terminal.service.in                  |    4 +
 38 files changed, 1231 insertions(+), 7117 deletions(-)
---
diff --git a/Makefile.meson b/Makefile.meson
new file mode 100644
index 00000000..1336417f
--- /dev/null
+++ b/Makefile.meson
@@ -0,0 +1,43 @@
+# Copyright © 2019 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+srcdir=@srcdir@
+builddir=@builddir@
+
+#
+
+NTHREADS = 1
+NJOBS = -j$(NTHREADS)
+NINJA = ninja $(NJOBS)
+
+#
+
+all:
+       $(NINJA)
+
+check:
+       MESON_TESTTHREADS=$(NTHREADS) $(NINJA) test
+
+clean:
+       $(NINJA) clean
+
+coverage:
+       $(NINJA) coverage
+
+install:
+       $(NINJA) install
+
+uninstall:
+       $(NINJA) uninstall
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 00000000..388ef145
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,46 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+public_icons_themes = [
+  'hicolor',
+]
+
+public_icons_sources = [
+  'hicolor_apps_scalable_org.gnome.Terminal.svg',
+  'hicolor_apps_symbolic_org.gnome.Terminal-symbolic.svg',
+]
+
+public_icons_renames = []
+
+foreach icon : public_icons_sources
+  components = icon.split('_')
+  public_icons_renames += components[0] / components[2] / components[1] / components[3]
+endforeach
+
+icondir = gt_datadir / 'icons'
+pkgicondir = gt_pkgdatadir / 'icons'
+
+install_data(
+  sources: public_icons_sources,
+  rename: public_icons_renames,
+  install_dir: icondir,
+)
+
+foreach theme : public_icons_themes
+  meson.add_install_script(
+    'meson_updateiconcache.py',
+    icondir / theme,
+  )
+endforeach
diff --git a/data/icons/meson_updateiconcache.py b/data/icons/meson_updateiconcache.py
new file mode 100755
index 00000000..b625d073
--- /dev/null
+++ b/data/icons/meson_updateiconcache.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+# Copyright © 2019 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import subprocess
+import sys
+
+if os.environ.get('DESTDIR'):
+    sys.exit(0)
+
+prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(prefix, sys.argv[1])
+
+rv = subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+sys.exit(0)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..79d97e5b
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,60 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+# Appstream data
+
+metainfodir = gt_datadir / 'metainfo'
+
+i18n.merge_file(
+  gt_dns_name + '.metainfo.xml',
+  input: gt_dns_name + '.metainfo.xml.in',
+  output: '@BASENAME@',
+  po_dir: po_dir,
+  install: true,
+  install_dir: gt_prefix / metainfodir,
+)
+
+i18n.merge_file(
+  gt_dns_name + '.Nautilus.metainfo.xml',
+  input: gt_dns_name + '.Nautilus.metainfo.xml.in',
+  output: '@BASENAME@',
+  po_dir: po_dir,
+  install: true,
+  install_dir: gt_prefix / metainfodir,
+)
+
+# Desktop file
+
+desktopdatadir = gt_datadir / 'applications'
+
+i18n.merge_file(
+  gt_dns_name + '.desktop',
+  input: gt_dns_name + '.desktop.in',
+  output: '@BASENAME@',
+  type: 'desktop',
+  po_dir: po_dir,
+  install: true,
+  install_dir: desktopdatadir,
+)
+
+meson.add_install_script(
+  'meson_desktopfile.py',
+  desktopdatadir,
+  gt_dns_name + '.desktop',
+)
+
+# Subdirs
+
+subdir('icons')
\ No newline at end of file
diff --git a/data/meson_desktopfile.py b/data/meson_desktopfile.py
new file mode 100755
index 00000000..ced926f1
--- /dev/null
+++ b/data/meson_desktopfile.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+# Copyright © 2019 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import subprocess
+import sys
+
+if os.environ.get('DESTDIR'):
+    sys.exit(0)
+
+prefix = os.environ['MESON_INSTALL_PREFIX']
+desktopfile = os.path.join(prefix, sys.argv[1], sys.argv[2])
+
+rv = subprocess.call(['desktop-file-validate', desktopfile])
+sys.exit(rv)
diff --git a/org.gnome.Terminal.Nautilus.metainfo.xml.in b/data/org.gnome.Terminal.Nautilus.metainfo.xml.in
similarity index 98%
rename from org.gnome.Terminal.Nautilus.metainfo.xml.in
rename to data/org.gnome.Terminal.Nautilus.metainfo.xml.in
index 24aa1018..bce73491 100644
--- a/org.gnome.Terminal.Nautilus.metainfo.xml.in
+++ b/data/org.gnome.Terminal.Nautilus.metainfo.xml.in
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright © 2016 Christian Persch
+  Copyright © 2014 Christian Persch
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of either:
diff --git a/org.gnome.Terminal.desktop.in.in b/data/org.gnome.Terminal.desktop.in
similarity index 96%
rename from org.gnome.Terminal.desktop.in.in
rename to data/org.gnome.Terminal.desktop.in
index 4148c30c..915c077f 100644
--- a/org.gnome.Terminal.desktop.in.in
+++ b/data/org.gnome.Terminal.desktop.in
@@ -1,5 +1,4 @@
 [Desktop Entry]
-# VERSION=@VERSION@
 Name=Terminal
 Comment=Use the command line
 Keywords=shell;prompt;command;commandline;cmd;
diff --git a/org.gnome.Terminal.appdata.xml.in b/data/org.gnome.Terminal.metainfo.xml.in
similarity index 100%
rename from org.gnome.Terminal.appdata.xml.in
rename to data/org.gnome.Terminal.metainfo.xml.in
diff --git a/data/ui-filter-mnemonics.xslt b/data/ui-filter-mnemonics.xslt
new file mode 100644
index 00000000..45d423c7
--- /dev/null
+++ b/data/ui-filter-mnemonics.xslt
@@ -0,0 +1,30 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+    <!--
+    Copyright © 2020  Alberto Ruiz
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  -->
+  <xsl:output omit-xml-declaration="yes"/>
+
+  <xsl:template match="node()|@*">
+    <xsl:copy>
+       <xsl:apply-templates select="node()|@*"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="WITHOUT_MNEMONIC"/>
+  <xsl:template match="WITH_MNEMONIC">
+    <xsl:copy-of select="node()"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/data/ui-filter-no-mnemonics.xslt b/data/ui-filter-no-mnemonics.xslt
new file mode 100644
index 00000000..78e9d6f7
--- /dev/null
+++ b/data/ui-filter-no-mnemonics.xslt
@@ -0,0 +1,30 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+  <!--
+    Copyright © 2020  Alberto Ruiz
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  -->
+  <xsl:output omit-xml-declaration="yes"/>
+
+  <xsl:template match="node()|@*">
+    <xsl:copy>
+       <xsl:apply-templates select="node()|@*"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="WITH_MNEMONIC"/>
+  <xsl:template match="WITHOUT_MNEMONIC">
+    <xsl:copy-of select="node()"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 00000000..44771f62
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,17 @@
+ca
+cs
+de
+el
+es
+fi
+fr
+gl
+hu
+id
+ko
+pl
+pt_BR
+ro
+ru
+sv
+uk
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 00000000..0639598f
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,62 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+help_media = [
+  'figures/gnome-terminal-icon.png',
+  'figures/gnome-terminal.png',
+  'figures/keyboard-key-search.svg',
+]
+
+help_pages = [
+  'adv-keyboard-shortcuts.page',
+  'app-colors.page',
+  'app-cursor.page',
+  'app-fonts.page',
+  'app-fullscreen.page',
+  'app-terminal-sizes.page',
+  'app-zoom.page',
+  'gs-execute-commands.page',
+  'gs-tabs.page',
+  'index.page',
+  'introduction.page',
+  'legal.xml',
+  'overview.page',
+  'pref.page',
+  'pref-bell.page',
+  'pref-custom-exit.page',
+  'pref-custom-command.page',
+  'pref-keyboard-access.page',
+  'pref-login-shell.page',
+  'pref-menubar.page',
+  'pref-profiles.page',
+  'pref-profile-char-width.page',
+  'pref-profile-encoding.page',
+  'pref-scrolling.page',
+  'pref-tab-window.page',
+  'pref-user-input.page',
+  'prob-reset.page',
+  'txt-copy-paste.page',
+  'txt-links.page',
+  # https://gitlab.gnome.org/GNOME/gnome-terminal/issues/71 :
+  # 'txt-save-text.page',
+  'txt-search.page',
+  'txt-select-text.page',
+]
+
+gnome.yelp(
+  gt_name,
+  media: help_media,
+  sources: help_pages,
+)
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 00000000..df88f14a
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,36 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+gt_mandir = gt_datadir / 'man'
+man1dir = gt_mandir / 'man1'
+
+man1 = custom_target(
+  gt_name + '.1',
+  command: [
+    xsltproc,
+    '--nonet',
+    '--stringparam', 'man.output.quietly', '1',
+    '--stringparam', 'funcsynopsis.style', 'ansi',
+    '--stringparam', 'man.authors.section.enabled', '0',
+    '--stringparam', 'man.copyright.section.enabled', '0',
+    '-o', '@OUTPUT@',
+    'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+    '@INPUT@',
+  ],
+  input: files(gt_name + '.xml'),
+  install: true,
+  install_dir: gt_prefix / man1dir,
+  output: gt_name + '.1',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..6e9ef52f
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,320 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+project(
+  'gnome-terminal',
+  ['c',],
+  default_options: [
+    'buildtype=release',
+    'c_std=gnu11',
+    'warning_level=' + (meson.version().version_compare('>= 0.50.0') ? '0' : '1'),
+    'b_ndebug=false',
+  ],
+  license: [
+    'GPL-3.0-or-later',             # the programme
+    'GPL-3.0-only', 'CC-BY-SA-3.0', # the documentation
+    'GFDL-1.3-only',                # the appstream data
+  ],
+  meson_version: '>= 0.49.0',
+  version: '3.41.0',
+)
+
+# Naming
+
+gt_name     = 'gnome-terminal'
+gt_dns_name = 'org.gnome.Terminal'
+
+# Compiler requirements
+
+c_req_std = 'gnu11'
+
+# Requirements
+
+vte_req                      = 'vte-2.91'
+vte_req_version              = '0.63.0'
+
+glib_req_version             = '2.52.0'
+glib_min_req_version         = '2.52'
+glib_max_allowed_version     = '2.52'
+
+gtk_req_version              = '3.22.27'
+gtk_min_req_version          = '3.18'
+gtk_max_allowed_version      = '3.24'
+
+dconf_req_version            = '0.14.0'
+libnautilus_ext_req_version  = '3.28.0'
+pcre2_req_version            = '10.00'
+schemas_req_version          = '0.1.0'
+
+# Versioning
+
+gt_version = meson.project_version()
+
+version_split = meson.project_version().split('.')
+gt_major_version = version_split[0].to_int()
+gt_minor_version = version_split[1].to_int()
+gt_micro_version = version_split[2].to_int()
+
+# Directories
+
+gt_datadir    = get_option('datadir')
+gt_includedir = get_option('includedir')
+gt_libdir     = get_option('libdir')
+gt_libexecdir = get_option('libexecdir')
+gt_localedir  = get_option('localedir')
+gt_prefix     = get_option('prefix')
+
+gt_pkgdatadir = gt_datadir / gt_name
+
+gt_schemadir = gt_datadir / 'glib-2.0' / 'schemas'
+
+gt_searchproviderdir = gt_datadir / 'gnome-shell' / 'search-providers'
+
+gt_nautilusextensiondir = gt_libdir / 'nautilus' / 'extensions-3.0'
+
+gt_dbusinterfacedir = gt_datadir / 'dbus-1' / 'interfaces'
+gt_dbusservicedir   = gt_datadir / 'dbus-1' / 'services'
+
+# It is correct for this to be in ${prefix}/lib, even on systems where that
+# does not match ${libdir}. This is what systemd uses on such platforms.
+gt_systemduserdir = 'lib' / 'systemd' / 'user'
+
+# Debug
+
+enable_debug = get_option('dbg') or get_option('debug') or get_option('buildtype').contains('debug')
+
+# Meson modules
+
+gnome = import('gnome')
+i18n  = import('i18n')
+pkg   = import('pkgconfig')
+
+# i18n
+
+gt_gettext_domain = gt_name
+po_dir = meson.current_source_dir() / 'po'
+
+# Compilers
+
+cc = meson.get_compiler('c')
+
+c_std_opt = '-std=' + c_req_std
+assert(cc.has_argument(c_std_opt), 'option ' + c_std_opt + ' not supported by ' + cc.get_id())
+add_project_arguments(c_std_opt, language: 'c')
+
+# Asserts must not be disabled
+
+assert(get_option('b_ndebug') == 'false', 'assertions may not be disabled')
+
+# Start config.h
+
+config_h = configuration_data()
+
+config_h.set_quoted('GETTEXT_PACKAGE', gt_gettext_domain)
+config_h.set_quoted('VERSION', gt_version)
+config_h.set('ENABLE_DEBUG', enable_debug)
+config_h.set('ENABLE_SEARCH_PROVIDER', get_option('search_provider'))
+
+# FIXME AC_USE_SYSTEM_EXTENSIONS also supported non-gnu systems
+config_h.set10('_GNU_SOURCE', true)
+
+
+ver = glib_min_req_version.split('.')
+config_h.set('GLIB_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+ver = glib_max_allowed_version.split('.')
+config_h.set('GLIB_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+
+ver = gtk_min_req_version.split('.')
+config_h.set('GDK_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+
+ver = gtk_max_allowed_version.split('.')
+config_h.set('GDK_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+
+# Compiler flags
+
+compiler_flags_common = [
+  '-Waggregate-return',
+  '-Wall',
+  '-Wcast-align',
+  '-Wendif-labels',
+  '-Werror=implicit-function-declaration',
+  '-Werror=init-self',
+  '-Werror=missing-include-dirs',
+  '-Werror=missing-prototypes',
+  '-Werror=pointer-arith',
+  '-Wextra',
+  '-Wfloat-equal',
+  '-Wformat-signedness',
+  '-Wimplicit',
+  '-Wlogical-op',
+  '-Wmissing-declarations',
+  '-Wmissing-format-attribute',
+  '-Wmissing-include-dirs',
+  '-Wmissing-noreturn',
+  '-Wnested-externs',
+  '-Wno-missing-field-initializers',
+  '-Wno-switch-enum',
+  '-Wno-unused-parameter',
+  '-Wold-style-definition',
+  '-Wpacked',
+  '-Wshadow',
+  '-Wsign-compare',
+  '-Wstrict-aliasing=2',
+  '-Wstrict-prototypes',
+  '-Wundef',
+  '-Wuninitialized',
+  '-Wunsafe-loop-optimizations',
+  '-Wvla',
+  '-Wwrite-strings',
+  '-fdiagnostics-show-option',
+  '-fno-common',
+  '-fstack-protector',
+  '-fstack-protector-strong',
+  '-fvisibility=hidden',
+]
+
+if enable_debug
+  compiler_flags_common += [
+    '-ggdb3',
+  ]
+endif
+
+# These are currently needed but the code should be fixed instead
+compiler_flags_common_undesirable = [
+  '-fno-strict-aliasing'
+]
+
+compiler_flags_cc_required = [
+  '-fvisibility=hidden',
+]
+
+global_cflags = cc.get_supported_arguments(compiler_flags_common +
+                                           compiler_flags_common_undesirable +
+                                           compiler_flags_cc_required)
+
+foreach flag: compiler_flags_cc_required
+  assert(cc.has_argument(flag), flag + ' is required but not supported')
+endforeach
+
+# These flags have to be tested together
+
+compiler_flags_common_multi = [
+  [
+    '-Werror=format=2',
+    '-Werror=format-nonliteral',
+    '-Werror=format-security',
+  ],
+]
+
+foreach flags : compiler_flags_common_multi
+  if cc.has_multi_arguments(flags)
+    global_cflags += flags
+  endif
+endforeach
+
+# ... and now make these flags the default
+
+add_project_arguments(global_cflags, language: 'c',)
+
+# Dependencies
+
+vte_dep       = dependency(vte_req,        version: '>=' + vte_req_version)
+
+dconf_dep     = dependency('dconf',        version: '>=' + dconf_req_version)
+gio_dep       = dependency('gio-2.0',      version: '>=' + glib_req_version)
+gio_unix_dep  = dependency('gio-unix-2.0', version: '>=' + glib_req_version)
+glib_dep      = dependency('glib-2.0',     version: '>=' + glib_req_version)
+gtk_dep       = dependency('gtk+-3.0',     version: '>=' + gtk_req_version)
+pcre2_dep     = dependency('libpcre2-8',   version: '>=' + pcre2_req_version)
+pthreads_dep  = dependency('threads')
+schemas_dep   = dependency('gsettings-desktop-schemas',
+                                           version: '>=' + schemas_req_version)
+uuid_dep      = dependency('uuid')
+
+if get_option('nautilus_extension')
+  libnautilus_extension_dep = dependency('libnautilus-extension', version: '>=' + 
libnautilus_ext_req_version,)
+else
+  libnautilus_extension_dep = dependency('', required: false,)
+endif
+
+if gtk_dep.get_pkgconfig_variable('targets').contains('x11')
+  x11_dep = dependency('x11')
+else
+  x11_dep = dependency('', required: false)
+endif
+
+# Write config.h
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h,
+)
+
+top_inc = include_directories('.')
+
+# Utilities
+
+xsltproc = find_program('xsltproc')
+
+# Subdirs
+
+subdir('src')
+subdir('data')
+subdir('po')
+
+if get_option('docs')
+  subdir('help')
+  subdir('man')
+endif
+
+# Simple compat Makefile
+
+makefile_conf = configuration_data()
+makefile_conf.set('srcdir', meson.current_source_dir())
+makefile_conf.set('builddir', meson.current_build_dir())
+
+configure_file(
+  input: 'Makefile.meson',
+  output: '@BASENAME@',
+  configuration: makefile_conf,
+)
+
+# .gitignore everything in the build directory
+
+configure_file(
+  output: '.gitignore',
+  command: ['echo', '**/**',],
+  capture: true,
+  install: false,
+)
+
+# Summary
+
+output = '\n'
+output += 'Configuration for gnome-terminal:\n\n'
+output += '  Version:                ' + gt_version + '\n'
+output += '\n'
+output += '  C compiler:             ' + cc.get_id() + '\n\n'
+output += '  Coverage:               ' + get_option('b_coverage').to_string() + '\n'
+output += '  Documentation:          ' + get_option('docs').to_string() + '\n'
+output += '  Debug:                  ' + enable_debug.to_string() + '\n'
+output += '\n'
+output += '  Prefix:                 ' + get_option('prefix') + '\n'
+output += '\n'
+output += '  Nautilus extension:     ' + get_option('nautilus_extension').to_string() + '\n'
+output += '  Search provider:        ' + get_option('search_provider').to_string() + '\n'
+message(output)
+
+# Done
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..b555ab66
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,43 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+option(
+  'dbg',
+  type: 'boolean',
+  value: false,
+  description: 'Enable extra debugging functionality',
+)
+
+option(
+  'docs',
+  type: 'boolean',
+  value: true,
+  description: 'Enable documentation',
+)
+
+option(
+  'nautilus_extension',
+  type: 'boolean',
+  value: true,
+  description: 'Provide integration for nautilus',
+)
+
+option(
+  'search_provider',
+  type: 'boolean',
+  value: true,
+  description: 'Provide search integration for gnome-shell',
+)
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7c869fc2..471cddc7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,6 @@
-# List of source files containing translatable strings.
-# Please keep this file sorted alphabetically.
-org.gnome.Terminal.appdata.xml.in
-org.gnome.Terminal.Nautilus.metainfo.xml.in
-org.gnome.Terminal.desktop.in.in
+data/org.gnome.Terminal.Nautilus.metainfo.xml.in
+data/org.gnome.Terminal.desktop.in
+data/org.gnome.Terminal.metainfo.xml.in
 src/org.gnome.Terminal.gschema.xml
 src/preferences.ui
 src/profile-editor.c
@@ -10,16 +8,15 @@ src/search-popover.ui
 src/server.c
 src/terminal-accels.c
 src/terminal-app.c
-src/terminal.c
+src/terminal-headerbar.c
 src/terminal-headerbar.ui
 src/terminal-headermenu.ui
-src/terminal-headerbar.c
 src/terminal-mdi-container.c
-src/terminal-menubar.ui.in
 src/terminal-menu-button.c
+src/terminal-menubar.ui.in
 src/terminal-nautilus.c
-src/terminal-notebook.c
 src/terminal-notebook-menu.ui
+src/terminal-notebook.c
 src/terminal-options.c
 src/terminal-prefs.c
 src/terminal-screen.c
@@ -27,3 +24,4 @@ src/terminal-search-popover.c
 src/terminal-tab-label.c
 src/terminal-util.c
 src/terminal-window.c
+src/terminal.c
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..0af089ff
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,19 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+i18n.gettext(
+  gt_gettext_domain,
+  preset: 'glib',
+)
diff --git a/src/gnome-terminal-server.service.in b/src/gnome-terminal-server.service.in
new file mode 100644
index 00000000..24a1f4b1
--- /dev/null
+++ b/src/gnome-terminal-server.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=GNOME Terminal Server
+PartOf=graphical-session.target
+[Service]
+Slice=app-@gt_dns_name@.slice
+Type=dbus
+BusName=@gt_dns_name@
+ExecStart=@libexecdir@/@gt_name@-server
+TimeoutStopSec=5s
+KillMode=process
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000..90dd5976
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,410 @@
+# Copyright © 2019, 2020, 2021 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+src_inc = include_directories('.')
+
+# Common sources
+
+client_util_sources = files(
+  'terminal-client-utils.c',
+  'terminal-client-utils.h',
+)
+
+debug_sources = files(
+  'terminal-debug.c',
+  'terminal-debug.h',
+)
+
+dbus_sources = gnome.gdbus_codegen(
+  'terminal-gdbus-generated',
+  gt_dns_name + '.xml',
+  autocleanup: 'none',
+  install_header: false,
+  interface_prefix: gt_dns_name,
+  namespace: 'Terminal',
+  object_manager: true,
+)
+
+i18n_sources = files(
+  'terminal-i18n.c',
+  'terminal-i18n.h',
+  'terminal-intl.h',
+)
+
+misc_sources = files(
+  'terminal-defines.h',
+  'terminal-libgsystem.h',
+)
+
+profiles_sources = files(
+  'terminal-profiles-list.c',
+  'terminal-profiles-list.h',
+  'terminal-schemas.h',
+  'terminal-settings-list.c',
+  'terminal-settings-list.h',
+)
+
+regex_sources = files(
+  'terminal-regex.h',
+)
+
+types_sources = files(
+  'terminal-enums.h',
+)
+
+types_sources += gnome.mkenums(
+  'terminal-type-builtins',
+  c_template: 'terminal-type-builtins.h.template',
+  h_template: 'terminal-type-builtins.c.template',
+  install_header: false,
+  sources: types_sources,
+)
+
+version_conf = {
+  'TERMINAL_MAJOR_VERSION': gt_major_version.to_string(),
+  'TERMINAL_MICRO_VERSION': gt_micro_version.to_string(),
+  'TERMINAL_MINOR_VERSION': gt_minor_version.to_string(),
+}
+
+version_sources = [configure_file(
+  configuration: version_conf,
+  input: 'terminal-version.h.in',
+  install: false,
+  output: '@BASENAME@',
+)]
+
+# Server
+
+ui_xsltproc_command = [
+  xsltproc,
+  '--nonet',
+  '-o', '@OUTPUT@',
+  '@INPUT@',
+]
+
+menubar_ui_mnemonics = custom_target(
+  'terminal-menubar-with-mnemonics.ui',
+  command: ui_xsltproc_command,
+  input: files(
+    '..' / 'data' / 'ui-filter-mnemonics.xslt',
+    'terminal-menubar.ui.in',
+  ),
+  install: false,
+  output: 'terminal-menubar-with-mnemonics.ui',
+)
+
+menubar_ui_nomnemonics = custom_target(
+  'terminal-menubar-without-mnemonics.ui',
+  command: ui_xsltproc_command,
+  input: files(
+    '..' / 'data' / 'ui-filter-no-mnemonics.xslt',
+    'terminal-menubar.ui.in',
+  ),
+  install: false,
+  output: 'terminal-menubar-without-mnemonics.ui',
+)
+
+server_sources = client_util_sources + debug_sources + dbus_sources + i18n_sources + misc_sources + 
profiles_sources + regex_sources + types_sources + version_sources + files(
+  'eggshell.c',
+  'eggshell.h',
+  'profile-editor.c',
+  'profile-editor.h',
+  'server.c',
+  'terminal-accels.c',
+  'terminal-accels.h',
+  'terminal-app.c',
+  'terminal-app.h',
+  'terminal-enums.h',
+  'terminal-gdbus.c',
+  'terminal-gdbus.h',
+  'terminal-headerbar.c',
+  'terminal-headerbar.h',
+  'terminal-icon-button.c',
+  'terminal-icon-button.h',
+  'terminal-info-bar.c',
+  'terminal-info-bar.h',
+  'terminal-mdi-container.c',
+  'terminal-mdi-container.h',
+  'terminal-menu-button.c',
+  'terminal-menu-button.h',
+  'terminal-notebook.c',
+  'terminal-notebook.h',
+  'terminal-pcre2.h',
+  'terminal-prefs.c',
+  'terminal-prefs.h',
+  'terminal-screen-container.c',
+  'terminal-screen-container.h',
+  'terminal-screen.c',
+  'terminal-screen.h',
+  'terminal-search-popover.c',
+  'terminal-search-popover.h',
+  'terminal-tab-label.c',
+  'terminal-tab-label.h',
+  'terminal-util.c',
+  'terminal-util.h',
+  'terminal-window.c',
+  'terminal-window.h',
+)
+
+server_sources += gnome.compile_resources(
+  'terminal-resources',
+  'terminal.gresource.xml',
+  c_name: 'terminal',
+  dependencies: [
+    menubar_ui_mnemonics,
+    menubar_ui_nomnemonics,
+  ],
+  export: false,
+)
+
+server_sources += gnome.genmarshal(
+  'terminal-marshal',
+  internal: true,
+  install_header: false,
+  prefix: '_terminal_marshal',
+  sources: files(
+    'terminal-marshal.list',
+  ),
+  stdinc: true,
+  valist_marshallers: true,
+)
+
+if get_option('search_provider')
+
+  server_sources += files(
+    'terminal-search-provider.c',
+    'terminal-search-provider.h',
+  )
+
+  server_sources += gnome.gdbus_codegen(
+    'terminal-search-provider-gdbus-generated',
+    gt_prefix / gt_dbusinterfacedir / 'org.gnome.ShellSearchProvider2.xml',
+    autocleanup: 'none',
+    install_header: false,
+    interface_prefix: 'org.gnome.Shell',
+    namespace: 'Terminal',
+  )
+
+endif
+
+server_incs = [
+  top_inc,
+  src_inc,
+]
+
+server_cflags = [
+  '-DTERMINAL_COMPILATION',
+  '-DVTE_DISABLE_DEPRECATION_WARNINGS',
+  '-DTERM_LOCALEDIR="@0@"'.format(gt_prefix / gt_localedir),
+]
+
+server_deps = [
+  dconf_dep,
+  gio_dep,
+  gio_unix_dep,
+  glib_dep,
+  gtk_dep,
+  pcre2_dep,
+  pthreads_dep,
+  schemas_dep,
+  uuid_dep,
+  vte_dep,
+  x11_dep,
+]
+
+server = executable(
+  gt_name + '-server',
+  c_args: server_cflags,
+  dependencies: server_deps,
+  include_directories: server_incs,
+  install: true,
+  install_dir: gt_prefix / gt_libexecdir,
+  sources: server_sources,
+)
+
+# systemd and D-Bus glue
+
+server_conf = configuration_data()
+server_conf.set('gt_name', gt_name)
+server_conf.set('gt_dns_name', gt_dns_name)
+server_conf.set('libexecdir', gt_prefix / gt_libexecdir)
+
+configure_file(
+  input: gt_dns_name + '.service.in',
+  output: gt_dns_name + '.service',
+  configuration: server_conf,
+  install: true,
+  install_dir: gt_prefix / gt_dbusservicedir,
+)
+
+configure_file(
+  input: gt_name + '-server.service.in',
+  output: gt_name + '-server.service',
+  configuration: server_conf,
+  install: true,
+  install_dir: gt_prefix / gt_systemduserdir
+)
+
+# Search provider
+
+if get_option('search_provider')
+
+  provider_ini = files(gt_name + '-search-provider.ini')
+
+  install_data(
+    provider_ini,
+    install_dir: gt_prefix / gt_searchproviderdir,
+  )
+endif # option 'search_provider'
+
+# Legacy client
+
+client_sources = client_util_sources + debug_sources + dbus_sources + i18n_sources + profiles_sources + 
types_sources + files(
+  'terminal-options.c',
+  'terminal-options.h',
+  'terminal.c',
+)
+
+client_incs = [
+  top_inc,
+  src_inc,
+]
+
+client_incs = [
+  top_inc,
+  src_inc,
+]
+
+client_cflags = [
+  '-DTERMINAL_COMPILATION',
+  '-DTERMINAL_CLIENT',
+  '-DTERM_DATADIR="@0@"'.format(gt_prefix / gt_datadir),
+  '-DTERM_LOCALEDIR="@0@"'.format(gt_prefix / gt_localedir),
+  '-DTERM_PKGDATADIR="@0@"'.format(gt_prefix / gt_pkgdatadir),
+]
+
+client_deps = [
+  dconf_dep,
+  gio_dep,
+  gio_unix_dep,
+  glib_dep,
+  gtk_dep,
+  x11_dep,
+  uuid_dep,
+  vte_dep,
+]
+
+client = executable(
+  gt_name,
+  c_args: client_cflags,
+  include_directories: client_incs,
+  dependencies: client_deps,
+  install: true,
+  sources: client_sources,
+)
+
+# Settings schemas
+
+install_data(
+  gt_dns_name + '.gschema.xml',
+  install_dir: gt_prefix / gt_schemadir,
+)
+
+meson.add_install_script(
+  'meson_compileschemas.py',
+  gt_prefix / gt_schemadir,
+)
+
+# Nautilus extension
+
+if get_option('nautilus_extension')
+
+  nautilus_sources = client_util_sources + dbus_sources + i18n_sources + misc_sources + types_sources + 
files(
+    'terminal-nautilus.c',
+  )
+
+  nautilus_map = meson.current_source_dir() / 'nautilus.map'
+
+  nautilus_incs = [
+    top_inc,
+    src_inc,
+  ]
+
+  nautilus_cflags = [
+    '-DTERM_LOCALEDIR="@0@"'.format(gt_prefix / gt_localedir),
+  ]
+
+  nautilus_deps = [
+    gio_dep,
+    gio_unix_dep,
+    glib_dep,
+    libnautilus_extension_dep,
+  ]
+
+  nautilus_ldflags = [
+    '-Wl,--version-script,@0@'.format(nautilus_map),
+  ]
+
+  nautilus_extension = shared_library(
+     'libterminal-nautilus',
+     c_args: nautilus_cflags,
+     dependencies: nautilus_deps,
+     include_directories: nautilus_incs,
+     install: true,
+     install_dir: gt_prefix / gt_nautilusextensiondir,
+     link_args: nautilus_ldflags,
+     link_depends: nautilus_map,
+     sources: nautilus_sources,
+     soversion: '',
+  )
+
+endif # option 'nautilus_extension'
+
+# Unit tests
+
+test_regex_sources = regex_sources + files(
+  'terminal-regex.c',
+)
+
+test_regex = executable(
+  'test-regex',
+  c_args: [
+    '-DTERMINAL_REGEX_MAIN',
+  ],
+  dependencies: [
+    glib_dep,
+    pcre2_dep,
+  ],
+  include_directories: [top_inc, src_inc,],
+  sources: test_regex_sources,
+  install: false,
+)
+
+test_env = [
+  'GNOME_TERMINAL_DEBUG=0',
+  'VTE_DEBUG=0',
+]
+
+test_units = [
+  ['regex', test_regex],
+]
+
+foreach test: test_units
+  test(
+    test[0],
+    test[1],
+    env: test_env,
+  )
+endforeach
diff --git a/src/meson_compileschemas.py b/src/meson_compileschemas.py
new file mode 100755
index 00000000..3268ddc0
--- /dev/null
+++ b/src/meson_compileschemas.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+# Copyright © 2019 Christian Persch
+#
+# This programme is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This programme is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this programme.  If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import subprocess
+import sys
+
+if os.environ.get('DESTDIR'):
+    sys.exit(0)
+
+prefix = os.environ['MESON_INSTALL_PREFIX']
+schemasdir = os.path.join(prefix, sys.argv[1])
+
+rv = subprocess.call(['glib-compile-schemas', schemasdir])
+sys.exit(rv)
diff --git a/src/nautilus.map b/src/nautilus.map
new file mode 100644
index 00000000..7cd7993a
--- /dev/null
+++ b/src/nautilus.map
@@ -0,0 +1,9 @@
+{
+  global:
+    nautilus_module_initialize;
+    nautilus_module_list_types;
+    nautilus_module_shutdown;
+
+  local:
+    *;
+};
diff --git a/src/org.gnome.Terminal.service.in b/src/org.gnome.Terminal.service.in
new file mode 100644
index 00000000..70c09304
--- /dev/null
+++ b/src/org.gnome.Terminal.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=@gt_dns_name@
+SystemdService=@gt_name@-server.service
+Exec=@libexecdir@/gnome-terminal-server


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