[gtk-vnc] build: add initial meson build recipes



commit 4248710f63cf182e006a062e2f92f2f7a5737552
Author: Daniel P. Berrangé <berrange redhat com>
Date:   Mon Aug 5 16:47:28 2019 +0100

    build: add initial meson build recipes
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 GNUmakefile              |  33 +---
 Makefile.am              |   8 +
 config-meson.h.in        |  41 +++++
 examples/meson.build     |  13 ++
 maint.mk                 |   2 -
 meson.build              | 329 ++++++++++++++++++++++++++++++++++++
 meson_options.txt        |   4 +
 po/meson.build           |   2 +
 src/meson.build          | 421 +++++++++++++++++++++++++++++++++++++++++++++++
 subprojects/keycodemapdb |   2 +-
 tools/meson.build        |  27 +++
 11 files changed, 851 insertions(+), 31 deletions(-)
---
diff --git a/GNUmakefile b/GNUmakefile
index da25113..5aef9c0 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -20,10 +20,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-# If the user runs GNU make but has not yet run ./configure,
-# give them a diagnostic.
 _gl-Makefile := $(wildcard [M]akefile)
 ifneq ($(_gl-Makefile),)
+include Makefile
+else
+srcdir = .
+top_srcdir = .
+endif
 
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
@@ -31,8 +34,6 @@ export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
 # Allow the user to add to this in the Makefile.
 ALL_RECURSIVE_TARGETS =
 
-include Makefile
-
 # Some projects override e.g., _autoreconf here.
 -include $(srcdir)/cfg.mk
 
@@ -84,30 +85,6 @@ _version:
        cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
        $(MAKE) $(AM_MAKEFLAGS) Makefile
 
-else
-
-.DEFAULT_GOAL := abort-due-to-no-makefile
-srcdir = .
-
-# The package can override .DEFAULT_GOAL to run actions like autoreconf.
--include ./cfg.mk
-
-# Allow cfg.mk to override these.
-_build-aux ?= build-aux
-_autoreconf ?= autoreconf -v
-
-include ./maint.mk
-
-ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
-$(MAKECMDGOALS): abort-due-to-no-makefile
-endif
-
-abort-due-to-no-makefile:
-       @echo There seems to be no Makefile in this directory.   1>&2
-       @echo "You must run ./configure before running 'make'." 1>&2
-       @exit 1
-
-endif
 
 # Tell version 3.79 and up of GNU make to not build goals in this
 # directory in parallel, in case someone tries to build multiple
diff --git a/Makefile.am b/Makefile.am
index 514a0d0..9792dde 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,6 +9,14 @@ pkgconfig_DATA += gvncpulse-1.0.pc
 endif
 
 EXTRA_DIST =                           \
+       meson.build                     \
+       po/meson.build                  \
+       src/meson.build                 \
+       examples/meson.build            \
+       tools/meson.build               \
+       subprojects/keycodemapdb/meson.build \
+       meson_options.txt               \
+       config-meson.h.in               \
        $(PACKAGE).spec                 \
        intltool-extract.in             \
        intltool-merge.in               \
diff --git a/config-meson.h.in b/config-meson.h.in
new file mode 100644
index 0000000..3edbbdf
--- /dev/null
+++ b/config-meson.h.in
@@ -0,0 +1,41 @@
+
+/* Whether GIO UNIX is available */
+#mesondefine HAVE_GIOUNIX
+
+/* whether pulseaudio is available */
+#mesondefine HAVE_PULSEAUDIO
+
+/* whether Cyrus SASL is available */
+#mesondefine HAVE_SASL
+
+/* whether ucontext coroutine is used */
+#mesondefine WITH_UCONTEXT
+
+/* TLS default priority string */
+#define TLS_PRIORITY "@tls_priority@"
+
+/* GLib logging domain */
+#define G_LOG_DOMAIN "gtk-vnc"
+
+/* Gettext .mo file name */
+#define GETTEXT_PACKAGE "gtk-vnc"
+
+/* Application package name */
+#define PACKAGE "gtk-vnc"
+
+/* TLS default priority string */
+#define TLS_PRIORITY "@tls_priority@"
+
+/* Version string */
+#define VERSION "@version@"
+
+/* Version digits */
+#define VERSION_MAJOR @version_major@
+#define VERSION_MINOR @version_minor@
+#define VERSION_MICRO @version_micro@
+
+/* Config file dir */
+#define SYSCONFDIR "@sysconfdir@"
+
+/* gettext .mo dir */
+#define PACKAGE_LOCALE_DIR "@localedir@"
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 0000000..f8e8601
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,13 @@
+
+gvncviewer_deps = [gtk_vnc_dep]
+
+if libpulse_dep.found()
+  gvncviewer_deps += [gvncpulse_dep]
+endif
+
+gvncviewer = executable(
+  'gvncviewer',
+  sources: ['gvncviewer.c'],
+  dependencies: gvncviewer_deps,
+  install: false,
+)
diff --git a/maint.mk b/maint.mk
index 4e37efe..5491cd0 100644
--- a/maint.mk
+++ b/maint.mk
@@ -158,7 +158,6 @@ export LC_ALL = C
 ## Sanity checks.  ##
 ## --------------- ##
 
