[vte/wip/inigomartinez/meson: 11/11] build: Port to meson build system



commit def893bf6ded89c5e4df2546921780a41a682b9a
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Jul 5 19:45:26 2017 +0200

    build: Port to meson build system
    
    meson is a build system focused on speed and ease of use, which
    helps speed up software development. This patch adds meson support
    alongside autotools.

 bindings/gir/meson.build  |  18 +++
 bindings/vala/meson.build |  68 ++++++++++
 doc/reference/meson.build |  83 ++++++++++++
 glade/meson.build         |  48 +++++++
 meson.build               | 327 ++++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt         |  11 ++
 po/meson.build            |   1 +
 src/app/meson.build       |  33 +++++
 src/meson.build           | 256 ++++++++++++++++++++++++++++++++++++
 src/vte/meson.build       |  46 +++++++
 10 files changed, 891 insertions(+)
---
diff --git a/bindings/gir/meson.build b/bindings/gir/meson.build
new file mode 100644
index 00000000..1e251d26
--- /dev/null
+++ b/bindings/gir/meson.build
@@ -0,0 +1,18 @@
+gir_incs = [
+  'Gdk-' + gtk_api_version,
+  'Gtk-' + gtk_api_version,
+  'Pango-1.0'
+]
+
+libvte_gir = gnome.generate_gir(
+  libvte,
+  sources: headers + [vteversion_header] + vtetype_enums + gir_sources,
+  includes: gir_incs,
+  dependencies: libvte_dep,
+  extra_args: '-DVTE_COMPILATION',
+  nsversion: vte_api_version,
+  namespace: 'Vte',
+  export_packages: vte_api_name,
+  header: 'vte' / 'vte.h',
+  install: true,
+)
diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build
new file mode 100644
index 00000000..cae048bd
--- /dev/null
+++ b/bindings/vala/meson.build
@@ -0,0 +1,68 @@
+deps = [
+  'gio-2.0',
+  'glib-2.0',
+  'pango',
+  gtk_dep_name,
+]
+
+libvte_vapi_dep = gnome.generate_vapi(
+  vte_api_name,
+  sources: libvte_gir[0],
+  packages: deps,
+  install: true,
+)
+
+# VALA Test application
+sources = files('app.vala')
+
+resource_data = files(
+  'app.ui',
+  'search-popover.ui',
+)
+
+sources += gnome.compile_resources(
+  'appresources',
+  'app.gresource.xml',
+  c_name: 'app',
+  dependencies: resource_data,
+  export: true,
+)
+
+incs = [
+  top_inc,
+  src_inc,
+  vte_inc,
+]
+
+deps = [
+  config_dep,
+  gio_dep,
+  glib_dep,
+  gtk_dep,
+  libvte_vapi_dep,
+  posix_dep,
+]
+
+c_flags = [
+  '-Wno-unused-but-set-variable',
+  '-Wno-unused-variable',
+]
+
+vala_flags = []
+
+if valac_version.version_compare('>= 0.31.1')
+  vala_flags += '--disable-since-check'
+endif
+
+if gtk_dep.version().version_compare('>= 3.16')
+  vala_flags += '--define=GTK_3_16'
+endif
+
+executable(
+  vte_api_name,
+  sources: sources,
+  include_directories: incs,
+  dependencies: deps,
+  c_args: c_flags,
+  vala_args: vala_flags,
+)
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 00000000..4aa8039b
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,83 @@
+private_headers = [
+  'buffer.h',
+  'caps.hh',
+  'cell.hh',
+  'config.h',
+  'debug.h',
+  'iso2022.h',
+  'keymap.h',
+  'marshal.h',
+  'modes.hh',
+  'modes-ecma.hh',
+  'modes-private.hh',
+  'parser.hh',
+  'parser-arg.hh',
+  'parser-c01.hh',
+  'parser-charset.hh',
+  'parser-charset-tables.hh',
+  'parser-cmd.hh',
+  'parser-csi.hh',
+  'parser-dcs.hh',
+  'parser-esc.hh',
+  'parser-glue.hh',
+  'parser-osc.hh',
+  'parser-reply.hh',
+  'parser-string.hh',
+  'ring.hh',
+  'tabstops.hh',
+  'vteconv.h',
+  'vtedraw.h',
+  'vteinternal.hh',
+  'vterowdata.hh',
+  'vtestream-base.h',
+  'vtestream-file.h',
+  'vtestream.h',
+  'vtetypebuiltins.h',
+  'vteunistr.h',
+]
+
+scan_args = [
+  '--deprecated-guards="VTE_DISABLE_DEPRECATED"',
+  '--ignore-decorators=_VTE_GNUC_NONNULL\s*\([^)]*\)',
+]
+
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
+
+fixxref_args = [
+  '--html-dir=' + (vte_prefix / gnome.gtkdoc_html_dir(vte_api_name)),
+  '--extra-dir=' + (glib_prefix / gnome.gtkdoc_html_dir('glib')),
+  '--extra-dir=' + (glib_prefix / gnome.gtkdoc_html_dir('gio')),
+  '--extra-dir=' + (gtk_prefix / gnome.gtkdoc_html_dir('gdk')),
+  '--extra-dir=' + (gtk_prefix / gnome.gtkdoc_html_dir('gdk-pixbuf')),
+  '--extra-dir=' + (gtk_prefix / gnome.gtkdoc_html_dir('gtk')),
+]
+
+version_conf = configuration_data()
+version_conf.set('VERSION', vte_version)
+
+version = 'version.xml'
+
+content_files = configure_file(
+  input: version + '.in',
+  output: version,
+  configuration: version_conf
+)
+
+gnome.gtkdoc(
+  meson.project_name(),
+  main_xml: meson.project_name() + '-docs.xml',
+  module_version: vte_api_version,
+  src_dir: [src_inc, vte_inc],
+  ignore_headers: private_headers,
+  include_directories: top_inc,
+  dependencies: libvte_dep,
+  c_args: '-DVTE_COMPILATION',
+  namespace: meson.project_name(),
+  scan_args: scan_args,
+  mkdb_args: '--source-suffixes=h,hh,c,cc',
+  fixxref_args: fixxref_args,
+  gobject_typesfile: meson.project_name() + '.types',
+  content_files: content_files,
+  install: true,
+)
diff --git a/glade/meson.build b/glade/meson.build
new file mode 100644
index 00000000..ea0996b3
--- /dev/null
+++ b/glade/meson.build
@@ -0,0 +1,48 @@
+vte_xml = 'vte.xml'
+vte_glade_xml = vte_api_name + '.xml'
+
+vte_conf = configuration_data()
+vte_conf.set('VTE_API_VERSION', vte_api_version)
+vte_conf.set('VERSION', vte_version)
+
+vte_glade_in = configure_file(
+  input: vte_xml + '.in.in',
+  output: vte_glade_xml + '.in',
+  configuration: vte_conf,
+)
+
+intltool_cache = po_dir / '.intltool-merge-cache'
+
+vte_glade = custom_target(
+  vte_glade_xml,
+  input: vte_glade_in,
+  output: vte_glade_xml,
+  command: [find_program('intltool-merge'), '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'],
+  install: true,
+  install_dir: glade_catalogue_dir,
+)
+
+run_target(
+  'validate',
+  command: [find_program('xmllint'), '--dtdvalid', glade_catalog_dtd, '--noout', vte_glade]
+)
+
+icon_sizes = [
+  '16x16',
+  '22x22',
+]
+
+icon = 'widget-vte-terminal.png'
+
+sources = []
+renames = []
+foreach icon_size: icon_sizes
+  sources += ['_'.join(['hicolor', 'actions', icon_size, icon])]
+  renames += [icon_size / 'actions' / icon]
+endforeach
+
+install_data(
+  sources,
+  rename: renames,
+  install_dir: glade_icon_dir / 'hicolor',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..65d0c63b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,327 @@
+project(
+  'vte', ['c', 'cpp'],
+  version: '0.55.1',
+  license: 'GPL3',
+  default_options: [
+    'buildtype=debugoptimized',
+    'cpp_std=gnu++17',
+  ],
+  meson_version: '>= 0.49.0',
+)
+
+vte_version = meson.project_version()
+version_array = vte_version.split('.')
+vte_major_version = version_array[0].to_int()
+vte_minor_version = version_array[1].to_int()
+vte_micro_version = version_array[2].to_int()
+
+vte_prefix = get_option('prefix')
+vte_datadir = get_option('datadir')
+vte_libexecdir = get_option('libexecdir')
+vte_localedir = get_option('localedir')
+vte_includedir = get_option('includedir')
+vte_sysconfdir = get_option('sysconfdir')
+
+enable_gir = get_option('introspection')
+enable_vala = get_option('vapi')
+enable_glade_catalogue = get_option('glade_catalogue')
+
+if get_option('gtk') == '3.0'
+  gtk_api_version = '3.0'
+  gtk_req_version = '>= 3.8.0'
+  vte_api_version = '2.91'
+  glade_dep_name = 'gladeui-2.0'
+else
+  gtk_api_version = '4.0'
+  gtk_req_version = '>= 3.89.0'
+  vte_api_version = '3.91'
+  # glade_dep_name = 'gladeui-4.0' ?
+  # remove the following when they're ready
+  enable_gir = false
+  enable_vala = false
+  enable_glade_catalogue = false
+endif
+
+gtk_dep_name = 'gtk+-' + gtk_api_version
+
+vte_api_name = '@0@-@1@'.format(meson.project_name(), vte_api_version)
+vte_api_path = vte_api_name / meson.project_name()
+
+vte_pkgincludedir = vte_includedir / vte_api_name / meson.project_name()
+
+soversion = 0
+
+revision = (vte_minor_version.is_odd() ? 0 : vte_micro_version)
+age = vte_minor_version * 100 + vte_micro_version - revision
+current = vte_major_version + age
+
+libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+
+vte_debug = get_option('buildtype').contains('debug')
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+source_root = meson.current_source_dir()
+build_root = meson.current_build_dir()
+
+po_dir = source_root / 'po'
+
+top_inc = include_directories('.')
+
+cc = meson.get_compiler('c')
+cpp = meson.get_compiler('cpp')
+
+config_h = configuration_data()
+
+config_h.set_quoted('VERSION', vte_version)
+
+# i18n
+config_h.set_quoted('GETTEXT_PACKAGE', vte_api_name)
+
+# GLIB tools
+config_h.set_quoted('VTE_DEFAULT_TERM', 'xterm-256color')
+
+config_h.set('VTE_DEBUG', vte_debug)
+
+# headers
+check_headers = [
+  'pty.h',
+  'stropts.h',
+  'sys/select.h',
+  'sys/syslimits.h',
+  'sys/termios.h',
+  'sys/wait.h',
+  'termios.h',
+  'util.h',
+  'wchar.h',
+  # i18n
+  'locale.h',
+  # for vtespawn
+  'sys/resource.h',
+]
+
+foreach header: check_headers
+  config_h.set('HAVE_' + header.underscorify().to_upper(), cc.has_header(header))
+endforeach
+
+# symbols
+config_h.set('GWINSZ_IN_SYS_IOCTL', cc.has_header_symbol('sys/ioctl.h', 'TIOCGWINSZ'))
+
+# i18n
+config_h.set('HAVE_DECL_BIND_TEXTDOMAIN_CODESET', cc.has_header_symbol('libintl.h', 
'bind_textdomain_codeset'))
+
+# functions
+# Check for how to open a new PTY. We support posix_openpt and BSDs openpty
+foreach func: ['grantpt', 'posix_openpt', 'ptsname', 'unlockpt']
+  assert(cc.has_function(func), 'no support for Unix98 PTY found')
+endforeach
+
+check_functions = [
+  # Misc PTY handling functions
+  'cfmakeraw',
+  'fork',
+  'getpgid',
+  'setpgid',
+  'setsid',
+  'tcgetattr',
+  'tcsetattr',
+  # Misc I/O routines.
+  'pread_pwrite',
+  'explicit_bzero',
+  # Misc string routines.
+  'strchrnul',
+  # for vtespawn
+  'fdwalk',
+]
+
+foreach func: check_functions
+  config_h.set('HAVE_' + func.underscorify().to_upper(), cc.has_function(func))
+endforeach
+
+# Math functions
+m_dep = cc.find_library('m')
+
+foreach func: ['ceil', 'floor', 'round']
+  config_h.set('HAVE_' + func.underscorify().to_upper(), cc.has_function(func, dependencies: m_dep))
+endforeach
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+common_c_flags = []
+common_cpp_flags = []
+
+if vte_debug
+  common_test_flags = [
+    '-fno-common',
+    '-fdiagnostics-show-option',
+    '-fno-semantic-interposition',
+    '-fno-strict-aliasing',
+    '-fstack-protector',
+    '-fstack-protector-strong',
+    '-Wcast-align',
+    '-Werror=declaration-after-statement',
+    '-Werror=format=2',
+    '-Werror=format-nonliteral',
+    '-Werror=format-security',
+    '-Werror=implicit-function-declaration',
+    '-Werror=init-self',
+    '-Werror=missing-include-dirs',
+    '-Werror=missing-prototypes',
+    '-Werror=pointer-arith',
+    '-Wendif-labels',
+    '-Wfloat-equal',
+    '-Wlogical-op',
+    '-Wmisleading-indentation',
+    '-Wmissing-declarations',
+    '-Wmissing-include-dirs',
+    '-Wmissing-format-attribute',
+    '-Wmissing-noreturn',
+    '-Wno-deprecated-declarations',
+    '-Wno-missing-field-initializers',
+    '-Wno-switch-enum',
+    '-Wno-unused-parameter',
+    '-Wno-packed',
+    '-Wshadow',
+    '-Wstrict-aliasing=2',
+    '-Wundef',
+    '-Wunsafe-loop-optimizations',
+    '-Wwrite-strings',
+  ]
+
+  common_c_flags += cc.get_supported_arguments(common_test_flags + [
+    '-Waggregate-return',
+    '-Wnested-externs',
+    '-Wold-style-definition',
+    '-Wsign-compare',
+    '-Wstrict-prototypes',
+  ])
+
+  common_cpp_flags += cpp.get_supported_arguments(common_test_flags + [
+    '-fno-rtti',
+    '-fno-exceptions',
+    '-fvisibility-inlines-hidden',
+    '-Wimplicit-fallthrough=5',
+    '-Wstrict-null-sentinel',
+    # FIXME: otherwise it doesn't compile
+    '-fpermissive',
+  ])
+
+  flag = '-fvisibility=hidden'
+  assert(cpp.has_argument(flag), cpp.get_id() + ' doesn\'t support required flag -fvisibility=hidden')
+  common_cpp_flags += [flag]
+endif
+
+add_project_arguments(common_flags + common_c_flags, language: 'c')
+add_project_arguments(common_flags + common_cpp_flags, language: 'cpp')
+
+enable_b_symbolic = get_option('Bsymbolic')
+if not enable_b_symbolic.disabled()
+  ldflag = '-Wl,-Bsymbolic-functions'
+
+  if cc.has_link_argument(ldflag)
+    add_project_link_arguments(ldflag, language: 'c')
+  else
+    if enable_b_symbolic == 'enabled'
+      error('-Bsymbolic requested but not supported by ld. Use -DBsymbolic=false to disable')
+    endif
+    message('-Bsymbolic not supported by ld; disabling')
+  endif
+
+  if cpp.has_link_argument(ldflag)
+    add_project_link_arguments(ldflag, language: 'cpp')
+  else
+    if enable_b_symbolic == 'enabled'
+      error('-Bsymbolic requested but not supported by cxx ld. Use -DBsymbolic=false to disable')
+    endif
+    message('-Bsymbolic not supported by ld; disabling')
+  endif
+endif
+
+gio_dep = dependency('gio-2.0')
+glib_dep = dependency('glib-2.0', version: '>= 2.40.0')
+gobject_dep = dependency('gobject-2.0')
+pango_dep = dependency('pango', version: '>= 1.22.0')
+libpcre_dep = dependency('libpcre2-8', version: '>= 10.21')
+zlib_dep = dependency('zlib')
+
+threads_dep = dependency('threads')
+
+gtk_dep = dependency(gtk_dep_name, version: gtk_req_version)
+
+enable_gnutls = get_option('gnutls')
+if enable_gnutls
+  gnutls_dep = dependency('gnutls', version: '>= 3.2.7')
+endif
+config_h.set('WITH_GNUTLS', enable_gnutls)
+
+# Legacy Charset Support
+enable_iconv = get_option('iconv')
+config_h.set('WITH_ICONV', enable_iconv)
+
+subdir('src')
+
+# introspection support
+if enable_gir
+  gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.9.0', required: false)
+  assert(gir_dep.found(), 'Introspection requested but gobject-introspection-1.0 not installed. Try 
-Dintrospection=false')
+
+  subdir('bindings/gir')
+endif
+
+# vala support
+if enable_vala
+  assert(enable_gir, 'you need introspection support for the vala support')
+
+  vala_req_version = '>= 0.24.0'
+  error_str = 'Vala requested but vala compiler ' + vala_req_version + ' not found. Try -Dvapi=false'
+
+  assert(add_languages('vala', required: false), error_str)
+  valac = meson.get_compiler('vala')
+  valac_version = valac.version()
+  assert(valac_version.version_compare(vala_req_version), error_str)
+
+  vapi_dir = source_root / 'bindings' / 'vala'
+  config_dep = valac.find_library('config', dirs: vapi_dir)
+  posix_dep = valac.find_library('posix')
+
+  subdir('bindings/vala')
+endif
+
+subdir('po')
+
+if get_option('gtk_doc')
+  subdir('doc/reference')
+endif
+
+if enable_glade_catalogue
+  glade_dep = dependency(glade_dep_name)
+
+  glade_catalogue_dir = glade_dep.get_pkgconfig_variable('catalogdir', define_variable: ['datarootdir', 
vte_prefix / vte_datadir])
+  assert(glade_catalogue_dir != '', glade_dep_name + ' not found')
+  glade_catalog_dtd = glade_dep.get_pkgconfig_variable('catalogdir') / 'glade-catalog.dtd'
+
+  # FIXME: glade_module_dir is not used at all
+  # FIXME: this should redefine libdir. however, moduledir definition is wrong in the pc file
+  #glade_module_dir = glade_dep.get_pkgconfig_variable('moduledir', define_variable: ['prefix', vte_prefix])
+  #assert(glade_module_dir != '', glade_dep_name + ' not found')
+
+  glade_icon_dir = glade_dep.get_pkgconfig_variable('pixmapdir', define_variable: ['datarootdir', vte_prefix 
/ vte_datadir])
+
+  subdir('glade')
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h,
+)
+
+output = 'Configuration for libvte ' + vte_version + ' for ' + gtk_dep_name + '\n'
+output += '        GNUTLS: ' + enable_gnutls.to_string() + '\n'
+output += '        IConv: ' + enable_iconv.to_string() + '\n'
+output += '        Installing Glade catalogue: ' + enable_glade_catalogue.to_string() + '\n'
+output += '        Debugging: ' + vte_debug.to_string() + '\n'
+output += '        Introspection: ' + enable_gir.to_string() + '\n'
+output += '        Vala binginds: ' + enable_vala.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..f573074c
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('gtk', type: 'combo', choices: ['3.0', '3.90', '3.92', '3.94', '3.96', '3.98'], value: '3.0', 
description: 'which gtk+ version to compile against')
+option('glade_catalogue', type: 'boolean', value: true, description: 'enable installing the glade catalogue')
+option('gnutls', type: 'boolean', value: true, description: 'enable gnutls support')
+option('iconv', type: 'boolean', value: true, description: 'Disable legacy charset support using iconv')
+
+option('Bsymbolic', type: 'feature', value: 'auto', description: 'enable linking with -Bsymbolic')
+
+option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection (depends on 
GObject)')
+option('vapi', type: 'boolean', value: true, description: 'build Vala bindings')
+
+option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..7cef5417
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(vte_api_name, preset: 'glib')
diff --git a/src/app/meson.build b/src/app/meson.build
new file mode 100644
index 00000000..2be7ded9
--- /dev/null
+++ b/src/app/meson.build
@@ -0,0 +1,33 @@
+sources = files('app.cc')
+
+resource_data = files(
+  'appmenu.ui',
+  'search-popover.ui',
+  'window.ui',
+)
+
+sources += gnome.compile_resources(
+  'resources.cc',
+  'app.gresource.xml',
+  c_name: 'app',
+  dependencies: resource_data,
+)
+
+deps = [
+  libpcre_dep,
+  libvte_dep,
+]
+
+cpp_flags = [
+  '-DG_LOG_DOMAIN="Vte"',
+  '-DLOCALEDIR="@0@"'.format(vte_prefix / vte_localedir),
+]
+
+executable(
+  'vte-' + vte_api_version,
+  sources,
+  include_directories: top_inc,
+  dependencies: libvte_dep,
+  cpp_args: cpp_flags,
+  install: true,
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000..f9e50f14
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,256 @@
+src_inc = include_directories('.')
+
+subdir('vte')
+
+gir_sources = files(
+  'pty.cc',
+  'vtegtk.cc',
+)
+
+common_deps = [
+  gio_dep,
+  glib_dep,
+  gobject_dep,
+  gtk_dep,
+  pango_dep,
+]
+
+sources = vtetype_enums + gir_sources + files(
+  'chunk.cc',
+  'debug.cc',
+  'keymap.cc',
+  'parser.cc',
+  'reaper.cc',
+  'ring.cc',
+  'utf8.cc',
+  'vte.cc',
+  'vteaccess.cc',
+  'vtedraw.cc',
+  'vteregex.cc',
+  'vterowdata.cc',
+  'vtespawn.cc',
+  'vteseq.cc',
+  'vtestream.cc',
+  'vtetypes.cc',
+  'vteunistr.cc',
+  'vteutils.cc',
+  'widget.cc',
+)
+
+box_drawing = 'box_drawing'
+
+sources += custom_target(
+  box_drawing,
+  input: box_drawing + '.txt',
+  output: box_drawing + '.h',
+  capture: true,
+  command: [find_program('box_drawing_generate.sh'), '@INPUT@'],
+)
+
+sources += gnome.compile_resources(
+  'vteresources',
+  'vte.gresource.xml.in',
+  c_name: '_vte',
+)
+
+marshal = 'marshal'
+
+sources += gnome.genmarshal(
+  marshal,
+  sources: marshal + '.list',
+  prefix: '_vte_marshal',
+  internal: true,
+)
+
+incs = [
+  top_inc,
+  vte_inc,
+]
+
+deps = common_deps + [
+  libpcre_dep,
+  m_dep,
+  threads_dep,
+  zlib_dep,
+]
+
+# FIXME: DATADIR, LIBEXECDIR seem to be unnecessary
+cpp_flags = [
+  '-DG_LOG_DOMAIN="Vte"',
+  '-DVTE_API_VERSION="@0@"'.format(vte_api_version),
+  '-DDATADIR="@0@"'.format(vte_prefix / vte_datadir),
+  '-DLIBEXECDIR="@0@"'.format(vte_prefix / vte_libexecdir),
+  '-DLOCALEDIR="@0@"'.format(vte_prefix / vte_localedir),
+  '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
+  '-DVTE_COMPILATION',
+  '-UPARSER_INCLUDE_NOP',
+]
+
+if enable_gnutls
+  deps += gnutls_dep
+endif
+
+libvte = both_libraries(
+  'vte-' + vte_api_version,
+  sources: sources,
+  version: libversion,
+  include_directories: incs,
+  dependencies: deps,
+  cpp_args: cpp_flags,
+  install: true,
+)
+
+libvte_dep = declare_dependency(
+  sources: [vteversion_header, vtetype_enums[1]],
+  include_directories: [src_inc, vte_inc],
+  dependencies: common_deps,
+  link_with: libvte.get_shared_lib(),
+)
+
+pkg.generate(
+  libvte,
+  version: vte_version,
+  name: meson.project_name(),
+  description: 'Vte terminal widget.',
+  filebase: vte_api_name,
+  subdirs: vte_api_name,
+  requires: common_deps,
+  variables: 'exec_prefix=${prefix}',
+)
+
+subdir('app')
+
+sources = files(
+  'debug.cc',
+  'parser.cc',
+  'parser-cat.cc',
+  'utf8.cc',
+)
+
+executable(
+  'parser-cat',
+  sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  cpp_args: '-DPARSER_INCLUDE_NOP',
+)
+
+# name, sources, dependencies, c_flags
+programs = [
+  ['dumpkeys', 'dumpkeys.c', glib_dep, []],
+  ['mev', 'mev.c', glib_dep, []],
+  ['slowcat', 'slowcat.c', glib_dep, []],
+  ['reflect-text-view', 'reflect.c', libvte_dep, '-DUSE_TEXT_VIEW'],
+  ['reflect-vte', 'reflect.c', libvte_dep, '-DUSE_VTE'],
+  ['xticker', 'xticker.c', glib_dep, []],
+]
+
+foreach program: programs
+  executable(
+    program[0],
+    program[1],
+    include_directories: top_inc,
+    dependencies: program[2],
+    c_args: program[3],
+  )
+endforeach
+
+test_env = [
+  'srcdir="@0@"'.format(meson.current_source_dir()),
+  'top_builddir="@0@"'.format(build_root),
+  'VTE_API_VERSION="@0@"'.format(vte_api_version),
+]
+
+# name, sources, dependencies, cpp_flags
+test_units = [
+  ['test-modes', 'modes-test.cc', glib_dep, []],
+  ['test-refptr', 'refptr-test.cc', gobject_dep, []],
+  ['test-tabstops', 'tabstops-test.cc', glib_dep, []],
+]
+
+sources = files(
+  'debug.cc',
+  'reaper.cc',
+)
+
+deps = [
+  glib_dep,
+  gobject_dep,
+]
+
+test_units += [['reaper', sources, deps, '-DMAIN']]
+
+sources = files(
+  'parser-test.cc',
+  'parser.cc',
+)
+
+test_units += [['test-parser', sources, glib_dep, '-DPARSER_INCLUDE_NOP']]
+
+sources = files(
+  'utf8-test.cc',
+  'utf8.cc',
+)
+
+test_units += [['test-utf8', sources, glib_dep, []]]
+
+deps = [
+  glib_dep,
+  gtk_dep,
+  pango_dep,
+]
+
+test_units += [['test-vtetypes', 'vtetypes.cc', deps, '-DMAIN']]
+
+sources = [
+  'vtestream.cc',
+  'vteutils.cc',
+]
+
+deps = [
+  gio_dep,
+  glib_dep,
+  gobject_dep,
+  zlib_dep,
+]
+
+if enable_gnutls
+  deps += gnutls_dep
+endif
+
+test_units += [['vtestream-file', sources, deps, '-DVTESTREAM_MAIN']]
+
+foreach test_unit: test_units
+  exe = executable(
+    test_unit[0],
+    test_unit[1],
+    include_directories: top_inc,
+    dependencies: test_unit[2],
+    cpp_args: test_unit[3],
+  )
+
+  test(
+    test_unit[0],
+    exe,
+    env: test_env,
+  )
+endforeach
+
+test_scripts = [
+  'check-doc-syntax.sh',
+  'test-vte-sh.sh',
+]
+
+foreach test_script: test_scripts
+  test(
+    test_script,
+    find_program(test_script),
+    env: test_env,
+  )
+endforeach
+
+# Shell
+install_data(
+  'vte.sh',
+  install_dir: vte_sysconfdir / 'profile.d',
+)
diff --git a/src/vte/meson.build b/src/vte/meson.build
new file mode 100644
index 00000000..9a3a143f
--- /dev/null
+++ b/src/vte/meson.build
@@ -0,0 +1,46 @@
+vte_inc = include_directories('.')
+
+enum_headers = files(
+  'vtedeprecated.h',
+  'vteenums.h',
+)
+
+headers = enum_headers + files(
+  'vteglobals.h',
+  'vte.h',
+  'vtemacros.h',
+  'vtepty.h',
+  'vteregex.h',
+  'vteterminal.h',
+)
+
+install_headers(
+  headers,
+  subdir: vte_api_path
+)
+
+vteversion_conf = configuration_data()
+vteversion_conf.set('VTE_MAJOR_VERSION', vte_major_version)
+vteversion_conf.set('VTE_MINOR_VERSION', vte_minor_version)
+vteversion_conf.set('VTE_MICRO_VERSION', vte_micro_version)
+
+vteversion = 'vteversion.h'
+
+vteversion_header = configure_file(
+  input: vteversion + '.in',
+  output: vteversion,
+  configuration: vteversion_conf,
+  install: true,
+  install_dir: vte_pkgincludedir,
+)
+
+enum_types = 'vtetypebuiltins'
+
+vtetype_enums = gnome.mkenums(
+  enum_types + '.h',
+  sources: enum_headers,
+  c_template: '../' + enum_types + '.cc.template',
+  h_template: '../' + enum_types + '.h.template',
+  install_header: true,
+  install_dir: vte_pkgincludedir,
+)


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