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



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

    build: Port to meson build system

 bindings/gir/meson.build           |   28 +++
 bindings/vala/meson.build          |   76 +++++++
 doc/openi18n/meson.build           |    4 +
 doc/reference/meson.build          |   77 +++++++
 glade/meson.build                  |   21 ++
 meson.build                        |  384 ++++++++++++++++++++++++++++++++++++
 meson_options.txt                  |    8 +
 po/meson.build                     |    1 +
 src/meson.build                    |  320 ++++++++++++++++++++++++++++++
 src/vte/meson.build                |   43 ++++
 src/vte/vtetypebuiltins.h.template |   31 +++
 src/vteseq-n-list-gen.sh           |   20 ++
 12 files changed, 1013 insertions(+), 0 deletions(-)
---
diff --git a/bindings/gir/meson.build b/bindings/gir/meson.build
new file mode 100644
index 0000000..259ba27
--- /dev/null
+++ b/bindings/gir/meson.build
@@ -0,0 +1,28 @@
+gir_incs = [
+  'Gdk-' + gtk_api_version,
+  'Gtk-' + gtk_api_version,
+  'Pango-1.0'
+]
+
+gir_extra_args = [
+  '-DVTE_COMPILATION',
+  '--c-include=vte/vte.h'
+]
+
+gir_dir = join_paths(vte_datadir, 'gir-' + vte_gir_version)
+typelib_dir = join_paths(vte_libdir, 'girepository-' + vte_gir_version)
+
+libvte_gir = gnome.generate_gir(
+  libvte,
+  sources: headers + vtetype_enums + gir_sources,
+  nsversion: vte_api_version,
+  namespace: vte_gir_ns,
+  export_packages: vte_api_name,
+  includes: gir_incs,
+  dependencies: libvte_dep,
+  include_directories: vte_inc,
+  install: true,
+  install_dir_gir: gir_dir,
+  install_dir_typelib: typelib_dir,
+  extra_args: gir_extra_args
+)
diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build
new file mode 100644
index 0000000..19fda92
--- /dev/null
+++ b/bindings/vala/meson.build
@@ -0,0 +1,76 @@
+vapi_deps = [
+  'glib-2.0',
+  'gio-2.0',
+  'pango',
+  'gdk-' + gtk_api_version,
+  gtk_dep_name
+]
+
+libvte_vapi = gnome.generate_vapi(
+  vte_api_name,
+  sources: libvte_gir[0],
+  packages: vapi_deps,
+  install: true,
+  install_dir: join_paths(vte_datadir, 'vala', 'vapi')
+)
+
+# VALA Test application
+test_sources = files(
+  'app.vala',
+  'config.vapi'
+)
+
+gresource_deps = files(
+  'app.ui',
+  'search-popover.ui'
+)
+
+test_sources += gnome.compile_resources(
+  'appresources',
+  'app.gresource.xml',
+  source_dir: '.',
+  c_name: 'app',
+  dependencies: gresource_deps,
+  export: true
+)
+
+test_incs = [
+  top_inc,
+  src_inc,
+  vte_inc
+]
+
+test_deps = [
+  gtk_dep,
+  dependency('gio-2.0'),
+  libvte_vapi
+]
+
+test_flags = [
+  '-Wno-unused-but-set-variable',
+  '-Wno-unused-variable'
+]
+
+test_args = [
+  '--target-glib=2.38',
+  '--pkg=posix'
+]
+
+if have_vala_0_31
+  test_args += '--disable-since-check'
+endif
+
+if have_gtk_3_16
+  test_args += '--define=GTK_3_16'
+endif
+
+executable(
+  vte_api_name,
+  sources: test_sources,
+  include_directories: test_incs,
+  dependencies: test_deps,
+  c_args: test_flags,
+  vala_args: test_args,
+  install: enable_test_application,
+  install_dir: vte_bindir
+)
diff --git a/doc/openi18n/meson.build b/doc/openi18n/meson.build
new file mode 100644
index 0000000..d49b3a5
--- /dev/null
+++ b/doc/openi18n/meson.build
@@ -0,0 +1,4 @@
+executable(
+  'cursor',
+  'cursor.c'
+)
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 0000000..6974e44
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,77 @@
+private_headers = [
+  'config.h',
+  'buffer.h',
+  'caps.h',
+  'debug.h',
+  'iso2022.h',
+  'keymap.h',
+  'marshal.h',
+  'matcher.h',
+  'ring.h',
+  'table.h',
+  'trie.h',
+  'vteconv.h',
+  'vtedraw.h',
+  'vteinternal.hh',
+  'vterowdata.h',
+  'vteseq-list.h',
+  'vtestream-base.h',
+  'vtestream-file.h',
+  'vtestream.h',
+  'vtetc.h',
+  'vtetree.h',
+  'vtetypebuiltins.h',
+  'vteunistr.h'
+]
+
+version_conf = configuration_data()
+version_conf.set('VERSION', vte_version)
+
+version_xml = 'version.xml'
+
+configure_file(
+  input: version_xml + '.in',
+  output: version_xml,
+  configuration: version_conf
+)
+
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
+gtk_doc_path = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html')
+
+doc_path = join_paths(vte_datadir, 'gtk-doc', 'html', vte_api_name)
+
+gnome.gtkdoc(
+  meson.project_name(),
+  main_xml: meson.project_name() + '-docs.xml',
+  src_dir: [
+    top_inc,
+    src_inc,
+    vte_inc
+  ],
+  dependencies: libvte_dep,
+  scan_args: [
+    '--rebuild-types',
+    '--ignore-headers=' + ' '.join(private_headers),
+    '--deprecated-guards="VTE_DISABLE_DEPRECATED"',
+    '--ignore-decorators=_VTE_GNUC_NONNULL\s*\([^)]*\)'
+  ],
+  mkdb_args: [
+    '--source-suffixes=h,hh,c,cc',
+    '--xml-mode',
+    '--output-format=xml',
+    '--name-space=' + meson.project_name()
+  ],
+  gobject_typesfile: meson.project_name() + '.types',
+  fixxref_args: [
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'glib')),
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'gio')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gdk')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gdk-pixbuf')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gtk'))
+  ],
+  install: true,
+  install_dir: doc_path
+)
diff --git a/glade/meson.build b/glade/meson.build
new file mode 100644
index 0000000..6939808
--- /dev/null
+++ b/glade/meson.build
@@ -0,0 +1,21 @@
+vte_xml = 'vte.xml'
+
+vte_conf = configuration_data()
+vte_conf.set('VTE_API_VERSION', vte_api_version)
+vte_conf.set('VERSION', vte_version)
+
+vte_api_name_in = configure_file(
+  input: vte_xml + '.in.in',
+  output: vte_api_name + '.xml.in',
+  configuration: vte_conf
+)
+
+intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
+
+custom_target(
+  vte_xml,
+  input: vte_api_name_in,
+  output: vte_api_name + '.xml',
+  command: [find_program('intltool-merge'), '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'],
+  build_by_default: true
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..0a4d798
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,384 @@
+project(
+  'vte', ['c', 'cpp'],
+  version: '0.49.2',
+  license: 'LGPL2.1',
+  default_options: [
+    'buildtype=debugoptimized',
+    'cpp_std=c++11',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.41.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_gir_ns = 'Vte'
+vte_gir_version = '1.0'
+
+enable_gir = get_option('enable-introspection')
+enable_vala = get_option('enable-vala')
+enable_test_application = get_option('enable-test-application')
+enable_glade_catalogue = get_option('enable-glade-catalogue')
+
+if get_option('with-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_test_application = 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 = join_paths(vte_api_name, meson.project_name())
+
+vte_prefix = get_option('prefix')
+vte_bindir = join_paths(vte_prefix, get_option('bindir'))
+vte_datadir = join_paths(vte_prefix, get_option('datadir'))
+vte_libdir = join_paths(vte_prefix, get_option('libdir'))
+vte_libexecdir = join_paths(vte_prefix, get_option('libexecdir'))
+vte_localedir = join_paths(vte_prefix, get_option('localedir'))
+vte_includedir = join_paths(vte_prefix, get_option('includedir'))
+vte_sysconfdir = join_paths(vte_prefix, get_option('sysconfdir'))
+
+vte_pkgincludedir = join_paths(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)
+
+cc = meson.get_compiler('c')
+cxx = meson.get_compiler('cpp')
+
+config_h = configuration_data()
+
+# defines
+set_defines = [
+  # package
+  ['PACKAGE', meson.project_name()],
+  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + meson.project_name()],
+  ['PACKAGE_NAME', meson.project_name()],
+  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), vte_version)],
+  ['PACKAGE_TARNAME', meson.project_name()],
+  ['PACKAGE_URL', ''],
+  ['PACKAGE_VERSION', vte_version],
+  ['VERSION', vte_version],
+  # i18n
+  ['GETTEXT_PACKAGE', vte_api_name]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+config_h.set_quoted('VTE_DEFAULT_TERM', 'xterm-256color',
+                    description: 'The default value $TERM is set to.')
+
+# headers
+check_headers = [
+  ['HAVE_DLFCN_H', 'dlfcn.h'],
+  ['HAVE_INTTYPES_H', 'inttypes.h'],
+  ['HAVE_LOCALE_H', 'locale.h'],
+  ['HAVE_MEMORY_H', 'memory.h'],
+  ['HAVE_PTY_H', 'pty.h'],
+  ['HAVE_STDINT_H', 'stdint.h'],
+  ['HAVE_STDLIB_H', 'stdlib.h'],
+  ['HAVE_STRINGS_H', 'strings.h'],
+  ['HAVE_STRING_H', 'string.h'],
+  ['HAVE_STROPTS_H', 'stropts.h'],
+  ['HAVE_SYS_SELECT_H', 'sys/select.h'],
+  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+  ['HAVE_SYS_SYSLIMITS_H', 'sys/syslimits.h'],
+  ['HAVE_SYS_TERMIOS_H', 'sys/termios.h'],
+  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+  ['HAVE_SYS_WAIT_H', 'sys/wait.h'],
+  ['HAVE_TERMIOS_H', 'termios.h'],
+  ['HAVE_UNISTD_H', 'unistd.h'],
+  ['HAVE_UTIL_H', 'util.h'],
+  ['HAVE_WCHAR_H', 'wchar.h'],
+  # for vtespawn
+  ['HAVE_SYS_RESOURCE_H', 'sys/resource.h']
+]
+
+foreach header: check_headers
+  config_h.set(header[0], cc.has_header(header[1]))
+endforeach
+
+# functions
+check_functions = [
+  # i18n
+  ['HAVE_DCGETTEXT', 'dcgettext'],
+  ['HAVE_GETTEXT', 'gettext'],
+  # Check for how to open a new PTY. We support posix_openpt and BSDs openpty
+  ['HAVE_GRANTPT', 'grantpt'],
+  ['HAVE_POSIX_OPENPT', 'posix_openpt'],
+  ['HAVE_PTSNAME', 'ptsname'],
+  ['HAVE_UNLOCKPT', 'unlockpt'],
+  # Misc PTY handling functions
+  ['HAVE_CFMAKERAW', 'cfmakeraw'],
+  ['HAVE_FORK', 'fork'],
+  ['HAVE_GETPGID', 'getpgid'],
+  ['HAVE_SETPGID', 'setpgid'],
+  ['HAVE_SETSID', 'setsid'],
+  ['HAVE_TCGETATTR', 'tcgetattr'],
+  ['HAVE_TCSETATTR', 'tcsetattr'],
+  # Misc I/O routines.
+  ['HAVE_PREAD', 'pread'],
+  ['HAVE_PWRITE', 'pwrite'],
+  ['HAVE_EXPLICIT_BZERO', 'explicit_bzero'],
+  # for vtespawn
+  ['HAVE_FDWALK', 'fdwalk']
+]
+
+if host_machine.system().contains('darwin')
+  check_functions += [
+    ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
+    ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
+  ]
+endif
+
+foreach func: check_functions
+  config_h.set(func[0], cc.has_function(func[1]))
+endforeach
+
+# Math functions
+m_deps = []
+if not cc.has_function('floor')
+  m_deps += cc.find_library('m', required: false)
+endif
+
+config_h.set('HAVE_CEIL', cc.has_function('ceil', dependencies: m_deps))
+config_h.set('HAVE_FLOOR', cc.has_function('floor', dependencies: m_deps))
+config_h.set('HAVE_ROUND', cc.has_function('round', dependencies: m_deps))
+
+# symbols
+check_symbols = [
+  ['GWINSZ_IN_SYS_IOCTL', 'sys/ioctl.h', 'TIOCGWINSZ'],
+  ['HAVE_LC_MESSAGES', 'locale.h', 'LC_MESSAGES'],
+  ['HAVE_WINT_T', 'wchar.h', 'wint_t']
+]
+
+foreach symbol: check_symbols
+  config_h.set(symbol[0], cc.has_header_symbol(symbol[1], symbol[2]))
+endforeach
+
+# i18n
+have_bind_textdomain_codeset = cc.has_header_symbol('libintl.h', 'bind_textdomain_codeset')
+config_h.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
+config_h.set('HAVE_DECL_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+common_c_flags = []
+common_cxx_flags = []
+
+buildtype = get_option('buildtype')
+if buildtype == 'debug' or buildtype == 'debugoptimized'
+  config_h.set('VTE_DEBUG', true,
+               description: 'Enable debugging messages.')
+
+  common_test_flags = [
+    '-fno-common',
+    '-fdiagnostics-show-option',
+    '-fno-semantic-interposition',
+    '-fno-strict-aliasing',
+    '-fstack-protector',
+    '-fstack-protector-strong',
+    '-pipe',
+    '-Wcast-align',
+    '-Wendif-labels',
+    '-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',
+    '-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'
+  ]
+
+  test_flags = [
+    '-Waggregate-return',
+    '-Wnested-externs',
+    '-Wstrict-prototypes'
+  ]
+
+  foreach flag: common_test_flags + test_flags
+    if cc.has_argument(flag)
+      common_c_flags += [flag]
+    endif
+  endforeach
+
+  hidden_flag = '-fvisibility=hidden'
+  assert(cxx.has_argument(hidden_flag), cxx.get_id() + ' doesn\'t support required flag -fvisibility=hidden')
+  common_cxx_flags += [hidden_flag]
+
+  test_flags = [
+    '-fno-rtti',
+    '-fno-exceptions',
+    '-fvisibility-inlines-hidden',
+    '-Wstrict-null-sentinel'
+  ]
+
+  foreach flag: common_test_flags + test_flags
+    if cxx.has_argument(flag)
+      common_cxx_flags += [flag]
+    endif
+  endforeach
+endif
+
+add_project_arguments(common_flags + common_c_flags, language: 'c')
+add_project_arguments(common_flags + common_cxx_flags, language: 'cpp')
+
+glib_req_version = '>= 2.40.0'
+pango_req_version = '>= 1.22.0'
+libpcre_req_version = '>= 10.21'
+gnutls_req_version = '>= 3.2.7'
+
+enable_b_symbolic = get_option('enable-Bsymbolic')
+if enable_b_symbolic != 'no'
+  have_b_symbolic = false
+
+  ldflag = '-Wl,-Bsymbolic-functions'
+
+  if host_machine.system().contains('linux')
+    if cc.has_argument(ldflag) and cxx.has_argument(ldflag)
+      have_b_symbolic = true
+    endif
+  endif
+
+  if not have_b_symbolic
+    assert(enable_b_symbolic == 'yes', '-Bsymbolic requested but not supported by cxx ld. Use 
-Denable-Bsymbolic=false to disable')
+  endif
+
+  add_project_link_arguments(ldflag, language: 'c')
+  add_project_link_arguments(ldflag, language: 'cpp')
+endif
+
+if get_option('enable-gnutls')
+  gnutls_dep = dependency('gnutls', version: gnutls_req_version)
+  config_h.set('WITH_GNUTLS', true,
+               description: 'Define to 1 to enable gnutls support')
+endif
+
+glib_dep = dependency('glib-2.0', version: glib_req_version)
+gobject_dep = dependency('gobject-2.0')
+
+gtk_dep = dependency(gtk_dep_name, version: gtk_req_version)
+have_gtk_3_16 = gtk_dep.version().version_compare('>= 3.16')
+
+vte_deps = m_deps + [
+  glib_dep,
+  gobject_dep,
+  dependency('pango', version: pango_req_version),
+  gtk_dep,
+  dependency('gio-2.0'),
+  dependency('gio-unix-2.0'),
+  dependency('zlib'),
+  dependency('libpcre2-8', version: libpcre_req_version),
+  gnutls_dep,
+  dependency('threads')
+]
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+top_inc = include_directories('.')
+
+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 
-Denable-introspection=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 -Denable-vala=false'
+
+  assert(add_languages('vala', required: false), error_str)
+  valac_version = meson.get_compiler('vala').version()
+  assert(valac_version.version_compare(vala_req_version), error_str)
+
+  have_vala_0_31 = valac_version.version_compare('>= 0.31.1')
+
+  subdir('bindings/vala')
+endif
+
+subdir('po')
+
+if get_option('enable-gtk-doc')
+  subdir('doc/openi18n')
+  subdir('doc/reference')
+endif
+
+if enable_glade_catalogue
+  glade_dep = dependency(glade_dep_name)
+  assert(glade_dep.found(), glade_dep_name + ' not found')
+
+  glade_catalogue_dir = glade_dep.get_pkgconfig_variable('catalogdir')
+  glade_icon_dir = glade_dep.get_pkgconfig_variable('pixmapdir')
+  glade_module_dir = glade_dep.get_pkgconfig_variable('moduledir')
+
+  # FIXME icon copy/rename is not supported yet
+  #       https://github.com/mesonbuild/meson/issues/1487
+  subdir('glade')
+endif
+
+output = 'Configuration for libvte ' + vte_version + ' for ' + gtk_dep_name + '\n'
+output += '  GNUTLS: ' + get_option('enable-gnutls').to_string() + '\n'
+output += '  Installing Glade catalogue: ' + enable_glade_catalogue.to_string() + '\n'
+output += '  Introspection: ' + enable_glade_catalogue.to_string() + '\n'
+output += '        Vala binginds: ' + enable_vala.to_string() + '\n'
+output += '        Test application: ' + enable_test_application.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..ca8740d
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,8 @@
+option('with-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('enable-glade-catalogue', type: 'boolean', value: true, description: 'enable installing the glade 
catalogue')
+option('enable-vala', type: 'boolean', value: true, description: 'build Vala bindings')
+option('enable-Bsymbolic', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 
'enable linking with -Bsymbolic')
+option('enable-gnutls', type: 'boolean', value: true, description: 'enable gnutls support')
+option('enable-gtk-doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('enable-introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection 
(depends on GObject)')
+option('enable-test-application', type: 'boolean', value: true, description: 'enable installing the vala 
test application')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..7cef541
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(vte_api_name, preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..df5f364
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,320 @@
+subdir('vte')
+
+src_inc = include_directories('.')
+
+vtetype_enums = [vtetype_header]
+vtetype_enums += gnome.mkenums(
+  vtetype + '.cc',
+  sources: enum_headers,
+  c_template: vtetype + '.cc.template'
+)
+
+gir_sources = files(
+  'pty.cc',
+  'vtegtk.cc'
+)
+
+sources = vtetype_enums + gir_sources + files(
+  'caps.cc',
+  'debug.cc',
+  'iso2022.cc',
+  'keymap.cc',
+  'matcher.cc',
+  'reaper.cc',
+  'ring.cc',
+  'table.cc',
+  'vte.cc',
+  'vteaccess.cc',
+  'vteconv.cc',
+  'vtedraw.cc',
+  'vteregex.cc',
+  'vterowdata.cc',
+  'vtespawn.cc',
+  'vteseq.cc',
+  'vtestream.cc',
+  'vtetree.cc',
+  'vtetypes.cc',
+  'vteunistr.cc',
+  'vteutils.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',
+  source_dir: '.',
+  c_name: '_vte',
+  export: true
+)
+
+sources += gnome.genmarshal(
+  'marshal',
+  sources: 'marshal.list',
+  prefix: '_vte_marshal'
+)
+
+vteseq_gperf = 'vteseq-n.gperf'
+
+vteseq_cc = 'vteseq-n.cc'
+
+# FIXME: meson tries to compile it due to the .cc extension.
+# build_by_default is used as a workaround.
+custom_target(
+  vteseq_cc,
+  input: vteseq_gperf,
+  output: vteseq_cc,
+  capture: true,
+  command: [find_program('gperf'), '-m', '100', '@INPUT@'],
+  build_by_default: true
+)
+
+vteseq_list = 'vteseq-list.h'
+
+sources += custom_target(
+  vteseq_list,
+  input: vteseq_gperf,
+  output: vteseq_list,
+  capture: true,
+  command: [find_program('vteseq-n-list-gen.sh'), '@INPUT@']
+)
+
+libvte_cflags = [
+  '-DG_LOG_DOMAIN="Vte"',
+  '-DVTE_API_VERSION="@0@"'.format(vte_api_version),
+  '-DDATADIR="@0@"'.format(vte_datadir),
+  '-DLIBEXECDIR="@0@"'.format(vte_libexecdir),
+  '-DLOCALEDIR="@0@"'.format(vte_localedir),
+  '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
+  '-DVTE_COMPILATION'
+]
+
+libvte = shared_library(
+  'vte-' + vte_api_version,
+  sources: sources,
+  version: libversion,
+  include_directories: [top_inc, vte_inc],
+  dependencies: vte_deps,
+  cpp_args: libvte_cflags,
+  install: true,
+  install_dir: vte_libdir
+)
+
+libvte_dep = declare_dependency(
+  link_with: libvte,
+  include_directories: [src_inc, vte_inc],
+  dependencies: vte_deps
+)
+
+pkg.generate(
+  libraries: libvte,
+  version: vte_version,
+  name: meson.project_name(),
+  description: 'Vte terminal widget.',
+  filebase: vte_api_name,
+  subdirs: vte_api_name,
+  requires: [
+    'glib-2.0 ' + glib_req_version,
+    'gobject-2.0',
+    'pango ' + pango_req_version,
+    gtk_dep_name + ' ' + gtk_req_version,
+    'gio-2.0',
+    'gio-unix-2.0',
+    'zlib',
+    'libpcre2-8 ' + libpcre_req_version,
+    'gnutls ' + gnutls_req_version
+  ],
+  variables: 'exec_prefix=${prefix}',
+  install_dir: join_paths(vte_libdir, 'pkgconfig')
+)
+
+# C Test application
+testvte_sources = [vtetype_header]
+testvte_sources += files(
+  'debug.c',
+  'vteapp.c'
+)
+
+testvte_cflags = [
+  '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
+  '-DGDK_DISABLE_DEPRECATION_WARNINGS'
+]
+
+executable(
+  'testvte',
+  testvte_sources,
+  include_directories: top_inc,
+  dependencies: libvte_dep,
+  c_args: testvte_cflags
+)
+
+# Misc unit tests and utilities
+interpret_sources = files(
+  'caps.cc',
+  'debug.cc',
+  'iso2022.cc',
+  'matcher.cc',
+  'table.cc',
+  'vteconv.cc',
+  'vtetree.cc',
+  'interpret.c'
+)
+
+interpret_deps = [
+  glib_dep,
+  gobject_dep,
+  gtk_dep
+]
+
+interpret_cflags = [
+  '-DINTERPRET_MAIN',
+  '-DVTE_API_VERSION="@0@"'.format(vte_api_version)
+]
+
+executable(
+  'interpret',
+  interpret_sources,
+  include_directories: top_inc,
+  dependencies: interpret_deps,
+  cpp_args: interpret_cflags
+)
+
+executable(
+  'slowcat',
+  'slowcat.c',
+  include_directories: top_inc,
+  dependencies: glib_dep
+)
+
+executable(
+  'dumpkeys',
+  'dumpkeys.c',
+  include_directories: top_inc,
+  dependencies: glib_dep
+)
+
+reaper_sources = files(
+  'debug.cc',
+  'reaper.cc'
+)
+
+executable(
+  'reaper',
+  reaper_sources,
+  include_directories: top_inc,
+  dependencies: vte_deps,
+  cpp_args: '-DMAIN'
+)
+
+executable(
+  'reflect-text-view',
+  'reflect.c',
+  include_directories: top_inc,
+  dependencies: libvte_dep,
+  c_args: '-DUSE_TEXT_VIEW'
+)
+
+executable(
+  'reflect-vte',
+  'reflect.c',
+  include_directories: top_inc,
+  dependencies: libvte_dep,
+  c_args: '-DUSE_VTE'
+)
+
+executable(
+  'mev',
+  'mev.c',
+  include_directories: top_inc,
+  dependencies: glib_dep
+)
+
+table_sources = files(
+  'caps.cc',
+  'debug.cc',
+  'matcher.cc',
+  'table.cc',
+  'vteconv.cc'
+)
+
+executable(
+  'table',
+  table_sources,
+  include_directories: top_inc,
+  dependencies: [
+    gobject_dep,
+    glib_dep
+  ],
+  cpp_args: '-DTABLE_MAIN'
+)
+
+executable(
+  'xticker',
+  'xticker.c',
+  include_directories: top_inc,
+  dependencies: glib_dep
+)
+
+executable(
+  'vteconv',
+  'vteconv.cc',
+  include_directories: top_inc,
+  dependencies: vte_deps,
+  cpp_args: '-DVTECONV_MAIN'
+)
+
+vtestream_file_sources = files(
+  'vtestream.cc',
+  'vteutils.cc'
+)
+
+executable(
+  'vtestream-file',
+  vtestream_file_sources,
+  include_directories: top_inc,
+  dependencies: vte_deps,
+  cpp_args: '-DVTESTREAM_MAIN'
+)
+
+executable(
+  'test-vtetypes',
+  'vtetypes.cc',
+  include_directories: top_inc,
+  dependencies: vte_deps,
+  cpp_args: '-DMAIN'
+)
+
+test_env = [
+  'srcdir=' + meson.current_source_dir(),
+  'top_builddir=' + meson.build_root(),
+  'VTE_API_VERSION="@0@"'.format(vte_api_version)
+]
+
+unit_tests = [
+  # FIXME: the test fails due to two reasons
+  # 1. set: -i: invalid option
+  # 2. __vte_urlencode: command not found
+  #'test-vte-sh.sh',
+  'check-doc-syntax.sh'
+]
+
+foreach unit: unit_tests
+  test(
+    unit,
+    find_program(unit),
+    env: test_env
+  )
+endforeach
+
+install_data(
+  'vte.sh',
+  install_dir: join_paths(vte_sysconfdir, 'profile.d')
+)
diff --git a/src/vte/meson.build b/src/vte/meson.build
new file mode 100644
index 0000000..5702394
--- /dev/null
+++ b/src/vte/meson.build
@@ -0,0 +1,43 @@
+vte_inc = include_directories('.')
+
+enum_headers = files(
+  'vtedeprecated.h',
+  'vteenums.h'
+)
+
+headers = enum_headers + files(
+  'vte.h',
+  'vteglobals.h',
+  'vtemacros.h',
+  'vtepty.h',
+  'vteregex.h',
+  'vteterminal.h'
+)
+
+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'
+
+headers += configure_file(
+  input: vteversion + '.in',
+  output: vteversion,
+  configuration: vteversion_conf
+)
+
+install_headers(
+  headers,
+  subdir: vte_api_path
+)
+
+vtetype = 'vtetypebuiltins'
+
+vtetype_header = gnome.mkenums(
+  vtetype + '.h',
+  sources: enum_headers,
+  h_template: vtetype + '.h.template',
+  install_header: true,
+  install_dir: vte_pkgincludedir
+)
diff --git a/src/vte/vtetypebuiltins.h.template b/src/vte/vtetypebuiltins.h.template
new file mode 100644
index 0000000..3f7b9dc
--- /dev/null
+++ b/src/vte/vtetypebuiltins.h.template
@@ -0,0 +1,31 @@
+/*** BEGIN file-header ***/
+#if !defined (__VTE_VTE_H_INSIDE__) && !defined (VTE_COMPILATION)
+#error "Only <vte/vte.h> can be included directly."
+#endif
+
+#ifndef __VTE_VTE_TYPE_BUILTINS_H__
+#define __VTE_VTE_TYPE_BUILTINS_H__
+
+#include <glib-object.h>
+
+#include "vtemacros.h"
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@basename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+_VTE_PUBLIC
+GType @enum_name@_get_type (void);
+#define VTE_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __VTE_VTE_TYPE_BUILTINS_H__ */
+/*** END file-tail ***/
diff --git a/src/vteseq-n-list-gen.sh b/src/vteseq-n-list-gen.sh
new file mode 100755
index 0000000..bb07b75
--- /dev/null
+++ b/src/vteseq-n-list-gen.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+#
+# 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 2 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, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+{
+  echo '/* Generated file.  Do not edit */'
+  grep -v '^#' $1 | grep '\<VTE_SEQUENCE_HANDLER\>'| sed 's/.*, //' | LANG=C sort -u
+}


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