[mm-common] skeletonmm: Use Meson instead of Autotools



commit 2d22e63f359315c4e2fa2aa3be1f558ed4397b65
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sat Oct 26 11:17:49 2019 +0200

    skeletonmm: Use Meson instead of Autotools
    
    The files in the skeletonmm directory now show the start of a project
    that will use Meson.
    
    The new skeletonmm is based on experience from building pangomm with Meson.
    It does not include code necessary for running Meson under MSVC.
    See !2 and pangomm!4. Fixes #1

 .gitignore                                         |   3 +-
 Makefile.am                                        |  50 +++---
 README                                             |   4 +-
 meson.build                                        |  46 +++--
 skeletonmm/.gitignore                              |  34 +---
 skeletonmm/Makefile.am                             |  45 -----
 skeletonmm/autogen.sh                              |   7 -
 skeletonmm/build/.gitignore                        |  13 --
 skeletonmm/codegen/Makefile.am                     |  34 ----
 skeletonmm/codegen/m4/filelist.am                  |   3 -
 skeletonmm/configure.ac                            |  77 --------
 skeletonmm/doc/Makefile.am                         |  27 ---
 skeletonmm/doc/reference/.gitignore                |   5 -
 skeletonmm/doc/reference/meson.build               | 154 ++++++++++++++++
 skeletonmm/examples/.gitignore                     |   1 -
 skeletonmm/examples/Makefile.am                    |  29 ---
 .../{example/example.cc => example1/main.cc}       |   2 +-
 skeletonmm/examples/meson.build                    |  34 ++++
 skeletonmm/meson.build                             | 195 +++++++++++++++++++++
 skeletonmm/meson_options.txt                       |  10 ++
 skeletonmm/skeleton/.gitignore                     |   6 -
 skeletonmm/skeleton/meson.build                    |  51 ++++++
 skeletonmm/skeleton/skeletonmm-uninstalled.pc.in   |   2 +-
 skeletonmm/skeleton/skeletonmm.h                   |   2 +-
 skeletonmm/skeleton/skeletonmm.pc.in               |   2 +-
 skeletonmm/skeleton/skeletonmm/Makefile.am         |  31 ----
 skeletonmm/skeleton/skeletonmm/filelist.am         |   8 -
 skeletonmm/skeleton/skeletonmm/meson.build         | 172 ++++++++++++++++++
 skeletonmm/skeleton/skeletonmm/private/.gitignore  |   1 -
 skeletonmm/skeleton/skeletonmm/wrap_init.h         |   7 +-
 skeletonmm/skeleton/skeletonmmconfig.h.in          |  17 +-
 skeletonmm/skeleton/src/Makefile.am                |  23 ---
 skeletonmm/skeleton/src/filelist.am                |  12 --
 skeletonmm/skeleton/src/skeleton.ccg               |   2 +-
 skeletonmm/skeleton/src/skeleton.defs              |   8 +-
 skeletonmm/skeleton/src/skeleton.hg                |   4 +-
 .../{skeleton_enum.defs => skeleton_enums.defs}    |   0
 ...{skeleton_method.defs => skeleton_methods.defs} |   0
 ...{skeleton_signal.defs => skeleton_signals.defs} |   0
 .../{skeleton_vfunc.defs => skeleton_vfuncs.defs}  |   0
 skeletonmm/skeletonmm.doap                         |   1 +
 skeletonmm/tests/meson.build                       |  37 ++++
 skeletonmm/tests/test1/main.cc                     |  30 ++++
 skeletonmm/tests/test2/main.cc                     |  30 ++++
 skeletonmm/tools/dist-cmd.py                       |  12 ++
 .../extra_defs_gen/generate_defs_skeleton.cc}      |   7 +-
 skeletonmm/tools/extra_defs_gen/meson.build        |  26 +++
 .../{codegen => tools}/generate_defs_and_docs.sh   |  18 +-
 skeletonmm/{codegen => tools}/m4/convert.m4        |   0
 .../{codegen => tools}/m4/convert_skeleton.m4      |   2 +-
 skeletonmm/untracked/README                        |  36 ++++
 51 files changed, 884 insertions(+), 436 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index db9735e..c584e83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,6 @@
 /Makefile.in
 /aclocal.m4
 /autom4te.cache/
-/config*.lineno
 /config.log
 /config.status
 /configure
@@ -14,6 +13,8 @@
 /doctags/libstdc++.tag
 /doctags/mm-common*.pc
 /macros/mm-common.m4
+/util/mm-common-get
+/util/mm-common-get.1
 /util/mm-common-prepare
 /util/mm-common-prepare.1
 /util/mm-common*.pc
diff --git a/Makefile.am b/Makefile.am
index 1cd5df1..cbb7451 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,45 +82,41 @@ skeletonmm_data_files =                                                     \
        skeletonmm/AUTHORS                                              \
        skeletonmm/COPYING                                              \
        skeletonmm/ChangeLog                                            \
-       skeletonmm/Makefile.am                                          \
+       skeletonmm/meson.build                                  \
+       skeletonmm/meson_options.txt            \
        skeletonmm/README                                               \
-       skeletonmm/configure.ac                                         \
        skeletonmm/skeletonmm.doap                                      \
-       skeletonmm/build/.gitignore                                     \
-       skeletonmm/codegen/Makefile.am                                  \
-       skeletonmm/codegen/extradefs/generate_extra_defs_skeleton.cc    \
-       skeletonmm/codegen/m4/convert.m4                                \
-       skeletonmm/codegen/m4/convert_skeleton.m4                       \
-       skeletonmm/codegen/m4/filelist.am                               \
-       skeletonmm/doc/Makefile.am                                      \
-       skeletonmm/doc/reference/.gitignore                             \
-       skeletonmm/doc/reference/Doxyfile.in                            \
-       skeletonmm/examples/.gitignore                                  \
-       skeletonmm/examples/Makefile.am                                 \
-       skeletonmm/examples/example/example.cc                          \
-       skeletonmm/skeleton/.gitignore                                  \
-       skeletonmm/skeleton/skeletonmm-uninstalled.pc.in                \
+       skeletonmm/doc/reference/Doxyfile.in            \
+       skeletonmm/doc/reference/meson.build            \
+       skeletonmm/examples/meson.build                                 \
+       skeletonmm/examples/example1/main.cc            \
+       skeletonmm/skeleton/meson.build                                 \
+       skeletonmm/skeleton/skeletonmm-uninstalled.pc.in \
        skeletonmm/skeleton/skeletonmm.h                                \
        skeletonmm/skeleton/skeletonmm.pc.in                            \
        skeletonmm/skeleton/skeletonmmconfig.h.in                       \
-       skeletonmm/skeleton/skeletonmm/Makefile.am                      \
-       skeletonmm/skeleton/skeletonmm/filelist.am                      \
+       skeletonmm/skeleton/skeletonmm/meson.build                      \
        skeletonmm/skeleton/skeletonmm/wrap_init.h                      \
-       skeletonmm/skeleton/skeletonmm/private/.gitignore               \
-       skeletonmm/skeleton/src/Makefile.am                             \
-       skeletonmm/skeleton/src/filelist.am                             \
        skeletonmm/skeleton/src/skeleton.ccg                            \
        skeletonmm/skeleton/src/skeleton.defs                           \
        skeletonmm/skeleton/src/skeleton.hg                             \
        skeletonmm/skeleton/src/skeleton_docs.xml                       \