-ifneq ($(_gl-Makefile),)
 _cfg_mk := $(wildcard $(srcdir)/cfg.mk)
 
 # Collect the names of rules starting with 'sc_'.
@@ -200,7 +199,6 @@ local-check :=                                                              \
     $(filter-out $(local-checks-to-skip), $(local-checks-available)))
 
 syntax-check: $(local-check)
-endif
 
 # _sc_search_regexp
 #
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d91c7e8
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,329 @@
+project(
+  'gtk-vnc','c',
+  version: '0.9.0',
+  license: 'LGPLv2.1+',
+  default_options: [
+    'buildtype=debugoptimized',
+    'c_std=gnu99',
+    'warning_level=1',
+  ],
+  meson_version: '>= 0.46.0'
+)
+
+version_info = meson.project_version().split('.')
+version_major = '@0@'.format(version_info[0])
+version_minor = '@0@'.format(version_info[1])
+version_micro = '@0@'.format(version_info[2])
+
+conf_data = configuration_data()
+conf_data.set('version', meson.project_version())
+conf_data.set('version_major', version_major)
+conf_data.set('version_minor', version_minor)
+conf_data.set('version_micro', version_micro)
+
+run_target('syntax-check', command: ['make', '-C', meson.source_root(), 'syntax-check'])
+
+pod2man = find_program('pod2man')
+
+cc = meson.get_compiler('c')
+
+coroutine = get_option('with-coroutine')
+
+if coroutine == 'auto'
+  if host_machine.system() == 'windows'
+    coroutine = 'gthread'
+  else
+    coroutine = 'ucontext'
+  endif
+endif
+
+if coroutine == 'ucontext'
+  conf_data.set('WITH_UCONTEXT', true)
+elif coroutine != 'gthread'
+  error('Unknown coroutine backend')
+endif
+
+# gvnc
+glib_min_version = '2.42.0'
+gdk_pixbuf_min_version = '2.12.0'
+gcrypt_min_version = '1.5.0'
+gnutls_min_version = '3.1.18'
+# Should be newer, but fedora mingw pkgconfig is fubar
+zlib_min_version = '1.2.5'
+libsasl_min_version = '2.1.26'
+
+# gtk-vnc
+gtk_min_version = '3.0.0'
+cairo_min_version = '1.2.0'
+x11_min_version = '1.6.5'
+
+# gvncpule
+libpulse_min_version = '10.0'
+
+# common
+gobject_introspection_min_version = '1.56.0'
+
+
+gobject_dep = dependency('gobject-2.0', version: '>= ' + glib_min_version)
+gio_dep = dependency('gio-2.0', version: '>= ' + glib_min_version)
+gio_unix_dep = dependency('gio-unix-2.0', version: '>= ' + glib_min_version, required: false)
+if gio_unix_dep.found()
+  conf_data.set('HAVE_GIOUNIX', true)
+endif
+
+if coroutine == 'gthread'
+  gthread_dep = dependency('gthread-2.0', version: '>= ' + glib_min_version)
+else
+  gthread_dep = disabler()
+endif
+
+gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= ' + gdk_pixbuf_min_version)
+gtk_dep = dependency('gtk+-3.0', version: '>= ' + gtk_min_version)
+gcrypt_dep = dependency('libgcrypt', version: '>= ' + gcrypt_min_version)
+gnutls_dep = dependency('gnutls', version: '>= ' + gnutls_min_version)
+cairo_dep = dependency('cairo', version: '>= ' + cairo_min_version)
+x11_dep = dependency('x11', version: '>= ' + x11_min_version, required: false)
+libpulse_dep = dependency('libpulse-simple', version: '>= ' + libpulse_min_version, required: false)
+if libpulse_dep.found()
+  conf_data.set('HAVE_PULSEAUDIO', true)
+endif
+zlib_dep = dependency('zlib', version: '>= ' + zlib_min_version)
+libsasl_dep = dependency('libsasl2', version: '>= ' + libsasl_min_version, required: false)
+if libsasl_dep.found()
+  conf_data.set('HAVE_SASL', true)
+endif
+
+subproject('keycodemapdb')
+
+keymapgen = files('subprojects/keycodemapdb/tools/keymap-gen')
+keymapcsv = files('subprojects/keycodemapdb/data/keymaps.csv')
+
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+check_cflags = [
+  '-W',
+  '-Waddress',
+  '-Waggressive-loop-optimizations',
+  '-Wall',
+  '-Warray-bounds',
+  '-Wattributes',
+  '-Wbuiltin-macro-redefined',
+  '-Wchar-subscripts',
+  '-Wclobbered',
+  '-Wcomment',
+  '-Wcomments',
+  '-Wcoverage-mismatch',
+  '-Wcpp',
+  '-Wdate-time',
+  '-Wno-deprecated-declarations',
+  '-Wdisabled-optimization',
+  '-Wdiv-by-zero',
+  '-Wdouble-promotion',
+  '-Wempty-body',
+  '-Wendif-labels',
+  '-Wenum-compare',
+  '-Wextra',
+  '-Wformat-contains-nul',
+  '-Wformat-extra-args',
+  '-Wformat-security',
+  '-Wformat-y2k',
+  '-Wformat-zero-length',
+  '-Wfree-nonheap-object',
+  '-Wignored-qualifiers',
+  '-Wimplicit',
+  '-Wimplicit-function-declaration',
+  '-Wimplicit-int',
+  '-Winit-self',
+  '-Winline',
+  '-Wint-to-pointer-cast',
+  '-Winvalid-memory-model',
+  '-Winvalid-pch',
+  '-Wjump-misses-init',
+  '-Wlogical-op',
+  '-Wmain',
+  '-Wmaybe-uninitialized',
+  '-Wmissing-braces',
+  '-Wmissing-declarations',
+  '-Wmissing-field-initializers',
+  '-Wmissing-parameter-type',
+  '-Wmissing-prototypes',
+  '-Wmultichar',
+  '-Wnarrowing',
+  '-Wnested-externs',
+  '-Wnonnull',
+  '-Wold-style-declaration',
+  '-Wold-style-definition',
+  '-Wopenmp-simd',
+  '-Woverflow',
+  '-Woverride-init',
+  '-Wpacked',
+  '-Wpacked-bitfield-compat',
+  '-Wparentheses',
+  '-Wpointer-arith',
+  '-Wpointer-sign',
+  '-Wpointer-to-int-cast',
+  '-Wpragmas',
+  '-Wreturn-local-addr',
+  '-Wreturn-type',
+  '-Wsequence-point',
+  '-Wshadow',
+  '-Wsizeof-pointer-memaccess',
+  '-Wstack-protector',
+  '-Wstrict-aliasing',
+  '-Wstrict-overflow',
+  '-Wstrict-prototypes',
+  '-Wsuggest-attribute=const',
+  '-Wsuggest-attribute=format',
+  '-Wsuggest-attribute=noreturn',
+  '-Wsuggest-attribute=pure',
+  '-Wswitch',
+  '-Wswitch-default',
+  '-Wsync-nand',
+  '-Wtrampolines',
+  '-Wtrigraphs',
+  '-Wtype-limits',
+  '-Wuninitialized',
+  '-Wunknown-pragmas',
+  '-Wunsafe-loop-optimizations',
+  '-Wunused',
+  '-Wunused-but-set-parameter',
+  '-Wunused-but-set-variable',
+  '-Wunused-function',
+  '-Wunused-label',
+  '-Wunused-local-typedefs',
+  '-Wunused-parameter',
+  '-Wunused-result',
+  '-Wunused-value',
+  '-Wunused-variable',
+  '-Wvarargs',
+  '-Wvariadic-macros',
+  '-Wvector-operation-performance',
+  '-Wvla',
+  '-Wvolatile-register-var',
+  '-Wwrite-strings',
+  '-Wnormalized=nfc',
+  '-Wno-sign-compare',
+  '-Wno-sign-conversion',
+  '-Wno-conversion',
+  '-Wno-unsafe-loop-optimizations',
+  '-Wno-cast-function-type',
+  '-Wjump-misses-init',
+  '-Wframe-larger-than=40096',
+  '-O2',
+  '-Wp,-D_FORTIFY_SOURCE=2',
+  '-fexceptions',
+  '-fasynchronous-unwind-tables',
+  '-fdiagnostics-show-option',
+  '-funit-at-a-time',
+  '-fipa-pure-const',
+  '-Wno-suggest-attribute=pure',
+  '-Wno-suggest-attribute=const',
+]
+if host_machine.system() == 'linux'
+  check_cflags += [
+    '-fstack-protector-all',
+    '--param=ssp-buffer-size=4',
+  ]
+endif
+
+cflags = []
+foreach cflag: check_cflags
+  if cc.has_argument(cflag)
+    cflags += [cflag]
+  endif
+endforeach
+
+werror_option = get_option('enable-werror')
+if werror_option
+  if cc.has_argument('-Werror')
+    cflags += ['-Werror']
+  endif
+endif
+
+
+add_project_arguments(cflags, language: 'c')
+
+gtk_vnc_prefix = get_option('prefix')
+gtk_vnc_bindir = join_paths(gtk_vnc_prefix, get_option('bindir'))
+gtk_vnc_libdir = join_paths(gtk_vnc_prefix, get_option('libdir'))
+gtk_vnc_localedir = join_paths(gtk_vnc_prefix, get_option('localedir'))
+gtk_vnc_datadir = join_paths(gtk_vnc_prefix, get_option('datadir'))
+gtk_vnc_sysconfdir = join_paths(gtk_vnc_prefix, get_option('sysconfdir'))
+gtk_vnc_includedir = join_paths(gtk_vnc_prefix, get_option('includedir'))
+gtk_vnc_mandir = join_paths(gtk_vnc_prefix, get_option('mandir'))
+gtk_vnc_man1dir = join_paths(gtk_vnc_mandir, 'man1')
+
+gtk_vnc_girdir = join_paths(gtk_vnc_datadir, 'gir-1.0')
+gtk_vnc_typelibdir = join_paths(gtk_vnc_libdir, 'girepository-1.0')
+gtk_vnc_pkgconfdir = join_paths(gtk_vnc_libdir, 'pkgconfig')
+
+conf_data.set('sysconfdir', gtk_vnc_sysconfdir)
+conf_data.set('localedir', gtk_vnc_localedir)
+
+gtk_vnc_pkgdatadir = join_paths(gtk_vnc_datadir, meson.project_name())
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+conf_data.set('tls_priority', get_option('with-tls-priority'))
+
+configure_file(
+  input: 'config-meson.h.in',
+  output: 'config.h',
+  configuration: conf_data
+)
+
+top_incdir = include_directories('.')
+src_incdir = include_directories('src')
+
+with_vala = get_option('with-vala')
+
+subdir('src')
+subdir('tools')
+subdir('examples')
+subdir('po')
+
+pkgdata = configuration_data()
+pkgdata.set('prefix', gtk_vnc_prefix)
+pkgdata.set('exec_prefix', gtk_vnc_prefix)
+pkgdata.set('libdir', gtk_vnc_libdir)
+pkgdata.set('includedir', gtk_vnc_includedir)
+pkgdata.set('VERSION', meson.project_version())
+pkgdata.set('GLIB_REQUIRED', glib_min_version)
+pkgdata.set('GTK_REQUIRED', gtk_min_version)
+
+configure_file(
+  input: 'gvnc-1.0.pc.in',
+  output: 'gvnc-1.0.pc',
+  configuration: pkgdata,
+  install_dir: gtk_vnc_pkgconfdir,
+)
+
+if libpulse_dep.found()
+  configure_file(
+    input: 'gvncpulse-1.0.pc.in',
+    output: 'gvncpulse-1.0.pc',
+    configuration: pkgdata,
+    install_dir: gtk_vnc_pkgconfdir,
+  )
+endif
+
+configure_file(
+  input: 'gtk-vnc-2.0.pc.in',
+  output: 'gtk-vnc-2.0.pc',
+  configuration: pkgdata,
+  install_dir: gtk_vnc_pkgconfdir,
+)
+
+configure_file(
+  input: 'gtk-vnc.spec.in',
+  output: 'gtk-vnc.spec',
+  configuration: pkgdata,
+)
+
+configure_file(
+  input: 'mingw-gtk-vnc.spec.in',
+  output: 'mingw-gtk-vnc.spec',
+  configuration: pkgdata,
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..995d8c1
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,4 @@
+option('enable-werror', type: 'boolean',  value: false, description: 'Enable -Werror flag')
+option('with-coroutine', type: 'string', value: 'auto', description: 'Build with coroutine backend: [auto, 
ucontext, gthread]')
+option('with-tls-priority', type: 'string', value: 'NORMAL', description: 'Set default TLS priority string')
+option('with-vala', type: 'boolean', value: true, description: 'Enable Vala bindings')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..79c6233
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,2 @@
+i18n = import('i18n')
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..956f189
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,421 @@
+
+gvnc_marshal = gnome.genmarshal(
+  'vncmarshal',
+  sources: ['vncmarshal.txt'],
+  install_header: false,
+)
+
+gvnc_enum_headers = gnome.mkenums(
+  'vncconnectionenums.h',
+  sources: ['vncconnection.h'],
+  comments: '/* @comment@ */',
+  fhead: '#ifndef VNC_CONNECTION_ENUMS_H\n#define VNC_CONNECTION_ENUMS_H\n\n#include 
<glib-object.h>\nG_BEGIN_DECLS\n\n',
+  ftail: 'G_END_DECLS\n\n#endif /* VNC_CONNECTION_ENUMS_H */\n',
+  fprod: '\n/* --- vncconnection.h --- */',
+  eprod: '#define VNC_TYPE_@ENUMSHORT@ @enum_name@_get_type()\nGType @enum_name@_get_type (void);\n',
+  install_header: true,
+  install_dir: join_paths(gtk_vnc_includedir, 'gvnc-1.0'),
+)
+
+gvnc_enum_headers_dep = declare_dependency(
+  sources: gvnc_enum_headers
+)
+
+gvnc_enum_sources = gnome.mkenums(
+  'vncconnectionenums.c',
+  sources: ['vncconnection.h'],
+  comments: '/* @comment@ */',
+  fhead: '#include "vncconnectionenums.h"\n\n',
+  fprod: '\n/* enumerations from "@filename@" */\n#include "@filename@"\n',
+  vhead: 'static const G@Type@Value _@enum_name@_values[] = {',
+  vprod: '  { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
+  vtail: '  { 0, NULL, NULL }\n};\n\nGType\n@enum_name@_get_type (void)\n{\n  static GType type = 0;\n\n  if 
(!type)\n    type = g_@type@_register_static ("@EnumName@", _@enum_name@_values);\n\n  return type;\n}\n\n',
+  install_header: false,
+)
+
+gvnc_enum_sources_dep = declare_dependency(
+  sources: gvnc_enum_sources
+)
+
+gvnc_headers = [
+  'gvnc.h',
+  'vncpixelformat.h',
+  'vncaudioformat.h',
+  'vncaudiosample.h',
+  'vncaudio.h',
+  'vncbaseaudio.h',
+  'vncframebuffer.h',
+  'vncbaseframebuffer.h',
+  'vnccursor.h',
+  'vnccolormap.h',
+  'vncconnection.h',
+  'vncutil.h',
+]
+
+install_headers(gvnc_headers, subdir: 'gvnc-1.0')
+
+gvnc_gir_sources = gvnc_headers + [
+  gvnc_enum_headers,
+  gvnc_enum_sources,
+  'vncpixelformat.c',
+  'vncaudioformat.c',
+  'vncaudiosample.c',
+  'vncaudio.c',
+  'vncbaseaudio.c',
+  'vncframebuffer.c',
+  'vncbaseframebuffer.c',
+  'vnccursor.c',
+  'vnccolormap.c',
+  'vncconnection.c',
+  'vncutil.c',
+]
+
+gvnc_sources = gvnc_gir_sources + gvnc_marshal + [
+  'coroutine.h',
+  'dh.h',
+  'dh.c',
+  'vncbaseframebufferblt.h',
+  'vncconnectionblt.h',
+]
+
+if coroutine == 'ucontext'
+  gvnc_sources += [
+         'coroutine_ucontext.c',
+         'continuation.h',
+         'continuation.c',
+  ]
+else
+  gvnc_sources += 'coroutine_gthread.c'
+endif
+
+gvnc_link_args = []
+if host_machine.system() != 'windows'
+  gvnc_link_args += ['-Wl,--no-undefined']
+endif
+
+if host_machine.system() == 'linux'
+  gvnc_link_args += ['-Wl,--version-script,@0@/@1@'.format(
+    meson.current_source_dir(), 'libgvnc_sym.version')
+]
+endif
+
+gvnc_deps = [
+  gobject_dep,
+  gio_dep,
+  gdk_pixbuf_dep,
+  gcrypt_dep,
+  gnutls_dep,
+  libsasl_dep,
+  zlib_dep,
+  gvnc_enum_headers_dep,
+  gvnc_enum_sources_dep,
+]
+
+gvnc_inc = [
+  src_incdir,
+  top_incdir,
+]
+
+gvnc = library(
+  'gvnc-1.0',
+  sources: gvnc_sources,
+  dependencies: gvnc_deps,
+  include_directories: gvnc_inc,
+  link_args: gvnc_link_args,
+  version: '0.0.1',
+  soversion: '0',
+  install: true,
+)
+
+gvnc_dep = declare_dependency(
+  sources: [gvnc_enum_headers],
+  link_with: gvnc,
+  dependencies: gvnc_deps,
+  include_directories: gvnc_inc,
+)
+
+if host_machine.system() != 'windows'
+  gvnc_gir = gnome.generate_gir(
+    gvnc,
+    sources: gvnc_gir_sources,
+    nsversion: '1.0',
+    namespace: 'GVnc',
+    export_packages: 'gvnc-1.0',
+    includes: ['GObject-2.0', 'Gio-2.0'],
+    dependencies: gvnc_deps,
+    header: 'gvnc.h',
+    identifier_prefix: 'Vnc',
+    symbol_prefix: 'vnc',
+    install: true,
+    install_dir_gir: gtk_vnc_girdir,
+    install_dir_typelib: gtk_vnc_typelibdir,
+  )
+
+  gvnc_gir_dep = declare_dependency(
+    sources: gvnc_gir
+  )
+
+  if with_vala
+    gvnc_vapi = gnome.generate_vapi(
+      'gvnc-1.0',
+      install: true,
+      packages: ['gobject-2.0', 'gio-2.0'],
+      sources: gvnc_gir[0],
+    )
+  endif
+endif
+
+if libpulse_dep.found()
+  gvncpulse_headers = [
+    'gvncpulse.h',
+    'vncaudiopulse.h',
+  ]
+
+  install_headers(gvncpulse_headers, subdir: 'gvncpulse-1.0')
+
+  gvncpulse_sources = gvncpulse_headers + [
+    'vncaudiopulse.c',
+  ]
+
+  gvncpulse_link_args = []
+  if host_machine.system() != 'windows'
+    gvncpulse_link_args += ['-Wl,--no-undefined']
+  endif
+
+  if host_machine.system() == 'linux'
+    gvncpulse_link_args += ['-Wl,--version-script,@0@/@1@'.format(
+      meson.current_source_dir(), 'libgvncpulse_sym.version')
+  ]
+  endif
+
+  gvncpulse_deps = [
+    gobject_dep,
+    libpulse_dep,
+    gvnc_dep,
+  ]
+
+  gvncpulse_inc = [
+    src_incdir,
+    top_incdir,
+  ]
+
+  gvncpulse = library(
+    'gvncpulse-1.0',
+    sources: gvncpulse_sources,
+    dependencies: gvncpulse_deps,
+    include_directories: gvncpulse_inc,
+    link_args: gvncpulse_link_args,
+    version: '0.0.1',
+    soversion: '0',
+    install: true,
+  )
+
+  gvncpulse_dep = declare_dependency(
+    link_with: gvncpulse,
+    dependencies: gvncpulse_deps,
+    include_directories: gvncpulse_inc,
+  )
+
+  if host_machine.system() != 'windows'
+    gvncpulse_gir = gnome.generate_gir(
+      gvncpulse,
+      sources: gvncpulse_sources,
+      nsversion: '1.0',
+      namespace: 'GVncPulse',
+      export_packages: 'gvncpulse-1.0',
+      includes: ['GObject-2.0', 'GVnc-1.0'],
+      dependencies: gvncpulse_deps + [gvnc_gir_dep],
+      header: 'gvncpulse.h',
+      identifier_prefix: 'Vnc',
+      symbol_prefix: 'vnc',
+      install: true,
+      install_dir_gir: gtk_vnc_girdir,
+      install_dir_typelib: gtk_vnc_typelibdir,
+    )
+
+    gvncpulse_gir_dep = declare_dependency(
+      sources: gvncpulse_gir
+    )
+
+    if with_vala
+      gvncpulse_vapi = gnome.generate_vapi(
+        'gvncpulse-1.0',
+        install: true,
+        packages: ['gobject-2.0', 'gio-2.0', gvnc_vapi],
+        gir_dirs: meson.current_build_dir(),
+        vapi_dirs: meson.current_build_dir(),
+        sources: gvncpulse_gir[0],
+      )
+    endif
+  endif
+endif
+
+
+
+gtk_vnc_enum_headers = gnome.mkenums(
+  'vncdisplayenums.h',
+  sources: ['vncdisplay.h'],
+  comments: '/* @comment@ */',
+  fhead: '#ifndef VNC_DISPLAY_ENUMS_H\n#define VNC_DISPLAY_ENUMS_H\n\n#include 
<glib-object.h>\nG_BEGIN_DECLS\n\n',
+  ftail: 'G_END_DECLS\n\n#endif /* VNC_DISPLAY_ENUMS_H */\n',
+  fprod: '\n/* --- vncdisplay.h --- */',
+  eprod: '#define VNC_TYPE_@ENUMSHORT@ @enum_name@_get_type()\nGType @enum_name@_get_type (void);\n',
+  install_header: true,
+  install_dir: join_paths(gtk_vnc_includedir, 'gtk-vnc-2.0'),
+)
+
+gtk_vnc_enum_headers_dep = declare_dependency(
+  sources: gtk_vnc_enum_headers
+)
+
+gtk_vnc_enum_sources = gnome.mkenums(
+  'vncdisplayenums.c',
+  sources: ['vncdisplay.h'],
+  comments: '/* @comment@ */',
+  fhead: '#include "vncdisplayenums.h"\n\n',
+  fprod: '\n/* enumerations from "@filename@" */\n#include "@filename@"\n',
+  vhead: 'static const G@Type@Value _@enum_name@_values[] = {',
+  vprod: '  { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
+  vtail: '  { 0, NULL, NULL }\n};\n\nGType\n@enum_name@_get_type (void)\n{\n  static GType type = 0;\n\n  if 
(!type)\n    type = g_@type@_register_static ("@EnumName@", _@enum_name@_values);\n\n  return type;\n}\n\n',
+  install_header: false,
+)
+
+gtk_vnc_enum_sources_dep = declare_dependency(
+  sources: gtk_vnc_enum_sources
+)
+
+gtk_vnc_headers = [
+  'gtk-vnc.h',
+  'vncdisplay.h',
+  'vncgrabsequence.h',
+  'vnccairoframebuffer.h',
+]
+
+install_headers(gtk_vnc_headers, subdir: 'gtk-vnc-2.0')
+
+gtk_vnc_gir_sources = gtk_vnc_headers + [
+  gtk_vnc_enum_headers,
+  gtk_vnc_enum_sources,
+  'vncdisplay.c',
+  'vncgrabsequence.c',
+  'vnccairoframebuffer.c',
+]
+
+gtk_vnc_sources = gtk_vnc_gir_sources + gvnc_marshal + [
+  'vncdisplaykeymap.c',
+  'vncdisplaykeymap.c',
+]
+
+python = import('python').find_installation()
+keymaps = [
+  'xorgevdev',
+  'xorgkbd',
+  'xorgxquartz',
+  'xorgxwin',
+  'osx',
+  'win32',
+  'x11'
+]
+
+foreach keymap: keymaps
+  varname = 'keymap_@0@2qnum'.format(keymap)
+  target = 'vncdisplay@0@.h'.format(varname)
+  cmd = [
+    python,
+    keymapgen,
+    '--lang', 'glib2',
+    '--varname', varname,
+    'code-map', keymapcsv, keymap, 'qnum'
+  ]
+  gtk_vnc_sources += custom_target(
+    target,
+    output: target,
+    capture: true,
+    build_by_default: true,
+    command: cmd)
+endforeach
+
+
+gtk_vnc_link_args = []
+if host_machine.system() != 'windows'
+  gtk_vnc_link_args += ['-Wl,--no-undefined']
+endif
+
+if host_machine.system() == 'linux'
+  gtk_vnc_link_args += ['-Wl,--version-script,@0@/@1@'.format(
+    meson.current_source_dir(), 'libgtk-vnc_sym.version')
+]
+endif
+
+gtk_vnc_deps = [
+  gtk_dep,
+  gvnc_dep,
+  gtk_vnc_enum_headers_dep,
+  gtk_vnc_enum_sources_dep,
+]
+if x11_dep.found()
+  gtk_vnc_deps += x11_dep
+endif
+
+gtk_vnc_inc = [
+  src_incdir,
+  top_incdir,
+]
+
+gtk_vnc = library(
+  'gtk-vnc-2.0',
+  sources: gtk_vnc_sources,
+  dependencies: gtk_vnc_deps,
+  include_directories: gtk_vnc_inc,
+  link_args: gtk_vnc_link_args,
+  version: '0.0.2',
+  soversion: '0',
+  install: true,
+)
+
+gtk_vnc_dep = declare_dependency(
+  link_with: gtk_vnc,
+  dependencies: gtk_vnc_deps,
+  include_directories: gtk_vnc_inc,
+)
+
+if host_machine.system() != 'windows'
+  gtk_vnc_gir = gnome.generate_gir(
+    gtk_vnc,
+    sources: gtk_vnc_gir_sources,
+    nsversion: '2.0',
+    namespace: 'GtkVnc',
+    export_packages: 'gtk-vnc-2.0',
+    includes: ['GObject-2.0', 'Gtk-3.0', 'GVnc-1.0'],
+    dependencies: gtk_vnc_deps + [gvnc_gir_dep],
+    header: 'gtk-vnc.h',
+    identifier_prefix: 'Vnc',
+    symbol_prefix: 'vnc',
+    install: true,
+    install_dir_gir: gtk_vnc_girdir,
+    install_dir_typelib: gtk_vnc_typelibdir,
+  )
+
+  gtk_vnc_gir_dep = declare_dependency(
+    sources: gtk_vnc_gir
+  )
+
+  if with_vala
+    gtk_vnc_vapi = gnome.generate_vapi(
+      'gtk-vnc-2.0',
+      install: true,
+      packages: ['gobject-2.0', 'gio-2.0', 'gtk+-3.0', gvnc_vapi],
+      gir_dirs: meson.current_build_dir(),
+      vapi_dirs: meson.current_build_dir(),
+      sources: gtk_vnc_gir[0],
+    )
+  endif
+endif
+
+
+vncconnectiontest = executable(
+  'vncconnectiontest',
+  sources: ['vncconnectiontest.c'],
+  dependencies: [gvnc_dep]
+)
+test('vncconnectiontest', vncconnectiontest)
diff --git a/subprojects/keycodemapdb b/subprojects/keycodemapdb
index 16e5b07..6280c94 160000
--- a/subprojects/keycodemapdb
+++ b/subprojects/keycodemapdb
@@ -1 +1 @@
-Subproject commit 16e5b0787687d8904dad2c026107409eb9bfcb95
+Subproject commit 6280c94f306df6a20bbc100ba15a5a81af0366e6
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..9d752e9
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,27 @@
+
+
+gvnccapture = executable(
+  'gvnccapture',
+  dependencies: [gvnc_dep],
+  sources: ['gvnccapture.c'],
+  install: true,
+  install_dir: gtk_vnc_bindir,
+)
+
+pod2man = find_program('pod2man')
+if pod2man.found()
+  gvnccapture_man = custom_target(
+    'gvnccapture.1',
+    output: 'gvnccapture.1',
+    input: 'gvnccapture.c',
+    install: true,
+    install_dir: gtk_vnc_man1dir,
+    build_by_default: true,
+    command: [
+      pod2man,
+      '-c', 'VNC Tools',
+      '-r', meson.project_name() + '-' + meson.project_version(),
+      '--name', 'gvnccapture',
+      '@INPUT@', '@OUTPUT@']
+  )
+endif


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