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



commit 98ae0ed07f5ed3c502502bf72d502c7a3239b851
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Mar 21 16:36:07 2019 +0100

    build: Port to meson build system
    
    meson is a build system focused on speed an ease of use, which
    helps speeding up the software development.
    
    meson build system has been added along with autotools.

 data/meson.build               |  71 +++++++++++
 doc/meson.build                |  46 +++++++
 gladeui/meson.build            | 282 +++++++++++++++++++++++++++++++++++++++++
 help/LINGUAS                   |  25 ++++
 help/meson.build               |  11 ++
 man/meson.build                |  33 +++++
 meson.build                    | 199 +++++++++++++++++++++++++++++
 meson_options.txt              |   9 ++
 meson_post_install.py          |  12 ++
 plugins/gladeui/meson.build    |  17 +++
 plugins/gtk+/icons/meson.build | 165 ++++++++++++++++++++++++
 plugins/gtk+/meson.build       | 248 ++++++++++++++++++++++++++++++++++++
 plugins/meson.build            |  31 +++++
 plugins/python/meson.build     |  13 ++
 plugins/webkit2gtk/meson.build |  17 +++
 po/meson.build                 |   5 +
 src/meson.build                |  58 +++++++++
 tests/meson.build              |  52 ++++++++
 18 files changed, 1294 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..9ce56c4a
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,71 @@
+desktop_conf = configuration_data()
+desktop_conf.set('VERSION', glade_version)
+
+desktop = glade_name + '.desktop'
+
+desktop_in = configure_file(
+  input: desktop + '.in.in',
+  output: '@BASENAME@',
+  configuration: desktop_conf,
+)
+
+i18n.merge_file(
+  desktop,
+  type: 'desktop',
+  input: desktop_in,
+  output: '@BASENAME@',
+  po_dir: po_dir,
+  install: true,
+  install_dir: glade_datadir / 'applications',
+)
+
+appdata = glade_name + '.appdata.xml'
+
+i18n.merge_file(
+  appdata,
+  input: appdata + '.in',
+  output: '@BASENAME@',
+  po_dir: po_dir,
+  install: true,
+  install_dir: glade_datadir / 'metainfo',
+)
+
+# FIXME: replace these by install_subdir once autotools is removed
+install_data(
+  'icons/hicolor/scalable/apps/org.gnome.Glade.svg',
+  install_dir: glade_datadir / 'icons/hicolor/scalable/apps',
+)
+
+icon_symbolic_data = files(
+    'icons/hicolor/symbolic/apps/glade-brand-symbolic.svg',
+    'icons/hicolor/symbolic/apps/org.gnome.Glade-symbolic.svg',
+)
+
+install_data(
+  icon_symbolic_data,
+  install_dir: glade_datadir / 'icons/hicolor/symbolic/apps',
+)
+
+pixmaps_data = files(
+  'icons/deprecated-16x16.png',
+  'icons/deprecated-22x22.png',
+  'icons/devhelp.png',
+  'icons/fixed-bg.png',
+  'icons/placeholder.png',
+  'icons/plus.png',
+)
+
+install_data(
+  pixmaps_data,
+  install_dir: glade_datadir / glade_pixmapdir,
+)
+
+its_data = files(
+  'gettext/its/glade-catalog.its',
+  'gettext/its/glade-catalog.loc',
+)
+
+install_data(
+  its_data,
+  install_dir: glade_datadir / 'gettext/its',
+)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 00000000..d61ca90f
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,46 @@
+private_headers = [
+  'glade-builtins.h',
+  'glade-debug.h',
+  'glade-accumulators.h',
+  'glade-marshallers.h',
+  'glade-paths.h',
+  'glade-custom.h',
+  'glade-cursor.h',
+  'glade-id-allocator.h',
+  'glade.h',
+  'glade-design-layout.h',
+  'glade-popup.h',
+  'glade-gtk.h',
+  'glade-palette-expander.h',
+  'glade-palette-item.h',
+  'glade-named-icon-chooser-dialog.h',
+  'glade-palette-box.h',
+]
+
+content_files = files(
+  'catalogintro.sgml',
+  'gladepython.sgml',
+  'properties.sgml',
+  'widgetclasses.sgml',
+)
+
+version_conf = configuration_data()
+version_conf.set('PACKAGE_STRING', '@0@ @1@'.format(glade_name, glade_version))
+
+content_files += configure_file(
+  input: 'version.xml.in',
+  output: '@BASENAME@',
+  configuration: version_conf,
+)
+
+gnome.gtkdoc(
+  gladeui_name,
+  main_xml: gladeui_name + '-docs.xml',
+  module_version: gladeui_major_version.to_string(),
+  src_dir: gladeui_inc,
+  ignore_headers: private_headers,
+  include_directories: top_inc,
+  dependencies: libgladeui_dep,
+  content_files: content_files,
+  install: true,
+)
diff --git a/gladeui/meson.build b/gladeui/meson.build
new file mode 100644
index 00000000..ef38b8e6
--- /dev/null
+++ b/gladeui/meson.build
@@ -0,0 +1,282 @@
+gladeui_inc = include_directories('.')
+
+common_c_flags = [
+  '-DG_LOG_DOMAIN="GladeUI"',
+  '-DGLADE_CATALOGSDIR="@0@"'.format(glade_prefix / glade_datadir / glade_catalogdir),
+  '-DGLADE_MODULESDIR="@0@"'.format(glade_prefix / glade_libdir / glade_moduledir),
+  '-DGLADE_PIXMAPSDIR="@0@"'.format(glade_prefix / glade_datadir / glade_pixmapdir),
+  '-DGLADE_LOCALEDIR="@0@"'.format(glade_prefix / glade_localedir),
+  '-DGLADE_BINDIR="@0@"'.format(glade_prefix / glade_bindir),
+  '-DGLADE_LIBDIR="@0@"'.format(glade_prefix / glade_libdir),
+]
+
+# FIXME: should these be used in the introspection data if headers are not installed?
+gir_headers = files(
+  'glade-id-allocator.h',
+  'glade-named-icon-chooser-dialog.h',
+)
+
+# The glade core library
+headers = files(
+  'glade.h',
+  'glade-app.h',
+  'glade-adaptor-chooser.h',
+  'glade-base-editor.h',
+  'glade-builtins.h',
+  'glade-catalog.h',
+  'glade-cell-renderer-icon.h',
+  'glade-clipboard.h',
+  'glade-command.h',
+  'glade-cursor.h',
+  'glade-debug.h',
+  'glade-design-view.h',
+  'glade-displayable-values.h',
+  'glade-editable.h',
+  'glade-editor.h',
+  'glade-editor-property.h',
+  'glade-editor-skeleton.h',
+  'glade-editor-table.h',
+  'glade-inspector.h',
+  'glade-name-context.h',
+  'glade-palette.h',
+  'glade-placeholder.h',
+  'glade-project.h',
+  'glade-property.h',
+  'glade-property-class.h',
+  'glade-property-label.h',
+  'glade-property-shell.h',
+  'glade-signal.h',
+  'glade-signal-class.h',
+  'glade-signal-editor.h',
+  'glade-signal-model.h',
+  'glade-utils.h',
+  'glade-widget.h',
+  'glade-widget-action.h',
+  'glade-widget-adaptor.h',
+  'glade-xml-utils.h',
+)
+
+install_headers(
+  headers,
+  subdir: 'lib@0@/@1@'.format(gladeui_libname, gladeui_name),
+)
+
+# Enum type generation
+enum_types = 'gladeui-enum-types'
+
+enum_sources = gnome.mkenums(
+  enum_types,
+  sources: headers,
+  c_template: enum_types + '.c.template',
+  h_template: enum_types + '.h.template',
+)
+
+marshal = 'glade-marshallers'
+
+# Marshaller generation
+marshal_sources = gnome.genmarshal(
+  marshal,
+  sources: marshal + '.list',
+  prefix: '_glade_marshal',
+  extra_args: '--prototypes',
+)
+
+sources = files(
+  'glade-accumulators.c',
+  'glade-adaptor-chooser.c',
+  'glade-adaptor-chooser-widget.c',
+  'glade-app.c',
+  'glade-base-editor.c',
+  'glade-builtins.c',
+  'glade-catalog.c',
+  'glade-cell-renderer-icon.c',
+  'glade-clipboard.c',
+  'glade-command.c',
+  'glade-cursor.c',
+  'glade-debug.c',
+  'glade-design-layout.c',
+  'glade-design-view.c',
+  'glade-displayable-values.c',
+  'glade-dnd.c',
+  'glade-drag.c',
+  'glade-editable.c',
+  'glade-editor.c',
+  'glade-editor-property.c',
+  'glade-editor-skeleton.c',
+  'glade-editor-table.c',
+  'glade-id-allocator.c',
+  'glade-inspector.c',
+  'glade-name-context.c',
+  'glade-named-icon-chooser-dialog.c',
+  'glade-object-stub.c',
+  'glade-palette.c',
+  'glade-placeholder.c',
+  'glade-popup.c',
+  'glade-preview.c',
+  'glade-project.c',
+  'glade-project-properties.c',
+  'glade-property.c',
+  'glade-property-class.c',
+  'glade-property-label.c',
+  'glade-property-shell.c',
+  'glade-signal.c',
+  'glade-signal-class.c',
+  'glade-signal-editor.c',
+  'glade-signal-model.c',
+  'glade-template.c',
+  'glade-tsort.c',
+  'glade-utils.c',
+  'glade-widget-action.c',
+  'glade-widget-adaptor.c',
+  'glade-widget.c',
+  'glade-xml-utils.c',
+)
+
+# Generate resources
+resource_data = files(
+  'atk.png',
+  'glade-adaptor-chooser.ui',
+  'glade-adaptor-chooser-widget.ui',
+  'glade-base-editor.ui',
+  'glade-design-layout.css',
+  'glade-editor.ui',
+  'glade-project-properties.ui',
+  'glade-property-label.ui'
+)
+
+resource = 'gladeui-resources'
+
+sources += gnome.compile_resources(
+  resource,
+  resource + '.gresource.xml',
+  c_name: '_gladeui',
+  dependencies: resource_data,
+  export: true,
+)
+
+deps = [
+  glib_dep,
+  gmodule_dep,
+  gtk_dep,
+]
+
+private_deps = [
+  libxml_dep,
+  m_dep,
+]
+
+c_flags = common_flags
+
+ldflags = []
+
+if enable_mac_integration
+  private_deps += gtk_mac_integration_gtk3_dep
+  if get_option('mac_bundle')
+    c_flags += '-DMAC_BUNDLE'
+  endif
+endif
+
+if glade_windows
+  rc = configure_file(
+    input: 'glade.rc.in',
+    output: '@BASELINE@',
+    configuration: rc_conf,
+  )
+
+  sources += windows.compile_resources(rc)
+
+  ldflags += cc.get_supported_link_arguments([
+    # gmodule-export-2.0 on windows does not include -export-dynamic flag
+    '-export-dynamic',
+    '-no-undefined',
+  ])
+endif
+
+libgladeui = shared_library(
+  '@0@-@1@'.format(gladeui_name, gladeui_major_version),
+  version: gladeui_libversion,
+  sources: sources + enum_sources + marshal_sources,
+  include_directories: top_inc,
+  dependencies: deps + private_deps,
+  c_args: common_c_flags,
+  link_args: ldflags,
+  install: true,
+)
+
+libgladeui_dep = declare_dependency(
+  sources: [enum_sources[1], marshal_sources[1]],
+  include_directories: gladeui_inc,
+  dependencies: deps,
+  link_with: libgladeui,
+)
+
+
+variables = [
+  # FIXME: first three variables might not be necessary
+  'datadir=${prefix}' / glade_datadir,
+  'datarootdir=${datadir}',
+  'exec_prefix=${prefix}',
+  'catalogdir=${datadir}' / glade_catalogdir,
+  'moduledir=${libdir}' / glade_moduledir,
+  'pixmapdir=${datadir}' / glade_pixmapdir,
+]
+
+pkg.generate(
+  libgladeui,
+  filebase: gladeui_libname,
+  name: 'Glade',
+  description: 'Glade interface designer library',
+  subdirs: 'lib' + gladeui_libname,
+  requires: deps,
+  variables: variables,
+)
+
+# GObject Introspection
+enable_introspection = get_option('introspection')
+if enable_introspection
+  gnome.generate_gir(
+    libgladeui,
+    sources: sources + enum_sources + marshal_sources + headers + gir_headers,
+    includes: 'Gtk-3.0',
+    nsversion: gladeui_version,
+    namespace: 'Gladeui',
+    identifier_prefix: 'Glade',
+    symbol_prefix: glade_name,
+    export_packages: gladeui_libname,
+    header: 'gladeui/glade.h',
+    extra_args: '--add-include-path=' + meson.current_source_dir(),
+    install: true,
+  )
+endif
+
+## Previewer
+sources = files(
+  'glade-previewer.c',
+  'glade-previewer-main.c',
+  'glade-preview-template.c',
+)
+
+ldflags = []
+if glade_windows
+  rc = configure_file(
+    input: 'glade-previewer.rc.in',
+    output: '@BASELINE@',
+    configuration: rc_conf,
+  )
+
+  sources += windows.compile_resources(rc)
+
+  if not glade_unstable
+    ldflags += cc.get_supported_link_arguments('-mwindows')
+  endif
+endif
+
+executable(
+  'glade-previewer',
+  sources,
+  include_directories: top_inc,
+  dependencies: libgladeui_dep,
+  c_args: common_c_flags + ['-DGLADE_GNOMEHELPDIR="@0@"'.format(glade_prefix / glade_datadir / 'help')],
+  link_args: ldflags,
+  install: true,
+)
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 00000000..e26b5c6b
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,25 @@
+# please keep this list sorted alphabetically
+#
+bg
+ca
+cs
+de
+el
+en_GB
+es
+eu
+fr
+gl
+hi
+hu
+it
+ja
+ko
+oc
+pl
+pt_BR
+ru
+sl
+sv
+uk
+zh_CN
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 00000000..bae05aa7
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,11 @@
+sources = [
+  'index.docbook',
+  'legal.xml',
+]
+
+gnome.yelp(
+  glade_name,
+  sources: sources,
+  media: 'figures/main-window.png',
+  symlink_media: true,
+)
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 00000000..2345ea1f
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,33 @@
+xsltproc = find_program('xsltproc', required: false)
+assert(xsltproc.found(), 'xsltproc is required for man pages generation')
+
+xsltproc_cmd = [
+  xsltproc,
+  '--output', '@OUTPUT@',
+  '--nonet',
+  '--stringparam', 'man.output.quietly', '1',
+  '--stringparam', 'funcsynopsis.style', 'ansi',
+  '--stringparam', 'man.th.extra1.suppress', '1',
+  '--stringparam', 'man.authors.section.enabled', '0',
+  '--stringparam', 'man.copyright.section.enabled', '0',
+  'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+  '@INPUT@',
+]
+
+mans = [
+  'glade',
+  'glade-previewer',
+]
+
+foreach man: mans
+  output = man + '.1'
+
+  custom_target(
+    output,
+    input: man + '.xml',
+    output: output,
+    command: xsltproc_cmd,
+    install: true,
+    install_dir: glade_mandir / 'man1',
+  )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..840df1e5
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,199 @@
+project(
+  'glade', 'c',
+  version: '3.22.0',
+  license: 'LGPL2',
+  default_options: 'buildtype=debugoptimized',
+  meson_version: '>= 0.49.0',
+)
+
+glade_name = meson.project_name()
+
+glade_version = meson.project_version()
+version_array = glade_version.split('.')
+glade_major_version = version_array[0].to_int()
+glade_minor_version = version_array[1].to_int()
+glade_micro_version = version_array[2].to_int()
+
+glade_prefix = get_option('prefix')
+glade_bindir = get_option('bindir')
+glade_datadir = get_option('datadir')
+glade_libdir = get_option('libdir')
+glade_localedir = get_option('localedir')
+glade_mandir = get_option('mandir')
+
+glade_catalogdir = glade_name / 'catalogs'
+glade_moduledir = glade_name / 'modules'
+glade_pixmapdir = glade_name / 'pixmaps'
+
+gladeui_name = 'gladeui'
+
+gladeui_version = '2.0'
+version_array = gladeui_version.split('.')
+gladeui_major_version = version_array[0].to_int()
+gladeui_minor_version = version_array[1].to_int()
+
+gladeui_libname = '@0@-@1@'.format(gladeui_name, gladeui_version)
+
+gladeui_revision = 0
+gladeui_current = 11
+gladeui_age = 5
+gladeui_current_minus_age = gladeui_current - gladeui_age
+gladeui_libversion = '@0@.@1@.@2@'.format(gladeui_current_minus_age, gladeui_age, gladeui_revision)
+
+glade_windows = host_machine.system() == 'windows'
+glade_debug = get_option('buildtype').contains('debug')
+
+glade_unstable = glade_minor_version.is_odd()
+
+enable_gtk_doc = get_option('gtk_doc')
+enable_man = get_option('man')
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+windows = import('windows')
+
+source_root = meson.current_source_dir()
+build_root = meson.current_build_dir()
+
+its_dir = source_root / 'data/gettext'
+po_dir = source_root / 'po'
+
+top_inc = include_directories('.')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# package defines
+set_defines = [
+  # package
+  ['PACKAGE_NAME', meson.project_name()],
+  ['PACKAGE_STRING', '@0@ @1@'.format(glade_name, glade_version)],
+  ['PACKAGE_VERSION', glade_version],
+  ['VERSION', glade_version],
+  # i18n
+  ['GETTEXT_PACKAGE', glade_name],
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+config_h.set('GLADE_MAJOR_VERSION', glade_major_version)
+config_h.set('GLADE_MINOR_VERSION', glade_minor_version)
+config_h.set('GLADE_MICRO_VERSION', glade_micro_version)
+config_h.set('ENABLE_NLS', true)
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+if get_option('buildtype').contains('debug')
+  common_flags += cc.get_supported_arguments('-Wnested-externs')
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+# Check required libraries
+glib_dep = dependency('glib-2.0', version: '>= 2.53.2')
+gmodule_dep = dependency('gmodule-2.0')
+gmodule_export_dep = dependency('gmodule-export-2.0')
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.0')
+libxml_dep = dependency('libxml-2.0', version: '>= 2.4.0')
+
+m_dep = cc.find_library('m')
+
+# Check for the unix print widgets in gtk+
+have_gtk_unix_print = cc.has_function('gtk_print_unix_dialog_new', dependencies: gtk_dep)
+
+# Check for _gtk_widget_class_template_unset_only_for_glade() in gtk+
+config_h.set10('HAVE_GTK_TEMPLATE_UNSET', cc.has_function('_gtk_widget_class_template_unset_only_for_glade', 
dependencies: gtk_dep))
+
+# va_copy.
+va_copy_src = '''
+    #include <stdarg.h>
+    int main() {
+        va_list ap1, ap2;
+        @0@(ap1, ap2);
+    };
+'''
+
+if not cc.links(va_copy_src.format('va_copy', name: 'how to copy va_list'))
+  # FIXME: test this option
+  if cc.links(va_copy_src.format('__va_copy'))
+    config_h.set('va_copy', '__va_copy')
+  else
+    config_h.set('va_copy(dest,src)', 'memcpy(&dest,&src,sizeof(va_list))')
+  endif
+endif
+
+# Python for optional python dev libs
+pygobject_version = '3.8.0'
+pygobject_dep = dependency('pygobject-3.0', version: '>= ' + pygobject_version, required: 
get_option('python'))
+have_python = pygobject_dep.found()
+if have_python
+  python_dep = import('python').find_installation().dependency()
+
+  version_array = pygobject_version.split('.')
+  config_h.set('PYGOBJECT_REQUIRED_MAJOR', version_array[0].to_int())
+  config_h.set('PYGOBJECT_REQUIRED_MINOR', version_array[1].to_int())
+  config_h.set('PYGOBJECT_REQUIRED_MICRO', version_array[2].to_int())
+endif
+
+# WebKit2GTK support
+webkit2gtk_dep = dependency('webkit2gtk-4.0', version: '>= 2.12.0', required: get_option('webkit2gtk'))
+have_webkit2gtk = webkit2gtk_dep.found()
+
+# Check for GDK Quartz and MacOSX integration package
+enable_mac_integration = dependency('gdk-3.0').get_pkgconfig_variable('targets').contains('quartz')
+if enable_mac_integration
+  gtk_mac_integration_gtk3_dep = dependency('gtk-mac-integration-gtk3')
+
+  if get_option('mac_bundle')
+    gtk_mac_bundle_flags = '-DMAC_BUNDLE'
+  endif
+endif
+
+if glade_windows
+  rc_conf = configuration_data()
+  rc_conf.set('GLADE_MAJOR_VERSION', glade_major_version)
+  rc_conf.set('GLADE_MINOR_VERSION', glade_minor_version)
+  rc_conf.set('GLADE_MICRO_VERSION', glade_micro_version)
+  rc_conf.set('GLADE_CURRENT_MINUS_AGE', gladeui_current_minus_age)
+endif
+
+subdir('po')
+subdir('data')
+subdir('gladeui')
+subdir('src')
+subdir('plugins')
+subdir('tests')
+subdir('doc')
+subdir('help')
+
+if enable_man
+  subdir('man')
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h,
+)
+
+meson.add_install_script(
+  'meson_post_install.py',
+  glade_datadir,
+)
+
+output = '\nConfiguration:\n\n'
+output += '\tCompiler:                ' + cc.get_id() + '\n'
+output += '\tSource code location:    ' + source_root + '\n'
+output += '\tDebug Enabled:           ' + glade_debug.to_string() + '\n'
+output += '\tGTK+ UNIX Print Widgets: ' + have_gtk_unix_print.to_string() + '\n'
+output += '\tPYTHON Widgets support:  ' + have_python.to_string() + '\n'
+output += '\tGladeui Catalog:         ' + enable_gladeui.to_string() + '\n'
+output += '\tWebKit2GTK+ Catalog:     ' + have_webkit2gtk.to_string() + '\n'
+output += '\tIntrospection Data:      ' + enable_introspection.to_string() + '\n\n'
+output += '\tBuild Reference Manual:  ' + enable_gtk_doc.to_string() + '\n'
+output += '\tBuild Manual Pages:      ' + enable_man.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..af892991
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+option('gladeui', type: 'boolean', value: false, description: 'enable installation of the Gladeui catalog')
+option('python', type: 'feature', value: 'auto', description: 'enable installation of the python catalog')
+option('webkit2gtk', type: 'feature', value: 'auto', description: 'enable installation of the webkit2gtk 
catalog')
+
+option('mac_bundle', type: 'boolean', value: false, description: 'enable mac bundling')
+
+option('gtk_doc', type: 'boolean', value: true, description: 'build GTK Doc reference')
+option('introspection', type: 'boolean', value: true, description: 'build introspection support')
+option('man', type: 'boolean', value: true, description: 'build manual pages')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 00000000..6084cba3
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+    prefix = os.environ['MESON_INSTALL_PREFIX']
+
+    icondir = os.path.join(prefix, sys.argv[1], 'icons', 'hicolor')
+    print('Update icon cache...')
+    subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
diff --git a/plugins/gladeui/meson.build b/plugins/gladeui/meson.build
new file mode 100644
index 00000000..7e28808e
--- /dev/null
+++ b/plugins/gladeui/meson.build
@@ -0,0 +1,17 @@
+sources = files(
+  'glade-glade-editor-skeleton.c',
+  'glade-glade-property-shell.c',
+)
+
+shared_module(
+  'gladeglade',
+  sources: sources,
+  dependencies: libgladeui_dep,
+  c_args: '-DG_LOG_DOMAIN="GladeUI-Glade"',
+  kwargs: plugins_kwargs,
+)
+
+install_data(
+  'gladeui.xml',
+  install_dir: glade_datadir / glade_catalogdir,
+)
diff --git a/plugins/gtk+/icons/meson.build b/plugins/gtk+/icons/meson.build
new file mode 100644
index 00000000..2a77dcc2
--- /dev/null
+++ b/plugins/gtk+/icons/meson.build
@@ -0,0 +1,165 @@
+# FIXME: replace this by install_subdir once autotools is removed
+icon_data = [
+  'widget-gtk-aboutdialog.png',
+  'widget-gtk-accelgroup.png',
+  'widget-gtk-accellabel.png',
+  'widget-gtk-actionbar.png',
+  'widget-gtk-actiongroup.png',
+  'widget-gtk-action.png',
+  'widget-gtk-adjustment.png',
+  'widget-gtk-alignment.png',
+  'widget-gtk-appchooserbutton.png',
+  'widget-gtk-appchooserdialog.png',
+  'widget-gtk-appchooserwidget.png',
+  'widget-gtk-arrow.png',
+  'widget-gtk-aspectframe.png',
+  'widget-gtk-assistant.png',
+  'widget-gtk-box.png',
+  'widget-gtk-buttonbox.png',
+  'widget-gtk-button.png',
+  'widget-gtk-calendar.png',
+  'widget-gtk-cellareabox.png',
+  'widget-gtk-cellrendereraccel.png',
+  'widget-gtk-cellrenderercombo.png',
+  'widget-gtk-cellrendererpixbuf.png',
+  'widget-gtk-cellrendererprogress.png',
+  'widget-gtk-cellrendererspinner.png',
+  'widget-gtk-cellrendererspin.png',
+  'widget-gtk-cellrenderertext.png',
+  'widget-gtk-cellrenderertoggle.png',
+  'widget-gtk-checkbutton.png',
+  'widget-gtk-checkmenuitem.png',
+  'widget-gtk-colorbutton.png',
+  'widget-gtk-colorselectiondialog.png',
+  'widget-gtk-colorselection.png',
+  'widget-gtk-combobox.png',
+  'widget-gtk-comboboxtext.png',
+  'widget-gtk-default.png',
+  'widget-gtk-dialog.png',
+  'widget-gtk-drawingarea.png',
+  'widget-gtk-entrybuffer.png',
+  'widget-gtk-entrycompletion.png',
+  'widget-gtk-entry.png',
+  'widget-gtk-eventbox.png',
+  'widget-gtk-expander.png',
+  'widget-gtk-filechooserbutton.png',
+  'widget-gtk-filechooserdialog.png',
+  'widget-gtk-filechooserwidget.png',
+  'widget-gtk-filefilter.png',
+  'widget-gtk-fixed.png',
+  'widget-gtk-flowboxchild.png',
+  'widget-gtk-flowbox.png',
+  'widget-gtk-fontbutton.png',
+  'widget-gtk-fontselectiondialog.png',
+  'widget-gtk-fontselection.png',
+  'widget-gtk-frame.png',
+  'widget-gtk-glarea.png',
+  'widget-gtk-grid.png',
+  'widget-gtk-handlebox.png',
+  'widget-gtk-hbox.png',
+  'widget-gtk-hbuttonbox.png',
+  'widget-gtk-headerbar.png',
+  'widget-gtk-hpaned.png',
+  'widget-gtk-hscale.png',
+  'widget-gtk-hscrollbar.png',
+  'widget-gtk-hseparator.png',
+  'widget-gtk-iconfactory.png',
+  'widget-gtk-iconview.png',
+  'widget-gtk-imagemenuitem.png',
+  'widget-gtk-image.png',
+  'widget-gtk-infobar.png',
+  'widget-gtk-inputdialog.png',
+  'widget-gtk-label.png',
+  'widget-gtk-layout.png',
+  'widget-gtk-levelbar.png',
+  'widget-gtk-linkbutton.png',
+  'widget-gtk-listbox.png',
+  'widget-gtk-listboxrow.png',
+  'widget-gtk-liststore.png',
+  'widget-gtk-lockbutton.png',
+  'widget-gtk-menubar.png',
+  'widget-gtk-menubutton.png',
+  'widget-gtk-menuitem.png',
+  'widget-gtk-menu.png',
+  'widget-gtk-menutoolbutton.png',
+  'widget-gtk-messagedialog.png',
+  'widget-gtk-modelbutton.png',
+  'widget-gtk-notebook.png',
+  'widget-gtk-offscreenwindow.png',
+  'widget-gtk-overlay.png',
+  'widget-gtk-pagesetupdialog.png',
+  'widget-gtk-paned.png',
+  'widget-gtk-placessidebar.png',
+  'widget-gtk-popovermenu.png',
+  'widget-gtk-popover.png',
+  'widget-gtk-printdialog.png',
+  'widget-gtk-progressbar.png',
+  'widget-gtk-radioaction.png',
+  'widget-gtk-radiobutton.png',
+  'widget-gtk-radiomenuitem.png',
+  'widget-gtk-radiotoolbutton.png',
+  'widget-gtk-recentaction.png',
+  'widget-gtk-recentchooserdialog.png',
+  'widget-gtk-recentchoosermenu.png',
+  'widget-gtk-recentchooser.png',
+  'widget-gtk-recentfilter.png',
+  'widget-gtk-recentmanager.png',
+  'widget-gtk-revealer.png',
+  'widget-gtk-scalebutton.png',
+  'widget-gtk-scale.png',
+  'widget-gtk-scrollbar.png',
+  'widget-gtk-scrolledwindow.png',
+  'widget-gtk-searchbar.png',
+  'widget-gtk-searchentry.png',
+  'widget-gtk-separatormenuitem.png',
+  'widget-gtk-separator.png',
+  'widget-gtk-separatortoolitem.png',
+  'widget-gtk-sizegroup.png',
+  'widget-gtk-spinbutton.png',
+  'widget-gtk-spinner.png',
+  'widget-gtk-stack.png',
+  'widget-gtk-stacksidebar.png',
+  'widget-gtk-stackswitcher.png',
+  'widget-gtk-statusbar.png',
+  'widget-gtk-statusicon.png',
+  'widget-gtk-switch.png',
+  'widget-gtk-table.png',
+  'widget-gtk-tearoffmenuitem.png',
+  'widget-gtk-textbuffer.png',
+  'widget-gtk-texttag.png',
+  'widget-gtk-texttagtable.png',
+  'widget-gtk-textview.png',
+  'widget-gtk-toggleaction.png',
+  'widget-gtk-togglebutton.png',
+  'widget-gtk-toggletoolbutton.png',
+  'widget-gtk-toolbar.png',
+  'widget-gtk-toolbutton.png',
+  'widget-gtk-toolitemgroup.png',
+  'widget-gtk-toolitem.png',
+  'widget-gtk-toolpalette.png',
+  'widget-gtk-treemodelfilter.png',
+  'widget-gtk-treemodelsort.png',
+  'widget-gtk-treeselection.png',
+  'widget-gtk-treestore.png',
+  'widget-gtk-treeviewcolumn.png',
+  'widget-gtk-treeview.png',
+  'widget-gtk-vbox.png',
+  'widget-gtk-vbuttonbox.png',
+  'widget-gtk-viewport.png',
+  'widget-gtk-volumebutton.png',
+  'widget-gtk-vpaned.png',
+  'widget-gtk-vscale.png',
+  'widget-gtk-vscrollbar.png',
+  'widget-gtk-vseparator.png',
+  'widget-gtk-windowgroup.png',
+  'widget-gtk-window.png',
+]
+
+foreach size: ['16x16', '22x22']
+  foreach icon: icon_data
+    install_data(
+      size / icon,
+      install_dir: glade_datadir / glade_pixmapdir / 'hicolor' / size / 'actions',
+    )
+  endforeach
+endforeach
diff --git a/plugins/gtk+/meson.build b/plugins/gtk+/meson.build
new file mode 100644
index 00000000..f86dafeb
--- /dev/null
+++ b/plugins/gtk+/meson.build
@@ -0,0 +1,248 @@
+subdir('icons')
+
+sources = files(
+  'glade-about-dialog-editor.c',
+  'glade-accels.c',
+  'glade-action-editor.c',
+  'glade-activatable-editor.c',
+  'glade-app-chooser-button-editor.c',
+  'glade-app-chooser-widget-editor.c',
+  'glade-arrow-editor.c',
+  'glade-attributes.c',
+  'glade-action-bar-editor.c',
+  'glade-box-editor.c',
+  'glade-button-editor.c',
+  'glade-cell-renderer-editor.c',
+  'glade-column-types.c',
+  'glade-combo-box-editor.c',
+  'glade-combo-box-text-editor.c',
+  'glade-entry-editor.c',
+  'glade-eprop-enum-int.c',
+  'glade-file-chooser-button-editor.c',
+  'glade-file-chooser-dialog-editor.c',
+  'glade-file-chooser-editor.c',
+  'glade-file-chooser-widget-editor.c',
+  'glade-fixed.c',
+  'glade-font-button-editor.c',
+  'glade-font-chooser-dialog-editor.c',
+  'glade-font-chooser-editor.c',
+  'glade-font-chooser-widget-editor.c',
+  'glade-grid-editor.c',
+  'glade-gtk-about-dialog.c',
+  'glade-gtk-action-bar.c',
+  'glade-gtk-action.c',
+  'glade-gtk-action-group.c',
+  'glade-gtk-action-widgets.c',
+  'glade-gtk-adjustment.c',
+  'glade-gtk-app-chooser-button.c',
+  'glade-gtk-app-chooser-widget.c',
+  'glade-gtk-arrow.c',
+  'glade-gtk-assistant.c',
+  'glade-gtk-bin.c',
+  'glade-gtk-box.c',
+  'glade-gtk-button.c',
+  'glade-gtk-cell-layout.c',
+  'glade-gtk-cell-renderer.c',
+  'glade-gtk-combo-box.c',
+  'glade-gtk-combo-box-text.c',
+  'glade-gtk-container.c',
+  'glade-gtk-dialog.c',
+  'glade-gtk-entry-buffer.c',
+  'glade-gtk-entry.c',
+  'glade-gtk-expander.c',
+  'glade-gtk-file-chooser-widget.c',
+  'glade-gtk-fixed-layout.c',
+  'glade-gtk-flow-box.c',
+  'glade-gtk-font-chooser-widget.c',
+  'glade-gtk-frame.c',
+  'glade-gtk-grid.c',
+  'glade-gtk-header-bar.c',
+  'glade-gtk-icon-factory.c',
+  'glade-gtk-icon-view.c',
+  'glade-gtk-image.c',
+  'glade-gtk-image-menu-item.c',
+  'glade-gtk-info-bar.c',
+  'glade-gtk-label.c',
+  'glade-gtk-level-bar.c',
+  'glade-gtk-list-box.c',
+  'glade-gtk-list-store.c',
+  'glade-gtk-menu-bar.c',
+  'glade-gtk-menu.c',
+  'glade-gtk-menu-item.c',
+  'glade-gtk-menu-shell.c',
+  'glade-gtk-menu-tool-button.c',
+  'glade-gtk-message-dialog.c',
+  'glade-gtk-model-button.c',
+  'glade-gtk-notebook.c',
+  'glade-gtk-overlay.c',
+  'glade-gtk-paned.c',
+  'glade-gtk-popover.c',
+  'glade-gtk-popover-menu.c',
+  'glade-gtk-progress-bar.c',
+  'glade-gtk-radio-button.c',
+  'glade-gtk-radio-menu-item.c',
+  'glade-gtk-recent-chooser-menu.c',
+  'glade-gtk-recent-chooser-widget.c',
+  'glade-gtk-recent-file-filter.c',
+  'glade-gtk-revealer.c',
+  'glade-gtk-scale.c',
+  'glade-gtk-scrollbar.c',
+  'glade-gtk-scrolled-window.c',
+  'glade-gtk-searchbar.c',
+  'glade-gtk-size-group.c',
+  'glade-gtk-spin-button.c',
+  'glade-gtk-stack.c',
+  'glade-gtk-stack-switcher.c',
+  'glade-gtk-switch.c',
+  'glade-gtk-table.c',
+  'glade-gtk-text-buffer.c',
+  'glade-gtk-text-tag-table.c',
+  'glade-gtk-text-view.c',
+  'glade-gtk-tool-button.c',
+  'glade-gtk-tool-item.c',
+  'glade-gtk-tool-item-group.c',
+  'glade-gtk-tool-palette.c',
+  'glade-gtk-toolbar.c',
+  'glade-gtk-tree-view.c',
+  'glade-gtk-viewport.c',
+  'glade-gtk-widget.c',
+  'glade-gtk-window.c',
+  'glade-header-bar-editor.c',
+  'glade-icon-factory-editor.c',
+  'glade-icon-sources.c',
+  'glade-icon-view-editor.c',
+  'glade-image-editor.c',
+  'glade-image-item-editor.c',
+  'glade-label-editor.c',
+  'glade-layout-editor.c',
+  'glade-level-bar-editor.c',
+  'glade-message-dialog-editor.c',
+  'glade-misc-editor.c',
+  'glade-model-button-editor.c',
+  'glade-model-data.c',
+  'glade-notebook-editor.c',
+  'glade-popover-editor.c',
+  'glade-popover-menu-editor.c',
+  'glade-progress-bar-editor.c',
+  'glade-real-tree-view-editor.c',
+  'glade-recent-action-editor.c',
+  'glade-recent-chooser-dialog-editor.c',
+  'glade-recent-chooser-editor.c',
+  'glade-recent-chooser-menu-editor.c',
+  'glade-recent-chooser-widget-editor.c',
+  'glade-scale-button-editor.c',
+  'glade-scale-editor.c',
+  'glade-scrollable-editor.c',
+  'glade-scrollbar-editor.c',
+  'glade-scrolled-window-editor.c',
+  'glade-spin-button-editor.c',
+  'glade-stack-editor.c',
+  'glade-stack-switcher-editor.c',
+  'glade-store-editor.c',
+  'glade-string-list.c',
+  'glade-text-view-editor.c',
+  'glade-tool-button-editor.c',
+  'glade-tool-item-group-editor.c',
+  'glade-tool-palette-editor.c',
+  'glade-treeview-editor.c',
+  'glade-viewport-editor.c',
+  'glade-widget-editor.c',
+  'glade-window-editor.c',
+)
+
+marshal = 'glade-gtk-marshallers'
+
+# Marshaller generation
+sources += gnome.genmarshal(
+  marshal,
+  sources: marshal + '.list',
+  prefix: 'glade_gtk_marshal',
+  extra_args: '--prototypes',
+)
+
+# Generate resources
+resource_data = files(
+  'glade-about-dialog-editor.ui',
+  'glade-action-bar-editor.ui',
+  'glade-action-editor.ui',
+  'glade-activatable-editor.ui',
+  'glade-app-chooser-button-editor.ui',
+  'glade-app-chooser-widget-editor.ui',
+  'glade-arrow-editor.ui',
+  'glade-box-editor.ui',
+  'glade-button-editor.ui',
+  'glade-combo-box-editor.ui',
+  'glade-combo-box-text-editor.ui',
+  'glade-entry-editor.ui',
+  'glade-file-chooser-button-editor.ui',
+  'glade-file-chooser-dialog-editor.ui',
+  'glade-file-chooser-editor.ui',
+  'glade-file-chooser-widget-editor.ui',
+  'glade-font-button-editor.ui',
+  'glade-font-chooser-dialog-editor.ui',
+  'glade-font-chooser-editor.ui',
+  'glade-font-chooser-widget-editor.ui',
+  'glade-grid-editor.ui',
+  'glade-header-bar-editor.ui',
+  'glade-icon-view-editor.ui',
+  'glade-image-editor.ui',
+  'glade-label-editor.ui',
+  'glade-layout-editor.ui',
+  'glade-level-bar-editor.ui',
+  'glade-message-dialog-editor.ui',
+  'glade-misc-editor.ui',
+  'glade-model-button-editor.ui',
+  'glade-notebook-editor.ui',
+  'glade-popover-editor.ui',
+  'glade-popover-menu-editor.ui',
+  'glade-progress-bar-editor.ui',
+  'glade-real-tree-view-editor.ui',
+  'glade-recent-action-editor.ui',
+  'glade-recent-chooser-dialog-editor.ui',
+  'glade-recent-chooser-editor.ui',
+  'glade-recent-chooser-menu-editor.ui',
+  'glade-recent-chooser-widget-editor.ui',
+  'glade-scale-button-editor.ui',
+  'glade-scale-editor.ui',
+  'glade-scrollable-editor.ui',
+  'glade-scrollbar-editor.ui',
+  'glade-scrolled-window-editor.ui',
+  'glade-spin-button-editor.ui',
+  'glade-stack-editor.ui',
+  'glade-stack-switcher-editor.ui',
+  'glade-text-view-editor.ui',
+  'glade-tool-button-editor.ui',
+  'glade-tool-palette-editor.ui',
+  'glade-viewport-editor.ui',
+  'glade-widget-editor.ui',
+  'glade-window-editor.ui',
+)
+
+# Generate resources
+resource = 'glade-gtk-resources'
+
+sources += gnome.compile_resources(
+  resource,
+  resource + '.gresource.xml',
+  c_name: '_glade_gtk',
+  dependencies: resource_data,
+  export: true,
+)
+
+shared_module(
+  'gladegtk',
+  sources: sources,
+  dependencies: libgladeui_dep,
+  c_args: '-DG_LOG_DOMAIN="GladeUI-GTK"',
+  kwargs: plugins_kwargs,
+)
+
+catalog_data = files('gtk+.xml')
+if have_gtk_unix_print
+  catalog_data += files('gtkunixprint.xml')
+endif
+
+install_data(
+  catalog_data,
+  install_dir: glade_datadir / glade_catalogdir,
+)
diff --git a/plugins/meson.build b/plugins/meson.build
new file mode 100644
index 00000000..c2d1328c
--- /dev/null
+++ b/plugins/meson.build
@@ -0,0 +1,31 @@
+ldflags = []
+if glade_windows
+  ldflags += cc.get_supported_link_arguments('-no-undefined')
+endif
+
+plugins_kwargs = {
+  'include_directories': top_inc,
+  'link_args': ldflags,
+  'install': true,
+  'install_dir': glade_libdir / glade_moduledir,
+}
+
+subdir('gtk+')
+
+if have_python
+  subdir('python')
+endif
+
+enable_gladeui = get_option('gladeui')
+if enable_gladeui
+  subdir('gladeui')
+endif
+
+if have_webkit2gtk
+  subdir('webkit2gtk')
+endif
+
+install_data(
+  'glade-catalog.dtd',
+  install_dir: glade_datadir / glade_catalogdir,
+)
diff --git a/plugins/python/meson.build b/plugins/python/meson.build
new file mode 100644
index 00000000..73ecc8c8
--- /dev/null
+++ b/plugins/python/meson.build
@@ -0,0 +1,13 @@
+deps = [
+  libgladeui_dep,
+  pygobject_dep,
+  python_dep,
+]
+
+shared_module(
+  'gladepython',
+  sources: 'glade-python.c',
+  dependencies: deps,
+  c_args: '-DG_LOG_DOMAIN="GladeUI-PYTHON"',
+  kwargs: plugins_kwargs,
+)
diff --git a/plugins/webkit2gtk/meson.build b/plugins/webkit2gtk/meson.build
new file mode 100644
index 00000000..a8306f10
--- /dev/null
+++ b/plugins/webkit2gtk/meson.build
@@ -0,0 +1,17 @@
+deps = [
+  libgladeui_dep,
+  webkit2gtk_dep,
+]
+
+shared_module(
+  'gladewebkit2gtk',
+  sources: 'glade-webkit2gtk.c',
+  dependencies: deps,
+  c_args: '-DG_LOG_DOMAIN="GladeUI-WEBKIT2GTK"',
+  kwargs: plugins_kwargs,
+)
+
+install_data(
+  'webkit2gtk.xml',
+  install_dir: glade_datadir / glade_catalogdir,
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..5d1869ba
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,5 @@
+i18n.gettext(
+  glade_name,
+  preset: 'glib',
+  data_dirs: its_dir,
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000..2be16e73
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,58 @@
+sources = files(
+  'glade-http.c',
+  'glade-intro.c',
+  'glade-preferences.c',
+  'glade-registration.c',
+  'glade-window.c',
+  'main.c',
+)
+
+resource_data = files(
+  'glade.glade',
+  'glade-preferences.glade',
+  'glade-registration.css',
+  'glade-registration.glade',
+  'glade-window.css',
+)
+
+resource = 'glade-resources'
+
+sources += gnome.compile_resources(
+  resource,
+  resource + '.gresource.xml',
+  c_name: '_glade',
+  dependencies: resource_data,
+  export: true,
+)
+
+deps = [
+  gmodule_export_dep,
+  libgladeui_dep,
+]
+
+ldflags = []
+if glade_windows
+  rc = configure_file(
+    input: 'glade.rc.in',
+    output: '@BASELINE@',
+    configuration: rc_conf,
+  )
+
+  sources += windows.compile_resources(rc)
+
+  test_ldflags = ['-export-dynamic']
+  if not glade_unstable
+    test_ldflags += ['-mwindows']
+  endif
+  ldflags += cc.get_supported_link_arguments(test_ldflags)
+endif
+
+executable(
+  'glade',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: '-DGLADE_GNOMEHELPDIR="@0@"'.format(glade_prefix / glade_datadir / 'help'),
+  link_args: ldflags,
+  install: true,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 00000000..52594753
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,52 @@
+test_unit = [
+  ['add-child', {'sources': 'add-child.c'}],
+  ['create-widgets', {'sources': 'create-widgets.c'}],
+]
+
+sources = files('toplevel-order.c')
+
+# Generate resources
+resource_data = files(
+  'toplevel_order_test2.glade',
+  'toplevel_order_test3.glade',
+  'toplevel_order_test4.glade',
+  'toplevel_order_test5.glade',
+  'toplevel_order_test6.glade',
+  'toplevel_order_test.glade'
+)
+
+resource = 'toplevel-order-resources'
+
+sources += gnome.compile_resources(
+  resource,
+  resource + '.gresource.xml',
+  c_name: '_glade',
+  dependencies: resource_data,
+  export: true,
+)
+
+test_unit += [['toplevel-order', {'sources': sources}]]
+
+envs = [
+  'GLADE_TESTING=1',
+  'GLADE_CATALOG_SEARCH_PATH=' + (source_root / 'plugins/gtk+'),
+  'GLADE_MODULE_SEARCH_PATH=' + (build_root / 'plugins/gtk+'),
+  'GLADE_PIXMAP_DIR=' + (source_root / 'data/icons'),
+  'GLADE_ICON_THEME_PATH=' + (source_root / 'plugins/gtk+/icons/22x22'),
+]
+
+foreach unit: test_unit
+  exe = executable(
+    unit[0],
+    include_directories: top_inc,
+    dependencies: libgladeui_dep,
+    c_args: common_c_flags,
+    kwargs: unit[1],
+  )
+
+  test(
+    unit[0],
+    exe,
+    env: envs,
+  )
+endforeach



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