-       skeletonmm/skeleton/src/skeleton_enum.defs                      \
-       skeletonmm/skeleton/src/skeleton_method.defs \
-       skeletonmm/skeleton/src/skeleton_signal.defs \
-       skeletonmm/skeleton/src/skeleton_vfunc.defs
+       skeletonmm/skeleton/src/skeleton_enums.defs             \
+       skeletonmm/skeleton/src/skeleton_methods.defs \
+       skeletonmm/skeleton/src/skeleton_signals.defs \
+       skeletonmm/skeleton/src/skeleton_vfuncs.defs \
+       skeletonmm/tests/meson.build \
+       skeletonmm/tests/test1/main.cc \
+       skeletonmm/tests/test2/main.cc \
+       skeletonmm/tools/extra_defs_gen/generate_defs_skeleton.cc \
+       skeletonmm/tools/extra_defs_gen/meson.build     \
+       skeletonmm/tools/m4/convert.m4                          \
+       skeletonmm/tools/m4/convert_skeleton.m4                 \
+       skeletonmm/untracked/README
 
 skeletonmm_script_files = \
-  skeletonmm/autogen.sh \
-  skeletonmm/codegen/generate_defs_and_docs.sh
+  skeletonmm/tools/dist-cmd.py \
+  skeletonmm/tools/generate_defs_and_docs.sh
 
 skeletonmm_files = $(skeletonmm_script_files) $(skeletonmm_data_files)
 
diff --git a/README b/README
index 3d7286b..d4bea2a 100644
--- a/README
+++ b/README
@@ -23,7 +23,7 @@ The files that mm-common installs and mm-common-get copies to other
 modules are useful in modules that are built with Meson.
 
 The files in the skeletonmm directory show the start of a project that will
-use Autotools.
+use Meson.
 
 Skeleton C++ binding module
 ===========================
@@ -31,7 +31,7 @@ Skeleton C++ binding module
 When creating a new C++ binding module based on mm-common, the easiest way
 to get started is to copy the skeletonmm directory shipped with mm-common.
 It contains the build support files required for a C++ binding module using
-Autotools, gmmproc and glibmm.
+Meson, gmmproc and glibmm.
 
 In order to create a new binding project from the copied skeleton directory,
 any files which have "skeleton" in the filename must be renamed.  References
