summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIñigo Martínez <inigomartinez@gmail.com>2017-07-05 19:45:26 +0200
committerIñigo Martínez <inigomartinez@gmail.com>2017-08-05 18:28:02 +0200
commitcae744c3d31a6bbff4c85ec0cacb42c976f0e6a3 (patch)
tree850590d26a1a4fc8f30b40e287d42a5fab96b57d
parent81076a12d5ba874fe29863ac6f98e8777e075e1e (diff)
downloadvte-cae744c3d31a6bbff4c85ec0cacb42c976f0e6a3.tar.gz
build: Port to meson build system
-rw-r--r--Makefile.am3
-rw-r--r--bindings/gir/Makefile.am2
-rw-r--r--bindings/gir/meson.build28
-rw-r--r--bindings/vala/Makefile.am2
-rw-r--r--bindings/vala/meson.build76
-rw-r--r--doc/openi18n/Makefile.am2
-rw-r--r--doc/openi18n/meson.build4
-rw-r--r--doc/reference/Makefile.am1
-rw-r--r--doc/reference/meson.build77
-rw-r--r--glade/Makefile.am1
-rw-r--r--glade/meson.build21
-rw-r--r--meson.build389
-rw-r--r--meson_options.txt8
-rw-r--r--po/meson.build1
-rw-r--r--src/Makefile.am5
-rw-r--r--src/meson.build245
-rw-r--r--src/vte/meson.build43
-rw-r--r--src/vte/vtetypebuiltins.h.template31
-rwxr-xr-xsrc/vteseq-n-list-gen.sh20
19 files changed, 955 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index 10c9c93b..5e88338e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,9 @@ EXTRA_DIST = \
HACKING \
autogen.sh \
ChangeLog.pre-git \
+ meson.build \
+ meson_options.txt \
+ po/meson.build \
$(NULL)
DISTCLEANFILES =
diff --git a/bindings/gir/Makefile.am b/bindings/gir/Makefile.am
index 1e0e262d..bd5efe7c 100644
--- a/bindings/gir/Makefile.am
+++ b/bindings/gir/Makefile.am
@@ -1,6 +1,6 @@
CLEANFILES =
DISTCLEANFILES =
-EXTRA_DIST =
+EXTRA_DIST = meson.build
INTROSPECTION_GIRS = Vte-$(VTE_API_VERSION).gir
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
diff --git a/bindings/gir/meson.build b/bindings/gir/meson.build
new file mode 100644
index 00000000..259ba274
--- /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/Makefile.am b/bindings/vala/Makefile.am
index 0078ad40..a484fb03 100644
--- a/bindings/vala/Makefile.am
+++ b/bindings/vala/Makefile.am
@@ -6,7 +6,7 @@ endif
CLEANFILES =
DISTCLEANFILES =
-EXTRA_DIST =
+EXTRA_DIST = meson.build
# VAPI
diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build
new file mode 100644
index 00000000..5d7793bd
--- /dev/null
+++ b/bindings/vala/meson.build
@@ -0,0 +1,76 @@
+deps = [
+ 'gio-2.0',
+ 'glib-2.0',
+ 'gdk-' + gtk_api_version,
+ gtk_dep_name,
+ 'pango'
+]
+
+libvte_vapi = gnome.generate_vapi(
+ vte_api_name,
+ sources: libvte_gir[0],
+ packages: deps,
+ install: true,
+ install_dir: join_paths(vte_datadir, 'vala', 'vapi')
+)
+
+# VALA Test application
+sources = files(
+ 'app.vala',
+ 'config.vapi'
+)
+
+deps = files(
+ 'app.ui',
+ 'search-popover.ui'
+)
+
+sources += gnome.compile_resources(
+ 'appresources',
+ 'app.gresource.xml',
+ source_dir: '.',
+ c_name: 'app',
+ dependencies: deps,
+ export: true
+)
+
+incs = [
+ top_inc,
+ src_inc,
+ vte_inc
+]
+
+deps = [
+ gtk_dep,
+ libvte_vapi,
+ dependency('gio-2.0')
+]
+
+flags = [
+ '-Wno-unused-but-set-variable',
+ '-Wno-unused-variable'
+]
+
+args = [
+ '--target-glib=2.38',
+ '--pkg=posix'
+]
+
+if have_vala_0_31
+ args += '--disable-since-check'
+endif
+
+if have_gtk_3_16
+ args += '--define=GTK_3_16'
+endif
+
+executable(
+ vte_api_name,
+ sources: sources,
+ include_directories: incs,
+ dependencies: deps,
+ c_args: flags,
+ vala_args: args,
+ install: enable_test_application,
+ install_dir: vte_bindir
+)
diff --git a/doc/openi18n/Makefile.am b/doc/openi18n/Makefile.am
index 33974159..214a6c81 100644
--- a/doc/openi18n/Makefile.am
+++ b/doc/openi18n/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = UTF-8.txt wrap.txt
+EXTRA_DIST = UTF-8.txt wrap.txt meson.build
LIBS=
noinst_PROGRAMS = cursor
diff --git a/doc/openi18n/meson.build b/doc/openi18n/meson.build
new file mode 100644
index 00000000..d49b3a53
--- /dev/null
+++ b/doc/openi18n/meson.build
@@ -0,0 +1,4 @@
+executable(
+ 'cursor',
+ 'cursor.c'
+)
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index df357101..96e365d7 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -140,6 +140,7 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST += \
+ meson.build \
version.xml.in
# Files not to distribute
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 00000000..6974e441
--- /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/Makefile.am b/glade/Makefile.am
index 9f1db5b5..06420f3a 100644
--- a/glade/Makefile.am
+++ b/glade/Makefile.am
@@ -9,6 +9,7 @@ icons = \
$(NULL)
EXTRA_DIST = \
+ meson.build \
$(icons) \
$(NULL)
diff --git a/glade/meson.build b/glade/meson.build
new file mode 100644
index 00000000..69398088
--- /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 00000000..f87acfe7
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,389 @@
+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)
+
+vte_debug = get_option('buildtype').contains('debug')
+
+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.')
+
+config_h.set('VTE_DEBUG', vte_debug,
+ description: 'Enable debugging messages.')
+
+# 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 = []
+
+if vte_debug
+ 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
+
+ flag = '-fvisibility=hidden'
+ assert(cxx.has_argument(flag), cxx.get_id() + ' doesn\'t support required flag -fvisibility=hidden')
+ common_cxx_flags += [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')
+
+enable_b_symbolic = get_option('enable-Bsymbolic')
+if enable_b_symbolic != 'no'
+ ldflag = '-Wl,-Bsymbolic-functions'
+
+ if host_machine.system().contains('linux') and cc.has_argument(ldflag)
+ add_project_link_arguments(ldflag, language: 'c')
+ else
+ if enable_b_symbolic == 'yes'
+ error('-Bsymbolic requested but not supported by ld. Use -Densable-Bsymbolic=false to disable')
+ endif
+ message('-Bsymbolic not supported by ld; disabling')
+ endif
+
+ if host_machine.system().contains('linux') and cxx.has_argument(ldflag)
+ add_project_link_arguments(ldflag, language: 'cpp')
+ else
+ if enable_b_symbolic == 'yes'
+ error('-Bsymbolic requested but not supported by cxx ld. Use -Denable-Bsymbolic=false to disable')
+ endif
+ message('-Bsymbolic not supported by ld; disabling')
+ endif
+endif
+
+glib_req_version = '>= 2.40.0'
+pango_req_version = '>= 1.22.0'
+libpcre_req_version = '>= 10.21'
+gnutls_req_version = '>= 3.2.7'
+
+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,
+ gtk_dep,
+ dependency('gio-2.0'),
+ dependency('gio-unix-2.0'),
+ dependency('libpcre2-8', version: libpcre_req_version),
+ dependency('pango', version: pango_req_version),
+ dependency('threads'),
+ dependency('zlib')
+]
+
+enable_gnutls = get_option('enable-gnutls')
+if enable_gnutls
+ vte_deps += dependency('gnutls', version: gnutls_req_version)
+endif
+
+config_h.set('WITH_GNUTLS', enable_gnutls,
+ description: 'Define to 1 to enable gnutls support')
+
+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: ' + 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 00000000..ca8740d9
--- /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 00000000..7cef5417
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(vte_api_name, preset: 'glib')
diff --git a/src/Makefile.am b/src/Makefile.am
index fd8d5b19..ae6ef274 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,10 @@ noinst_PROGRAMS = testvte
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
-EXTRA_DIST =
+EXTRA_DIST = \
+ meson.build \
+ vte/meson.build \
+ $(NULL)
# The library
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000..a49379a2
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,245 @@
+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@']
+)
+
+cflags = [
+ '-DDATADIR="@0@"'.format(vte_datadir),
+ '-DG_LOG_DOMAIN="Vte"',
+ '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
+ '-DLIBEXECDIR="@0@"'.format(vte_libexecdir),
+ '-DLOCALEDIR="@0@"'.format(vte_localedir),
+ '-DVTE_API_VERSION="@0@"'.format(vte_api_version),
+ '-DVTE_COMPILATION'
+]
+
+libvte = shared_library(
+ 'vte-' + vte_api_version,
+ sources: sources,
+ version: libversion,
+ include_directories: [top_inc, vte_inc],
+ dependencies: vte_deps,
+ cpp_args: 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=' + vte_libexecdir,
+ 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'
+]
+
+# 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)
+]
+
+reaper_sources = files(
+ 'debug.cc',
+ 'reaper.cc'
+)
+
+table_sources = files(
+ 'caps.cc',
+ 'debug.cc',
+ 'matcher.cc',
+ 'table.cc',
+ 'vteconv.cc'
+)
+
+vtestream_file_sources = files(
+ 'vtestream.cc',
+ 'vteutils.cc'
+)
+
+programs = [
+ # name, sources, dependencies, cflags, cxxflags
+ ['testvte', testvte_sources, [libvte_dep], testvte_cflags, []],
+ ['interpret', interpret_sources, interpret_deps, [], interpret_cflags],
+ ['slowcat', 'slowcat.c', [glib_dep], [], []],
+ ['dumpkeys', 'dumpkeys.c', [glib_dep], [], []],
+ ['reaper', reaper_sources, vte_deps, [], ['-DMAIN']],
+ ['reflect-text-view', 'reflect.c', [libvte_dep], ['-DUSE_TEXT_VIEW'], []],
+ ['reflect-vte', 'reflect.c', [libvte_dep], ['-DUSE_VTE'], []],
+ ['mev', 'mev.c', [glib_dep], [], []],
+ ['table', table_sources, [gobject_dep, glib_dep], [], ['-DTABLE_MAIN']],
+ ['xticker', 'xticker.c', [glib_dep], [], []],
+ ['vteconv', 'vteconv.cc', vte_deps, [], ['-DVTECONV_MAIN']],
+ ['vtestream-file', vtestream_file_sources, vte_deps, [], ['-DVTESTREAM_MAIN']],
+ ['test-vtetypes', 'vtetypes.cc', vte_deps, [], ['-DMAIN']]
+]
+
+foreach program: programs
+ executable(
+ program[0],
+ program[1],
+ include_directories: top_inc,
+ dependencies: program[2],
+ c_args: program[3],
+ cpp_args: program[4]
+ )
+endforeach
+
+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 00000000..57023949
--- /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 00000000..3f7b9dc3
--- /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 00000000..bb07b752
--- /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
+}