diff --git a/meson.build b/meson.build
index a14b535..d0eed8f 100644
--- a/meson.build
+++ b/meson.build
@@ -206,47 +206,43 @@ configure_file(
 
 # Skeleton project.
 skeletonmm_basefiles = [
-  'autogen.sh',
   '.gitignore',
   'AUTHORS',
   'COPYING',
   'ChangeLog',
-  'Makefile.am',
+  'meson.build',
+  'meson_options.txt',
   'README',
-  'configure.ac',
   'skeletonmm.doap',
-  'build/.gitignore',
-  'codegen/generate_defs_and_docs.sh',
-  'codegen/Makefile.am',
-  'codegen/extradefs/generate_extra_defs_skeleton.cc',
-  'codegen/m4/convert.m4',
-  'codegen/m4/convert_skeleton.m4',
-  'codegen/m4/filelist.am',
-  'doc/Makefile.am',
-  'doc/reference/.gitignore',
   'doc/reference/Doxyfile.in',
-  'examples/.gitignore',
-  'examples/Makefile.am',
-  'examples/example/example.cc',
-  'skeleton/.gitignore',
+  'doc/reference/meson.build',
+  'examples/meson.build',
+  'examples/example1/main.cc',
+  'skeleton/meson.build',
   'skeleton/skeletonmm-uninstalled.pc.in',
   'skeleton/skeletonmm.h',
   'skeleton/skeletonmm.pc.in',
   'skeleton/skeletonmmconfig.h.in',
-  'skeleton/skeletonmm/Makefile.am',
-  'skeleton/skeletonmm/filelist.am',
+  'skeleton/skeletonmm/meson.build',
   'skeleton/skeletonmm/wrap_init.h',
-  'skeleton/skeletonmm/private/.gitignore',
-  'skeleton/src/Makefile.am',
-  'skeleton/src/filelist.am',
   'skeleton/src/skeleton.ccg',
   'skeleton/src/skeleton.defs',
   'skeleton/src/skeleton.hg',
   'skeleton/src/skeleton_docs.xml',
-  'skeleton/src/skeleton_enum.defs',
-  'skeleton/src/skeleton_method.defs',
-  'skeleton/src/skeleton_signal.defs',
-  'skeleton/src/skeleton_vfunc.defs',
+  'skeleton/src/skeleton_enums.defs',
+  'skeleton/src/skeleton_methods.defs',
+  'skeleton/src/skeleton_signals.defs',
+  'skeleton/src/skeleton_vfuncs.defs',
+  'tests/meson.build',
+  'tests/test1/main.cc',
+  'tests/test2/main.cc',
+  'tools/dist-cmd.py',
+  'tools/generate_defs_and_docs.sh',
+  'tools/extra_defs_gen/generate_defs_skeleton.cc',
+  'tools/extra_defs_gen/meson.build',
+  'tools/m4/convert.m4',
+  'tools/m4/convert_skeleton.m4',
+  'untracked/README',
 ]
 skeletonmm_files = []
 foreach file : skeletonmm_basefiles
diff --git a/skeletonmm/.gitignore b/skeletonmm/.gitignore
index 22d053d..564fbd3 100644
--- a/skeletonmm/.gitignore
+++ b/skeletonmm/.gitignore
@@ -1,31 +1,3 @@
-# wildcard patterns
-.deps/
-.dirstamp
-.libs/
-Makefile
-Makefile.in
-stamp-h?
-*.[ao]
-*.l[ao]
-
-# ./
-/INSTALL
-/aclocal.m4
-/autom4te.cache/
-/config*.lineno
-/config.log
-/config.status
-/configure
-/skeletonmm-*.tar.*
-/libtool
-
-# codegen/
-/codegen/extradefs/generate_extra_defs
-
-# doc/
-/doc/doc-install.pl
-/doc/doc-postprocess.pl
-/doc/doxygen.css
-/doc/doxygen-extra.css
-/doc/tagfile-to-devhelp2.xsl
-
+untracked/build_scripts/
+untracked/doc/
+untracked/skeleton/
diff --git a/skeletonmm/doc/reference/meson.build b/skeletonmm/doc/reference/meson.build
new file mode 100644
index 0000000..9611195
--- /dev/null
+++ b/skeletonmm/doc/reference/meson.build
@@ -0,0 +1,154 @@
+# doc/reference
+
+# Input: built_files_root, project_source_root, skeletonmm_pcname, perl,
+#        hg_ccg_basenames, extra_h_files, built_file_targets, install_datadir,
+#        dist_cmd, python3
+# Output: install_docdir, install_devhelpdir
+
+tag_file_modules = [
+  'mm-common-libstdc++',
+  'sigc++-2.0',
+  'glibmm-2.4',
+]
+doxygen_tagfiles = ''
+docinstall_flags = []
+foreach module : tag_file_modules
+  depmod = dependency(module, required: false)
+  if depmod.found()
+    doxytagfile = depmod.get_pkgconfig_variable('doxytagfile')
+    htmlrefpub = depmod.get_pkgconfig_variable('htmlrefpub', default: '')
+    htmlrefdir = depmod.get_pkgconfig_variable('htmlrefdir', default: '')
+    if htmlrefpub == ''
+      htmlrefpub = htmlrefdir
+    elif htmlrefdir == ''
+      htmlrefdir = htmlrefpub
+    endif
+    doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
+    if not htmlrefdir.endswith('/')
+      htmlrefdir += '/'
+    endif
+    docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
+  endif
+endforeach
+
+book_name = skeletonmm_pcname
+book_title = meson.project_name() + ' Reference Manual'
+
+# Configuration data for Doxyfile.
+doc_conf_data = configuration_data()
+doc_conf_data.set('configure_input',
+  'doc/reference/Doxyfile. Generated from Doxyfile.in by meson.configure_file().')
+doc_conf_data.set('PACKAGE_NAME', meson.project_name())
+doc_conf_data.set('PACKAGE_VERSION', meson.project_version())
+doc_conf_data.set('abs_top_builddir', built_files_root)
+doc_conf_data.set('abs_top_srcdir', project_source_root)
+doc_conf_data.set('SKELETONMM_MODULE_NAME', book_name)
+doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles)
+doc_conf_data.set('PERL', perl.path())
+
+configure_file(
+  input: 'Doxyfile.in',
+  output: '@BASENAME@',
+  configuration: doc_conf_data,
+)
+
+# Installation directories relative to {prefix}.
+install_docdir = install_datadir / 'doc' / book_name
+install_reference_docdir = install_docdir / 'reference'
+install_devhelpdir = install_datadir / 'devhelp' / 'books' / book_name
+
+if not build_documentation
+  # Documentation shall not be built or installed.
+  # Return to the calling meson.build file.
+  subdir_done()
+endif
+
+# Built input .h files to Doxygen.
+built_h_files = []
+foreach file : hg_ccg_basenames
+  built_h_files += built_files_root / 'skeleton' / 'skeletonmm' / file + '.h'
+endforeach
+
+# Hand-coded input .h files to Doxygen.
+src_h_files = []
+foreach file : extra_h_files
+  if file != 'wrap_init.h'
+    src_h_files += project_source_root / 'skeleton' / 'skeletonmm' / file
+  endif
+endforeach
+src_h_files += project_source_root / 'skeleton' / 'skeletonmm.h'
+
+doctool_dir = project_source_root / 'untracked' / 'doc' # MMDOCTOOLDIR
+doctool_dist_dir = 'untracked' / 'doc' # Relative to MESON_DIST_ROOT
+
+if built_file_targets.length() > 0
+  # .h files have been generated from .hg files (maintainer mode).
+  tag_file = custom_target('html_and_tag',
+    input: src_h_files,
+    output: book_name + '.tag',
+    command: [
+      python3, doc_reference, 'doxygen',
+      doctool_dir,
+      '@OUTPUT@',
+      built_h_files,
+      '@INPUT@',
+    ],
+    build_by_default: build_documentation,
+    depends: built_file_targets,
+    install: true,
+    install_dir: install_reference_docdir,
+  )
+else
+  # All .h files are stored in the source tree (not maintainer mode).
+  tag_file = custom_target('html_and_tag',
+    input: src_h_files + built_h_files,
+    output: book_name + '.tag',
+    command: [
+      python3, doc_reference, 'doxygen',
+      doctool_dir,
+      '@OUTPUT@',
+      '@INPUT@',
+    ],
+    build_by_default: build_documentation,
+    install: true,
+    install_dir: install_reference_docdir,
+  )
+endif
+
+devhelp_file = custom_target('devhelp',
+  input: tag_file,
+  output: book_name + '.devhelp2',
+  command: [
+    python3, doc_reference, 'devhelp',
+    doctool_dir,
+    '@INPUT@',
+    '@OUTPUT@',
+    book_name,
+    book_title,
+  ],
+  build_by_default: build_documentation,
+)
+
+# Install Devhelp file and html files.
+meson.add_install_script(
+  python3.path(), doc_reference, 'install_doc',
+  doctool_dir,
+  devhelp_file.full_path(),
+  install_devhelpdir,
+  install_reference_docdir / 'html',
+  docinstall_flags
+)
+
+if not meson.is_subproject()
+  # Distribute built files and files copied by mm-common-prepare.
+  # (add_dist_script() is not allowed in a subproject)
+  meson.add_dist_script(
+    python3.path(), dist_cmd,
+    python3.path(), doc_reference, 'dist_doc',
+    doctool_dir,
+    doctool_dist_dir,
+    meson.current_build_dir(),
+    tag_file.full_path(),
+    devhelp_file.full_path(),
+  )
+endif
diff --git a/skeletonmm/examples/example/example.cc b/skeletonmm/examples/example1/main.cc
similarity index 93%
rename from skeletonmm/examples/example/example.cc
rename to skeletonmm/examples/example1/main.cc
index 4e8dbb0..3507caf 100644
--- a/skeletonmm/examples/example/example.cc
+++ b/skeletonmm/examples/example1/main.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010  Joe Hacker <joe example com>
+/* Copyright (c) 2019  Joe Hacker <joe example com>
  *
  * This file is part of skeletonmm.
  *
diff --git a/skeletonmm/examples/meson.build b/skeletonmm/examples/meson.build
new file mode 100644
index 0000000..69e2f0a
--- /dev/null
+++ b/skeletonmm/examples/meson.build
@@ -0,0 +1,34 @@
+# examples
+
+# input: gnome, skeletonmm_dep, build_examples
+
+examples = [
+# [[dir-name], exe-name, [sources]]
+  [['example1'], 'example', ['main.cc']],
+]
+
+foreach ex : examples
+  dir = ''
+  foreach dir_part : ex[0]
+    dir = dir / dir_part
+  endforeach
+  ex_name = (dir / ex[1]).underscorify()
+  ex_sources = []
+  resources = []
+  foreach src : ex[2]
+    if src.endswith('.gresource.xml')
+      resources = gnome.compile_resources(dir.underscorify() + '_resources',
+        dir / src,
+        source_dir: dir
+      )
+    else
+      ex_sources += dir / src
+    endif
+  endforeach
+
+  exe_file = executable(ex_name, ex_sources, resources,
+    dependencies: skeletonmm_dep,
+    gui_app: true,
+    build_by_default: build_examples
+  )
+endforeach
diff --git a/skeletonmm/meson.build b/skeletonmm/meson.build
new file mode 100644
index 0000000..558b8b4
--- /dev/null
+++ b/skeletonmm/meson.build
@@ -0,0 +1,195 @@
+# This file is part of skeletonmm.
+
+project('skeletonmm', 'cpp',
+  version: '0.1.0',
+  license: 'LGPLv2.1+',
+  default_options: [
+    'cpp_std=c++17'
+  ],
+  meson_version: '>= 0.50.0', # required for python3.path()
+)
+
+skeletonmm_api_version = '1.0'
+skeletonmm_pcname = meson.project_name() + '-' + skeletonmm_api_version
+
+skeletonmm_version_array = meson.project_version().split('.')
+skeletonmm_major_version = skeletonmm_version_array[0].to_int()
+skeletonmm_minor_version = skeletonmm_version_array[1].to_int()
+skeletonmm_micro_version = skeletonmm_version_array[2].to_int()
+
+# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+# The relation between libtool's current:revison:age interface versioning
+# and the .so filename, .so.x.y.z, is
+# x = current - age
+# y = age
+# z = revision
+# If libtool_soversion is updated as described in libtool's documentation,
+# x.y.z will usually *not* be equal to meson.project_version().
+libtool_soversion = [0, 0, 0]
+skeletonmm_libversion = '@0@.@1@.@2@'.format(
+  libtool_soversion[0] - libtool_soversion[2],
+  libtool_soversion[2],
+  libtool_soversion[1])
+
+# Use these instead of meson.source_root() and meson.build_root() in subdirectories.
+# source_root() and build_root() are not useful, if this is a subproject.
+project_source_root = meson.current_source_dir()
+project_build_root = meson.current_build_dir()
+
+python3 = import('python').find_installation('python3')
+python_version = python3.language_version()
+python_version_req = '>= 3.5'
+if not python_version.version_compare(python_version_req)
+  error('Requires Python @0@, found @1@.'.format(python_version_req, python_version))
+endif
+
+# Do we build from a git repository?
+# Suppose we do if and only if a .git directory exists.
+cmd_py = '''
+import os
+import sys
+sys.exit(0 if os.path.isdir("@0@") else 1)
+'''.format(project_source_root / '.git')
+is_git_build = run_command(python3, '-c', cmd_py).returncode() == 0
+# In Unix-like system, an alternative is
+# is_git_build = run_command('test', '-d', project_source_root / '.git').returncode() == 0
+# Python code can be used in all operating sytems where Meson can run.
+
+# Options.
+maintainer_mode_opt = get_option('maintainer-mode')
+maintainer_mode = maintainer_mode_opt == 'true' or \
+                 (maintainer_mode_opt == 'if-git-build' and is_git_build)
+warning_level = get_option('warnings')
+build_deprecated_api = get_option('build-deprecated-api')
+build_documentation_opt = get_option('build-documentation')
+build_documentation = build_documentation_opt == 'true' or \
+                     (build_documentation_opt == 'if-maintainer-mode' and maintainer_mode)
+build_examples = get_option('build-examples')
+
+# Installation directories are relative to {prefix}.
+install_prefix = get_option('prefix')
+install_includedir = get_option('includedir')
+install_libdir = get_option('libdir')
+install_datadir = get_option('datadir')
+install_pkgconfigdir = install_libdir / 'pkgconfig'
+
+# Dependencies.
+# skeletonmm_build_dep: Dependencies when building the skeletonmm library.
+# skeletonmm_dep (created in skeleton/skeletonmm/meson.build):
+#   Dependencies when using the skeletonmm library.
+glibmm_req = '>= 2.62.0'
+skeleton_req = '>= 1.0.0'
+glibmm_dep = dependency('glibmm-2.4', version: glibmm_req)
+skeleton_dep = dependency('skeleton-1.0', version: skeleton_req)
+skeletonmm_build_dep = [glibmm_dep, skeleton_dep]
+skeletonmm_requires = ' '.join([
+  'glibmm-2.4', glibmm_req,
+  'skeleton-1.0', skeleton_req,
+])
+gnome = import('gnome')
+
+# Some dependencies are required only in maintainer mode and/or if
+# reference documentation shall be built.
+mm_common_get = find_program('mm-common-get', required: maintainer_mode)
+m4 = find_program('m4', required: maintainer_mode) # Used by gmmproc (in glibmm)
+perl = find_program('perl', required: maintainer_mode or build_documentation)
+doxygen = find_program('doxygen', required: build_documentation)
+dot = find_program('dot', required: build_documentation) # Used by Doxygen
+xsltproc = find_program('xsltproc', required: build_documentation)
+
+# Where to find gmmproc and generate_wrap_init.pl.
+gmmproc_dir = glibmm_dep.get_pkgconfig_variable('gmmprocdir')
+
+script_dir = project_source_root / 'untracked' / 'build_scripts'
+generate_binding = script_dir / 'generate-binding.py'
+doc_reference = script_dir / 'doc-reference.py'
+dist_changelog = script_dir / 'dist-changelog.py'
+dist_build_scripts = script_dir / 'dist-build-scripts.py'
+dist_cmd = project_source_root / 'tools' / 'dist-cmd.py' # Must be committed to git.
+
+if maintainer_mode and mm_common_get.found()
+  # Copy files to untracked/build_scripts and untracked/doc.
+  run_command(mm_common_get, '--force', script_dir,
+    project_source_root / 'untracked' / 'doc')
+endif
+
+cpp_compiler = meson.get_compiler('cpp')
+
+# Set compiler warnings.
+warning_flags = []
+if warning_level == 'min'
+  warning_flags = ['-Wall']
+elif warning_level == 'max' or warning_level == 'fatal'
+  warning_flags = '-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow 
-Wno-long-long'.split()
+  if warning_level == 'fatal'
+    warning_flags += ['-Werror']
+    deprecations = 'G SKELETON GLIBMM SIGCXX'.split()
+    foreach d : deprecations
+      warning_flags += '-D@0@_DISABLE_DEPRECATED'.format(d)
+    endforeach
+  endif
+endif
+
+warning_flags = cpp_compiler.get_supported_arguments(warning_flags)
+add_project_arguments(warning_flags, language: 'cpp')
+
+subdir('tools/extra_defs_gen')
+subdir('skeleton')
+subdir('examples')
+subdir('tests')
+subdir('doc/reference')
+
+if not meson.is_subproject()
+  # Add a ChangeLog file to the distribution directory.
+  # (add_dist_script() is not allowed in a subproject)
+  meson.add_dist_script(
+    python3.path(), dist_cmd,
+    python3.path(), dist_changelog,
+    project_source_root,
+  )
+  # Add build scripts to the distribution directory, and delete .gitignore
+  # files and an empty $MESON_DIST_ROOT/build/ directory.
+  meson.add_dist_script(
+    python3.path(), dist_cmd,
+    python3.path(), dist_build_scripts,
+    project_source_root,
+    'untracked' / 'build_scripts',
+  )
+endif
+
+# Print a summary.
+real_maintainer_mode = ''
+if maintainer_mode_opt == 'if-git-build'
+  real_maintainer_mode = ' (@0@)'.format(maintainer_mode)
+endif
+
+real_build_documentation = ''
+if build_documentation_opt == 'if-maintainer-mode'
+  real_build_documentation = ' (@0@)'.format(build_documentation)
+endif
+
+summary = [
+  '',
+  '------',
+  meson.project_name() + ' ' + meson.project_version(),
+  '',
+  '         Maintainer mode: @0@@1@'.format(maintainer_mode_opt, real_maintainer_mode),
+  '       Compiler warnings: @0@'.format(warning_level),
+  '    Build deprecated API: @0@'.format(build_deprecated_api),
+  'Build HTML documentation: @0@@1@'.format(build_documentation_opt, real_build_documentation),
+  '  Build example programs: @0@'.format(build_examples),
+  'Directories:',
+  '                  prefix: @0@'.format(install_prefix),
+  '              includedir: @0@'.format(install_prefix / install_includedir),
+  '    includeskeletonmmdir: @0@'.format(install_prefix / install_includedir / skeletonmm_pcname),
+  '                  libdir: @0@'.format(install_prefix / install_libdir),
+  '        includeconfigdir: @0@'.format(install_prefix / install_includeconfigdir),
+  '                   m4dir: @0@'.format(install_prefix / install_m4dir),
+  '            pkgconfigdir: @0@'.format(install_prefix / install_pkgconfigdir),
+  '                 datadir: @0@'.format(install_prefix / install_datadir),
+  '                  docdir: @0@'.format(install_prefix / install_docdir),
+  '              devhelpdir: @0@'.format(install_prefix / install_devhelpdir),
+  '------'
+]
+
+message('\n'.join(summary))
diff --git a/skeletonmm/meson_options.txt b/skeletonmm/meson_options.txt
new file mode 100644
index 0000000..6611d15
--- /dev/null
+++ b/skeletonmm/meson_options.txt
@@ -0,0 +1,10 @@
+option('maintainer-mode', type: 'combo', choices: ['false', 'if-git-build', 'true'],
+  value: 'if-git-build', description: 'Generate source code from .hg and .ccg files')
+option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'], value: 'fatal',
+  description: 'Compiler warning level')
+option('build-deprecated-api', type: 'boolean', value: true,
+  description: 'Build deprecated API and include it in the library')
+option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-mode', 'true'],
+  value: 'if-maintainer-mode', description: 'Build and install the documentation')
+option('build-examples', type: 'boolean', value: true,
+  description: 'Build example programs')
diff --git a/skeletonmm/skeleton/meson.build b/skeletonmm/skeleton/meson.build
new file mode 100644
index 0000000..85fa533
--- /dev/null
+++ b/skeletonmm/skeleton/meson.build
@@ -0,0 +1,51 @@
+# skeleton
+
+# Input: install_prefix, install_datadir, install_includedir,
+#        skeletonmm_pcname, skeletonmm_api_version, skeletonmm_requires,
+#        install_pkgconfigdir, install_libdir, build_deprecated_api,
+#        skeletonmm_major_version, skeletonmm_minor_version, skeletonmm_micro_version
+# Output: pkg_conf_data, install_includeconfigdir
+
+pkg_conf_data = configuration_data()
+pkg_conf_data.set('prefix', install_prefix)
+pkg_conf_data.set('exec_prefix', '${prefix}')
+pkg_conf_data.set('libdir', '${prefix}' / install_libdir)
+pkg_conf_data.set('datarootdir', '${prefix}' / install_datadir)
+pkg_conf_data.set('datadir', '${datarootdir}')
+pkg_conf_data.set('includedir', '${prefix}' / install_includedir)
+pkg_conf_data.set('srcdir', meson.current_source_dir())
+pkg_conf_data.set('PACKAGE_TARNAME', meson.project_name())
+pkg_conf_data.set('PACKAGE_VERSION', meson.project_version())
+pkg_conf_data.set('SKELETONMM_MODULE_NAME', skeletonmm_pcname)
+pkg_conf_data.set('SKELETONMM_API_VERSION', skeletonmm_api_version)
+pkg_conf_data.set('SKELETONMM_MODULES', skeletonmm_requires)
+
+if not build_deprecated_api
+  pkg_conf_data.set('SKELETONMM_DISABLE_DEPRECATED', true)
+endif
+pkg_conf_data.set('SKELETONMM_MAJOR_VERSION', skeletonmm_major_version)
+pkg_conf_data.set('SKELETONMM_MINOR_VERSION', skeletonmm_minor_version)
+pkg_conf_data.set('SKELETONMM_MICRO_VERSION', skeletonmm_micro_version)
+
+configure_file(
+  input: 'skeletonmm.pc.in',
+  output: skeletonmm_pcname + '.pc',
+  configuration: pkg_conf_data,
+  install_dir: install_pkgconfigdir,
+)
+
+configure_file(
+  input: 'skeletonmm-uninstalled.pc.in',
+  output: skeletonmm_pcname + '-uninstalled.pc',
+  configuration: pkg_conf_data,
+)
+
+install_includeconfigdir = install_libdir / skeletonmm_pcname / 'include'
+configure_file(
+  input: 'skeletonmmconfig.h.in',
+  output: '@BASENAME@',
+  configuration: pkg_conf_data,
+  install_dir: install_includeconfigdir,
+)
+
+subdir('skeletonmm')
diff --git a/skeletonmm/skeleton/skeletonmm-uninstalled.pc.in 
b/skeletonmm/skeleton/skeletonmm-uninstalled.pc.in
index 7125be1..e355e18 100644
--- a/skeletonmm/skeleton/skeletonmm-uninstalled.pc.in
+++ b/skeletonmm/skeleton/skeletonmm-uninstalled.pc.in
@@ -3,7 +3,7 @@ htmlrefpub=http://library.gnome.org/devel/@PACKAGE_TARNAME@/unstable/
 
 Name: skeletonmm
 Description: C++ binding for skeleton, not installed
-Version: @SKELETONMM_VERSION@
+Version: @PACKAGE_VERSION@
 URL: http://www.gtkmm.org/
 Requires: @SKELETONMM_MODULES@
 Libs: ${pc_top_builddir}/${pcfiledir}/skeletonmm/libskeletonmm-@SKELETONMM_API_VERSION@.la
diff --git a/skeletonmm/skeleton/skeletonmm.h b/skeletonmm/skeleton/skeletonmm.h
index 30dfddd..7078e16 100644
--- a/skeletonmm/skeleton/skeletonmm.h
+++ b/skeletonmm/skeleton/skeletonmm.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010  Joe Hacker <joe example com>
+/* Copyright (c) 2019  Joe Hacker <joe example com>
  *
  * This file is part of skeletonmm.
  *
diff --git a/skeletonmm/skeleton/skeletonmm.pc.in b/skeletonmm/skeleton/skeletonmm.pc.in
index d74f343..b92cf53 100644
--- a/skeletonmm/skeleton/skeletonmm.pc.in
+++ b/skeletonmm/skeleton/skeletonmm.pc.in
@@ -12,7 +12,7 @@ htmlrefpub=http://library.gnome.org/devel/@PACKAGE_TARNAME@/unstable/
 
 Name: skeletonmm
 Description: C++ binding for skeleton
-Version: @SKELETONMM_VERSION@
+Version: @PACKAGE_VERSION@
 URL: http://www.gtkmm.org/
 Requires: @SKELETONMM_MODULES@
 Libs: -L${libdir} -lskeletonmm-@SKELETONMM_API_VERSION@
diff --git a/skeletonmm/skeleton/skeletonmm/meson.build b/skeletonmm/skeleton/skeletonmm/meson.build
new file mode 100644
index 0000000..ae36c58
--- /dev/null
+++ b/skeletonmm/skeleton/skeletonmm/meson.build
@@ -0,0 +1,172 @@
+# skeleton/skeletonmm
+
+# Input: skeletonmm_build_dep, skeletonmm_pcname, maintainer_mode, project_source_root,
+#        generate_binding, m4_files, skeletonmm_libversion, install_includedir,
+#        dist_cmd, python3
+# Output: hg_ccg_basenames, extra_h_files, built_file_targets, built_files_root,
+#         skeletonmm_dep
+
+defs_basefiles = [
+  'skeleton.defs',
+  'skeleton_methods.defs',
+  'skeleton_enums.defs',
+  'skeleton_signals.defs',
+  'skeleton_vfuncs.defs',
+  'skeleton_docs.xml',
+]
+
+defs_files = []
+foreach file : defs_basefiles
+  defs_files += '..' / 'src' / file
+endforeach
+
+hg_ccg_basenames = [
+  'skeleton',
+]
+
+extra_cc_files = [
+]
+
+extra_h_files = [
+  'wrap_init.h',
+]
+
+install_headers('..' / 'skeletonmm.h', subdir: skeletonmm_pcname)
+install_headers(extra_h_files, subdir: skeletonmm_pcname / 'skeletonmm')
+
+untracked_skeletonmm = 'untracked' / 'skeleton' / 'skeletonmm'
+src_untracked_skeletonmm = project_source_root / untracked_skeletonmm
+
+if maintainer_mode
+
+  # Maintainer mode. Generate .h and .cc files from .hg and .ccg files in ../src.
+
+  # doc/reference/meson.build needs this.
+  built_files_root = project_build_root
+
+  hg_files = []
+  foreach file : hg_ccg_basenames
+    hg_files += '..' / 'src' / file + '.hg'
+  endforeach
+
+  # Create wrap_init.cc in project_build_root/skeleton/skeletonmm.
+  wrap_init_target = custom_target('wrap_init.cc',
+    input: hg_files,
+    output: 'wrap_init.cc',
+    command: [
+      python3, generate_binding, 'generate_wrap_init',
+      gmmproc_dir,
+      '@OUTPUT@',
+      'Skeleton', # namespace
+      '@INPUT@',
+    ],
+    build_by_default: maintainer_mode,
+    install: false,
+  )
+
+  # Force meson+ninja to generate source files before anything is compiled.
+  # Compilation must depend on these targets.
+  built_file_targets = []
+
+  # Create .h/_p.h/.cc files from .hg/.ccg files in project_build_root/skeleton/skeletonmm.
+  foreach file : hg_ccg_basenames
+    hg_file = '..' / 'src' / file + '.hg'
+    ccg_file = '..' / 'src' / file + '.ccg'
+    built_file_targets += custom_target(file + '.cc',
+      input: [hg_file, ccg_file],
+      output: [file + '.stamp', file + '.cc'],
+      command: [
+        python3, generate_binding, 'gmmproc',
+        gmmproc_dir,
+        '@OUTPUT0@',
+        file,
+        meson.current_source_dir() / '..' / 'src',
+        project_source_root / 'tools' / 'm4',
+      ],
+      depend_files: defs_files + m4_files,
+      build_by_default: maintainer_mode,
+      install: false,
+    )
+  endforeach
+
+  extra_include_dirs = ['..']
+  skeletonmm_library = library(skeletonmm_pcname,
+    wrap_init_target, built_file_targets, extra_cc_files,
+    version: skeletonmm_libversion,
+    include_directories: extra_include_dirs,
+    dependencies: skeletonmm_build_dep,
+    install: true,
+  )
+
+  built_h_cc_dir = meson.current_build_dir()
+
+else # not maintainer_mode
+
+  # Not maintainer mode. Compile built source code files in
+  # project_source_root/untracked/skeleton/skeletonmm.
+
+  # doc/reference/meson.build needs these.
+  built_file_targets = []
+  built_files_root = project_source_root / 'untracked'
+
+  # Two cases:
+  # 1. The source code comes from a tarball, where the built files
+  #    are stored in project_source_root/untracked.
+  #    There are no built files in the build tree.
+  # 2. Files have been built in the build tree. Then maintainer_mode has
+  #    been changed from true to false. Files that are missing or not up to date
+  #    in project_source_root/untracked are copied from the build tree.
+
+  # Try to copy built source code files to the source tree.
+  run_command(
+    python3, generate_binding, 'copy_built_files',
+    meson.current_build_dir(),
+    src_untracked_skeletonmm,
+    hg_ccg_basenames,
+  )
+
+  built_cc_files = [ src_untracked_skeletonmm / 'wrap_init.cc' ]
+  foreach file : hg_ccg_basenames
+    built_cc_files += src_untracked_skeletonmm / file + '.cc'
+  endforeach
+
+  extra_include_dirs = [ '..', '..' / '..' / 'untracked' / 'skeleton' ]
+  skeletonmm_library = library(skeletonmm_pcname,
+    built_cc_files, extra_cc_files,
+    version: skeletonmm_libversion,
+    include_directories: extra_include_dirs,
+    dependencies: skeletonmm_build_dep,
+    install: true,
+  )
+
+  built_h_cc_dir = src_untracked_skeletonmm
+
+endif
+
+# Install built .h and _p.h files.
+meson.add_install_script(
+  python3.path(), generate_binding, 'install_built_h_files',
+  built_h_cc_dir,
+  install_includedir / skeletonmm_pcname / 'skeletonmm', # subdir below {prefix}
+  hg_ccg_basenames
+)
+
+if not meson.is_subproject()
+  # Distribute built files.
+  # (add_dist_script() is not allowed in a subproject)
+  meson.add_dist_script(
+    python3.path(), dist_cmd,
+    python3.path(), generate_binding, 'dist_built_files',
+    built_h_cc_dir,
+    untracked_skeletonmm,
+    hg_ccg_basenames,
+  )
+endif
+
+# This is useful in the main project when skeletonmm is used as a subproject.
+# It's also used when building example programs and test programs.
+skeletonmm_dep = declare_dependency(
+  link_with: skeletonmm_library,
+  include_directories: extra_include_dirs,
+  dependencies: skeletonmm_build_dep
+)
diff --git a/skeletonmm/skeleton/skeletonmm/wrap_init.h b/skeletonmm/skeleton/skeletonmm/wrap_init.h
index 45a47f6..c0c7d6c 100644
--- a/skeletonmm/skeleton/skeletonmm/wrap_init.h
+++ b/skeletonmm/skeleton/skeletonmm/wrap_init.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010  Joe Hacker <joe example com>
+/* Copyright (c) 2019  Joe Hacker <joe example com>
  *
  * This file is part of skeletonmm.
  *
@@ -19,6 +19,9 @@
 #ifndef SKELETONMM_WRAP_INIT_H_INCLUDED
 #define SKELETONMM_WRAP_INIT_H_INCLUDED
 
-namespace Skeleton { void wrap_init(); }
+namespace Skeleton
+{
+  void wrap_init();
+}
 
 #endif /* !SKELETONMM_WRAP_INIT_H_INCLUDED */
diff --git a/skeletonmm/skeleton/skeletonmmconfig.h.in b/skeletonmm/skeleton/skeletonmmconfig.h.in
index f6eccc4..8417fac 100644
--- a/skeletonmm/skeleton/skeletonmmconfig.h.in
+++ b/skeletonmm/skeleton/skeletonmmconfig.h.in
@@ -1,10 +1,19 @@
 /* This file is part of skeletonmm. */
+#ifndef SKELETONMMCONFIG_H_INCLUDED
+#define SKELETONMMCONFIG_H_INCLUDED
+
+#include <glibmmconfig.h>
+
+/* Define to omit deprecated API from the library. */
+#mesondefine SKELETONMM_DISABLE_DEPRECATED
 
 /* Major version number of skeletonmm. */
-#undef SKELETONMM_MAJOR_VERSION
+#mesondefine SKELETONMM_MAJOR_VERSION
+
+/* Minor version number of skeletonmm. */
+#mesondefine SKELETONMM_MINOR_VERSION
 
 /* Micro version number of skeletonmm. */
-#undef SKELETONMM_MICRO_VERSION
+#mesondefine SKELETONMM_MICRO_VERSION
 
-/* Minor version number of skeletonmm. */
-#undef SKELETONMM_MINOR_VERSION
+#endif /* !SKELETONMMCONFIG_H_INCLUDED */
diff --git a/skeletonmm/skeleton/src/skeleton.ccg b/skeletonmm/skeleton/src/skeleton.ccg
index be287f7..f7335ae 100644
--- a/skeletonmm/skeleton/src/skeleton.ccg
+++ b/skeletonmm/skeleton/src/skeleton.ccg
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010  Joe Hacker <joe example com>
+/* Copyright (c) 2019  Joe Hacker <joe example com>
  *
  * This file is part of skeletonmm.
  *
diff --git a/skeletonmm/skeleton/src/skeleton.defs b/skeletonmm/skeleton/src/skeleton.defs
index a2ffe9e..7abb537 100644
--- a/skeletonmm/skeleton/src/skeleton.defs
+++ b/skeletonmm/skeleton/src/skeleton.defs
@@ -1,5 +1,5 @@
 ;; Include generated API definition files
-(include skeleton_enum.defs)
-(include skeleton_method.defs)
-(include skeleton_signal.defs)
-(include skeleton_vfunc.defs)
+(include skeleton_enums.defs)
+(include skeleton_methods.defs)
+(include skeleton_signals.defs)
+(include skeleton_vfuncs.defs)
diff --git a/skeletonmm/skeleton/src/skeleton.hg b/skeletonmm/skeleton/src/skeleton.hg
index a9ae68b..0f74f34 100644
--- a/skeletonmm/skeleton/src/skeleton.hg
+++ b/skeletonmm/skeleton/src/skeleton.hg
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010  Joe Hacker <joe example com>
+/* Copyright (c) 2019  Joe Hacker <joe example com>
  *
  * This file is part of skeletonmm.
  *
@@ -33,7 +33,7 @@ protected:
   _CTOR_DEFAULT
 
 public:
-  _WRAP_CREATE
+  _WRAP_CREATE()
 };
 
 } // namespace Skeleton
diff --git a/skeletonmm/skeleton/src/skeleton_enum.defs b/skeletonmm/skeleton/src/skeleton_enums.defs
similarity index 100%
rename from skeletonmm/skeleton/src/skeleton_enum.defs
rename to skeletonmm/skeleton/src/skeleton_enums.defs
diff --git a/skeletonmm/skeleton/src/skeleton_method.defs b/skeletonmm/skeleton/src/skeleton_methods.defs
similarity index 100%
rename from skeletonmm/skeleton/src/skeleton_method.defs
rename to skeletonmm/skeleton/src/skeleton_methods.defs
diff --git a/skeletonmm/skeleton/src/skeleton_signal.defs b/skeletonmm/skeleton/src/skeleton_signals.defs
similarity index 100%
rename from skeletonmm/skeleton/src/skeleton_signal.defs
rename to skeletonmm/skeleton/src/skeleton_signals.defs
diff --git a/skeletonmm/skeleton/src/skeleton_vfunc.defs b/skeletonmm/skeleton/src/skeleton_vfuncs.defs
similarity index 100%
rename from skeletonmm/skeleton/src/skeleton_vfunc.defs
rename to skeletonmm/skeleton/src/skeleton_vfuncs.defs
diff --git a/skeletonmm/skeletonmm.doap b/skeletonmm/skeletonmm.doap
index 313314f..23d47db 100644
--- a/skeletonmm/skeletonmm.doap
+++ b/skeletonmm/skeletonmm.doap
@@ -9,6 +9,7 @@
   <homepage rdf:resource="http://www.gtkmm.org/"; />
   <mailing-list rdf:resource="mailto:gtkmm-list gnome org" />
   <category rdf:resource="http://api.gnome.org/doap-extensions#bindings"; />
+  <programming-language>C++</programming-language>
 
   <maintainer>
     <foaf:Person>
diff --git a/skeletonmm/tests/meson.build b/skeletonmm/tests/meson.build
new file mode 100644
index 0000000..68dcdd1
--- /dev/null
+++ b/skeletonmm/tests/meson.build
@@ -0,0 +1,37 @@
+# tests
+
+# input: gnome, skeletonmm_dep
+
+tests = [
+# [[dir-name], exe-name, [sources]]
+  [['test1'], 'test', ['main.cc']],
+  [['test2'], 'test', ['main.cc']],
+]
+
+foreach ex : tests
+  dir = ''
+  foreach dir_part : ex[0]
+    dir = dir / dir_part
+  endforeach
+  ex_name = (dir / ex[1]).underscorify()
+  ex_sources = []
+  resources = []
+  foreach src : ex[2]
+    if src.endswith('.gresource.xml')
+      resources = gnome.compile_resources(dir.underscorify() + '_resources',
+        dir / src,
+        source_dir: dir
+      )
+    else
+      ex_sources += dir / src
+    endif
+  endforeach
+
+  exe_file = executable(ex_name, ex_sources, resources,
+    dependencies: skeletonmm_dep,
+    gui_app: false,
+    build_by_default: true
+  )
+
+  test(dir.underscorify(), exe_file)
+endforeach
diff --git a/skeletonmm/tests/test1/main.cc b/skeletonmm/tests/test1/main.cc
new file mode 100644
index 0000000..4489920
--- /dev/null
+++ b/skeletonmm/tests/test1/main.cc
@@ -0,0 +1,30 @@
+/* Copyright (c) 2019  Joe Hacker <joe example com>
+ *
+ * This file is part of skeletonmm.
+ *
+ * skeletonmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * skeletonmm 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <skeletonmm.h>
+#include <cstdlib>
+
+namespace
+{
+
+} // anonymous namespace
+
+int main(int, char**)
+{
+  return EXIT_SUCCESS;
+}
diff --git a/skeletonmm/tests/test2/main.cc b/skeletonmm/tests/test2/main.cc
new file mode 100644
index 0000000..56c1136
--- /dev/null
+++ b/skeletonmm/tests/test2/main.cc
@@ -0,0 +1,30 @@
+/* Copyright (c) 2019  Joe Hacker <joe example com>
+ *
+ * This file is part of skeletonmm.
+ *
+ * skeletonmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * skeletonmm 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <skeletonmm.h>
+#include <cstdlib>
+
+namespace
+{
+
+} // anonymous namespace
+
+int main(int, char**)
+{
+  return EXIT_FAILURE;
+}
diff --git a/skeletonmm/tools/dist-cmd.py b/skeletonmm/tools/dist-cmd.py
new file mode 100755
index 0000000..30da5da
--- /dev/null
+++ b/skeletonmm/tools/dist-cmd.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with meson.add_dist_script() in meson.build.
+# meson.add_dist_script() can't call a script that's not committed to git.
+# This script shall be committed. It can be used for calling other non-committed scripts.
+
+# dist-cmd.py <cmd> <args>...
+
+import sys
+import subprocess
+
+sys.exit(subprocess.run(sys.argv[1:]).returncode)
diff --git a/skeletonmm/codegen/extradefs/generate_extra_defs_skeleton.cc 
b/skeletonmm/tools/extra_defs_gen/generate_defs_skeleton.cc
similarity index 78%
rename from skeletonmm/codegen/extradefs/generate_extra_defs_skeleton.cc
rename to skeletonmm/tools/extra_defs_gen/generate_defs_skeleton.cc
index 12fda94..cac1881 100644
--- a/skeletonmm/codegen/extradefs/generate_extra_defs_skeleton.cc
+++ b/skeletonmm/tools/extra_defs_gen/generate_defs_skeleton.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010  Joe Hacker <joe example com>
+/* Copyright (c) 2019  Joe Hacker <joe example com>
  *
  * This file is part of skeletonmm.
  *
@@ -16,6 +16,11 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+// We always need to generate the .defs for all types because the code
+// using deprecated API is generated unconditionally and only disabled
+// at compile time.
+#undef SKELETON_DISABLE_DEPRECATED
+
 #include <glibmm_generate_extra_defs/generate_extra_defs.h>
 #include <skeleton/skeleton.h>
 #include <iostream>
diff --git a/skeletonmm/tools/extra_defs_gen/meson.build b/skeletonmm/tools/extra_defs_gen/meson.build
new file mode 100644
index 0000000..69f3b16
--- /dev/null
+++ b/skeletonmm/tools/extra_defs_gen/meson.build
@@ -0,0 +1,26 @@
+# tools/extra_defs_gen
+
+# Input: cpp_compiler, skeletonmm_build_dep, install_libdir, skeletonmm_pcname
+# Output: m4_files, install_m4dir
+
+glibmm_generate_extra_defs_dep = cpp_compiler.find_library(
+  'glibmm_generate_extra_defs-2.4',
+)
+
+executable('generate_defs_skeleton', 'generate_defs_skeleton.cc',
+  dependencies: [skeletonmm_build_dep, glibmm_generate_extra_defs_dep],
+  install: false,
+)
+
+# Install m4 files for reuse by other *mm projects, when building from git.
+m4_basefiles = [
+  'convert.m4',
+  'convert_skeleton.m4',
+]
+m4_files = []
+foreach file : m4_basefiles
+  m4_files += '..' / 'm4' / file
+endforeach
+m4_files = files(m4_files)
+install_m4dir = install_libdir / skeletonmm_pcname / 'proc' / 'm4'
+install_data(m4_files, install_dir: install_m4dir)
diff --git a/skeletonmm/codegen/generate_defs_and_docs.sh b/skeletonmm/tools/generate_defs_and_docs.sh
similarity index 84%
rename from skeletonmm/codegen/generate_defs_and_docs.sh
rename to skeletonmm/tools/generate_defs_and_docs.sh
index 04d9773..025777e 100755
--- a/skeletonmm/codegen/generate_defs_and_docs.sh
+++ b/skeletonmm/tools/generate_defs_and_docs.sh
@@ -16,9 +16,9 @@
 
 # Generated files:
 #   skeletonmm/skeleton/src/skeleton_docs.xml
-#   skeletonmm/skeleton/src/skeleton_enum.defs
-#   skeletonmm/skeleton/src/skeleton_method.defs
-#   skeletonmm/skeleton/src/skeleton_signal.defs
+#   skeletonmm/skeleton/src/skeleton_enums.defs
+#   skeletonmm/skeleton/src/skeleton_methods.defs
+#   skeletonmm/skeleton/src/skeleton_signals.defs
 
 # Root directory of skeletonmm source files.
 root_dir="$(dirname "$0")/.."
@@ -39,12 +39,12 @@ gen_methods="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/defs_gen/h2def.py"
 gen_enums="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/enum.pl"
 
 # Where to find the executable that generates extra defs (signals and properties).
-extra_defs_gen_dir="$GMMPROC_GEN_BUILD_DIR/skeletonmm/codegen/extradefs"
+extra_defs_gen_dir="$GMMPROC_GEN_BUILD_DIR/skeletonmm/tools/extra_defs_gen"
 ### If skeletonmm is built with meson:
 if [ "$GMMPROC_GEN_SOURCE_DIR" == "$GMMPROC_GEN_BUILD_DIR" ]; then
   # skeletonmm is built with meson, which requires non-source-dir builds.
-  # This is what jhbuild does, if neccesary, to force non-source-dir builds.
-  extra_defs_gen_dir="$GMMPROC_GEN_BUILD_DIR/skeletonmm/build/codegen/extradefs"
+  # This is what jhbuild does, if necesary, to force non-source-dir builds.
+  extra_defs_gen_dir="$GMMPROC_GEN_BUILD_DIR/skeletonmm/build/tools/extra_defs_gen"
 fi
 ### If skeletonmm is built with autotools:
 # skeletonmm is built with autotools.
@@ -77,13 +77,13 @@ shopt -s nullglob # Skip a filename pattern that matches no file
 
 # Enums
 echo === skeleton_enum.defs ===
-"$gen_enums" "$source_prefix"/skeleton/*.h "$build_prefix"/skeleton/*.h  > "$out_dir/skeleton_enum.defs"
+"$gen_enums" "$source_prefix"/skeleton/*.h "$build_prefix"/skeleton/*.h  > "$out_dir/skeleton_enums.defs"
 
 # Functions and methods
 echo === skeleton_method.defs ===
-"$gen_methods" "$source_prefix"/skeleton/*.h "$build_prefix"/skeleton/*.h  > "$out_dir/skeleton_method.defs"
+"$gen_methods" "$source_prefix"/skeleton/*.h "$build_prefix"/skeleton/*.h  > "$out_dir/skeleton_methods.defs"
 
 # Properties and signals
 echo === skeleton_signal.defs ===
-"$extra_defs_gen_dir"/generate_extra_defs > "$out_dir/skeleton_signal.defs"
+"$extra_defs_gen_dir"/generate_defs_skeleton > "$out_dir/skeleton_signals.defs"
 
diff --git a/skeletonmm/codegen/m4/convert.m4 b/skeletonmm/tools/m4/convert.m4
similarity index 100%
rename from skeletonmm/codegen/m4/convert.m4
rename to skeletonmm/tools/m4/convert.m4
diff --git a/skeletonmm/codegen/m4/convert_skeleton.m4 b/skeletonmm/tools/m4/convert_skeleton.m4
similarity index 68%
rename from skeletonmm/codegen/m4/convert_skeleton.m4
rename to skeletonmm/tools/m4/convert_skeleton.m4
index 0c41fe1..11b1bdc 100644
--- a/skeletonmm/codegen/m4/convert_skeleton.m4
+++ b/skeletonmm/tools/m4/convert_skeleton.m4
@@ -1,4 +1,4 @@
-dnl Copyright (c) 2010  Joe Hacker <joe example com>
+dnl Copyright (c) 2019  Joe Hacker <joe example com>
 dnl This file is part of skeletonmm.
 
 _CONVERSION(`SkeletonSomeType*',`Glib::RefPtr<SomeType>',`Glib::wrap($3)')
diff --git a/skeletonmm/untracked/README b/skeletonmm/untracked/README
new file mode 100644
index 0000000..8082503
--- /dev/null
+++ b/skeletonmm/untracked/README
@@ -0,0 +1,36 @@
+untracked/README
+
+This directory contains files not tracked by a source code control program,
+such as git. (This README file is the exception.)
+
+The files can have one of two origins.
+
+1. Copied by the mm-common-get command.
+2. Generated when skeletonmm is built.
+
+Files of type 2 exist here only if skeletonmm is built with maintainer-mode=false,
+or the directory comes from a tarball.
+Files of both types exist here only if skeletonmm is built with Meson,
+or the tarball is created with Meson.
+
+1. Files copied by mm-common-get
+--------------------------------
+untracked/doc/doc-install.pl
+              doc-postprocess.pl
+              doxygen-extra.css
+              tagfile-to-devhelp2.xsl
+untracked/build_scripts/dist-build-scripts.py
+                        dist-changelog.py
+                        doc-reference.py
+                        generate-binding.py
+
+mm-common-get may copy more files, but they are not used by skeletonmm.
+
+2. Generated files
+------------------
+untracked/skeleton/skeletonmm/*.h
+                              *.cc
+                              private/*_p.h
+untracked/doc/reference/skeletonmm-1.0.devhelp2
+                        skeletonmm-1.0.tag
+                        html/*


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