Imported Upstream version 1.0.0 upstream/1.0.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 9 Sep 2020 06:58:22 +0000 (15:58 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 9 Sep 2020 06:58:22 +0000 (15:58 +0900)
74 files changed:
.gitignore
Makefile.am
NEWS
README
am_include/compile-binding.am [moved from build/compile-binding.am with 100% similarity]
am_include/dist-changelog.am [moved from build/dist-changelog.am with 100% similarity]
am_include/doc-reference.am [moved from build/doc-reference.am with 100% similarity]
am_include/generate-binding.am [moved from build/generate-binding.am with 100% similarity]
configure.ac
macros/mm-ax_cxx_compile_stdcxx.m4
meson.build [new file with mode: 0644]
meson_options.txt [new file with mode: 0644]
mm-common.doap
skeletonmm/.gitignore
skeletonmm/Makefile.am [deleted file]
skeletonmm/autogen.sh [deleted file]
skeletonmm/build/.gitignore [deleted file]
skeletonmm/codegen/Makefile.am [deleted file]
skeletonmm/codegen/generate_defs_and_docs.sh [deleted file]
skeletonmm/codegen/m4/filelist.am [deleted file]
skeletonmm/configure.ac [deleted file]
skeletonmm/doc/Makefile.am [deleted file]
skeletonmm/doc/reference/.gitignore [deleted file]
skeletonmm/doc/reference/Doxyfile.in
skeletonmm/doc/reference/meson.build [new file with mode: 0644]
skeletonmm/examples/.gitignore [deleted file]
skeletonmm/examples/Makefile.am [deleted file]
skeletonmm/examples/example1/main.cc [moved from skeletonmm/examples/example/example.cc with 93% similarity]
skeletonmm/examples/meson.build [new file with mode: 0644]
skeletonmm/meson.build [new file with mode: 0644]
skeletonmm/meson_options.txt [new file with mode: 0644]
skeletonmm/skeleton/.gitignore [deleted file]
skeletonmm/skeleton/meson.build [new file with mode: 0644]
skeletonmm/skeleton/skeletonmm-uninstalled.pc.in
skeletonmm/skeleton/skeletonmm.h
skeletonmm/skeleton/skeletonmm.pc.in
skeletonmm/skeleton/skeletonmm/Makefile.am [deleted file]
skeletonmm/skeleton/skeletonmm/filelist.am [deleted file]
skeletonmm/skeleton/skeletonmm/meson.build [new file with mode: 0644]
skeletonmm/skeleton/skeletonmm/private/.gitignore [deleted file]
skeletonmm/skeleton/skeletonmm/wrap_init.h
skeletonmm/skeleton/skeletonmmconfig.h.in
skeletonmm/skeleton/src/Makefile.am [deleted file]
skeletonmm/skeleton/src/filelist.am [deleted file]
skeletonmm/skeleton/src/skeleton.ccg
skeletonmm/skeleton/src/skeleton.defs
skeletonmm/skeleton/src/skeleton.hg
skeletonmm/skeleton/src/skeleton_enums.defs [moved from skeletonmm/skeleton/src/skeleton_enum.defs with 100% similarity]
skeletonmm/skeleton/src/skeleton_methods.defs [moved from skeletonmm/skeleton/src/skeleton_method.defs with 100% similarity]
skeletonmm/skeleton/src/skeleton_signals.defs [moved from skeletonmm/skeleton/src/skeleton_signal.defs with 100% similarity]
skeletonmm/skeleton/src/skeleton_vfuncs.defs [moved from skeletonmm/skeleton/src/skeleton_vfunc.defs with 100% similarity]
skeletonmm/skeletonmm.doap
skeletonmm/tests/meson.build [new file with mode: 0644]
skeletonmm/tests/test1/main.cc [new file with mode: 0644]
skeletonmm/tests/test2/main.cc [new file with mode: 0644]
skeletonmm/tools/dist-cmd.py [new file with mode: 0755]
skeletonmm/tools/extra_defs_gen/generate_defs_skeleton.cc [moved from skeletonmm/codegen/extradefs/generate_extra_defs_skeleton.cc with 78% similarity]
skeletonmm/tools/extra_defs_gen/meson.build [new file with mode: 0644]
skeletonmm/tools/generate_defs_and_docs.sh [new file with mode: 0755]
skeletonmm/tools/m4/convert.m4 [moved from skeletonmm/codegen/m4/convert.m4 with 100% similarity]
skeletonmm/tools/m4/convert_skeleton.m4 [moved from skeletonmm/codegen/m4/convert_skeleton.m4 with 68% similarity]
skeletonmm/untracked/README [new file with mode: 0644]
util/build_scripts/dist-build-scripts.py [new file with mode: 0755]
util/build_scripts/dist-changelog.py [new file with mode: 0755]
util/build_scripts/doc-reference.py [new file with mode: 0755]
util/build_scripts/generate-binding.py [new file with mode: 0755]
util/meson_aux/extra-dist-cmd.py [new file with mode: 0755]
util/meson_aux/extra-install-cmd.py [new file with mode: 0755]
util/meson_aux/libstdcxx-tag.py [new file with mode: 0755]
util/meson_aux/skeletonmm-tarball.py [new file with mode: 0755]
util/mm-common-get.1.in [new file with mode: 0644]
util/mm-common-get.in [new file with mode: 0644]
util/mm-common-prepare.1.in
util/mm-common-prepare.in

index db9735e..c584e83 100644 (file)
@@ -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
index 3fe0f3d..cbb7451 100644 (file)
 # Pick up aclocal flags from the environment.
 ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
 
-bin_SCRIPTS = util/mm-common-prepare
-man1_MANS = util/mm-common-prepare.1
+bin_SCRIPTS = util/mm-common-prepare util/mm-common-get
+man1_MANS = util/mm-common-prepare.1 util/mm-common-get.1
 
-# These are installed so that mm-common-prepare can copy them
-# into projects at autogen.sh time:
+# These are installed so that mm-common-prepare can copy the .am files
+# into projects at autogen.sh time, and mm-common-get can copy the .py files
+# at Meson setup or configure time:
 build_supportdir = $(pkgdatadir)/build
 dist_build_support_DATA =              \
-       build/compile-binding.am        \
-       build/dist-changelog.am         \
-       build/doc-reference.am          \
-       build/generate-binding.am
+       am_include/compile-binding.am   \
+       am_include/dist-changelog.am            \
+       am_include/doc-reference.am             \
+       am_include/generate-binding.am \
+  util/build_scripts/dist-build-scripts.py \
+  util/build_scripts/dist-changelog.py \
+  util/build_scripts/doc-reference.py \
+  util/build_scripts/generate-binding.py
 
 # These are installed so that aclocal can copy them into aclocal.m4
 # at autogen.sh time:
@@ -45,8 +50,9 @@ dist_aclocal_macro_DATA =             \
 
 # These are installed so that mm-common-prepare can copy them into projects
 # at autogen.sh time if a directory path is given to MM_CONFIG_DOCTOOL_DIR(),
-# or they can be found via pkg-config --variable=doctooldir mm-common,
+# or they can be found via pkg-config --variable=doctooldir mm-common-util,
 # which is preferrable.
+# mm-common-get can copy them at Meson setup or configure time.
 doctooldir = $(pkgdatadir)/doctool
 dist_doctool_DATA =                    \
        util/doc-install.pl             \
@@ -76,54 +82,59 @@ 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)
 
-dist_noinst_DATA = util/mm-common-prepare.1.in $(skeletonmm_data_files)
+dist_noinst_DATA = util/mm-common-prepare.1.in util/mm-common-get.1.in $(skeletonmm_data_files)
 dist_noinst_SCRIPTS = autogen.sh $(skeletonmm_script_files)
 
 CLEANFILES = $(man1_MANS) $(doc_DATA)
 MAINTAINERCLEANFILES = $(dist_doctags_DATA)
 
+# Distribute files needed when building mm-common with meson.
+EXTRA_DIST = \
+  meson.build \
+  meson_options.txt \
+  util/meson_aux/extra-dist-cmd.py \
+  util/meson_aux/extra-install-cmd.py \
+  util/meson_aux/libstdcxx-tag.py \
+  util/meson_aux/skeletonmm-tarball.py
+
 # Remote location of the GNU libstdc++ Doxygen tag file.
 libstdcxx_tag_url = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag
 
@@ -161,11 +172,15 @@ doctags/libstdc++.tag:
 util/mm-common-prepare.1: $(srcdir)/util/mm-common-prepare.1.in Makefile
        $(AM_V_GEN)$(subst_manpage) $(srcdir)/util/mm-common-prepare.1.in >$@
 
+# Build the mm-common-get(1) manual page.
+util/mm-common-get.1: $(srcdir)/util/mm-common-get.1.in Makefile
+       $(AM_V_GEN)$(subst_manpage) $(srcdir)/util/mm-common-get.1.in >$@
+
 # Create tar archive of skeletonmm for installation.
 skeletonmm.tar.gz: $(skeletonmm_files)
        $(AM_V_GEN)($(srctar_stdout) $(skeletonmm_files)) | gzip -c -n >$@
 
-include $(top_srcdir)/build/dist-changelog.am
+include $(top_srcdir)/am_include/dist-changelog.am
 
 install-data-hook: $(if $(DESTDIR),,postinst-acdir-notice)
 
diff --git a/NEWS b/NEWS
index b569a0f..2605bcc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,19 @@
+mm-common 1.0.0 (2019-10-29)
+
+* Rename directory build/ to am_include/
+  (Kjell Ahlstedt)
+* Add support for building mm-common with Meson.
+  (Kjell Ahlstedt)
+* Support modules that are built with Meson.
+  Add the mm-common-get command.
+  (Kjell Ahlstedt) Merge request !2
+* skeletonmm: Use Meson instead of Autotools.
+  (Kjell Ahlstedt) Issue #1 (Tomasz KÅ‚oczko)
+* MM_AX_CXX_COMPILE_STDCXX():
+  Update based on the upstream AX_CXX_COMPILE_STDCXX() macro.
+  (Murray Cumming)
+
+
 mm-common 0.9.12 (2018-04-07)
 
 * MM_AX_CXX_COMPILE_STDCXX():
diff --git a/README b/README
index b942398..d4bea2a 100644 (file)
--- a/README
+++ b/README
@@ -11,13 +11,27 @@ GNU C++ Library reference documentation.  It is covered by the same
 licence as the source code it was extracted from.  More information
 is available at <http://gcc.gnu.org/onlinedocs/libstdc++/>.
 
+Autotools or Meson?
+===================
+
+mm-common can be built with Autotools or Meson. Building with Autotools
+may be phased out in the future.
+
+The files that mm-common installs and mm-common-prepare copies to other
+modules are useful in modules that are built with Autotools.
+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 Meson.
+
 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
-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
@@ -31,8 +45,8 @@ The following sections provide an overview of the various files shipped
 with mm-common, and briefly explain their purpose.  Detailed documentation
 and usage instructions can be found in the files themselves.
 
-mm-common-prepare
------------------
+mm-common-prepare and Autotools
+-------------------------------
 
 The mm-common-prepare shell script is installed in ${bindir} and must be
 invoked from the bootstrap script of a binding module in order to set up
@@ -59,18 +73,49 @@ Also note that mm-common-prepare inspects the project's configure.ac file
 for the AC_CONFIG_AUX_DIR([...]) argument.  This is explained in further
 detail below in the section on Automake include files.
 
-Autoconf M4 macros
-------------------
+mm-common-get and Meson
+-----------------------
+
+The mm-common-get shell script is installed in ${bindir} and must be
+invoked with run_command() early in a meson.build file. The meson.build file
+should contain code similar to
+
+  python = import('python').find_installation('python3')
+  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(python, '-c', cmd_py).returncode() == 0
+  maintainer_mode_opt = get_option('maintainer-mode')
+  maintainer_mode = maintainer_mode_opt == 'true' or \
+                   (maintainer_mode_opt == 'if-git-build' and is_git_build)
+  mm_common_get = find_program('mm-common-get', required: maintainer_mode)
+
+  if maintainer_mode and mm_common_get.found()
+    # Copy files to untracked/build_scripts and untracked/docs.
+    run_command(mm_common_get, '--force',
+      project_source_root / 'untracked' / 'build_scripts',
+      project_source_root / 'untracked' / 'docs')
+  endif
+
+In a Unix-like system the first few lines can be replaced with
+
+  is_git_build = run_command('test', '-d', project_source_root/'.git').returncode() == 0
+
+
+Autoconf M4 macros (Autotools)
+------------------------------
 
 The Autoconf M4 macros are installed into the system-wide macro repository
 in the ${datadir}/aclocal directory.  Since all used M4 macros are copied
 into aclocal.m4, these macro files are required only in maintainer-mode.
 For this reason, they are not copied into the source tree of a project by
 mm-common-prepare.  If mm-common is installed to a different prefix than
-Automake, it may be necessary to adjust ACLOCAL_FLAGS accordingly so that
+Automake, it may be necessary to adjust ACLOCAL_PATH accordingly so that
 aclocal can find the M4 files:
 
-  export ACLOCAL_FLAGS="-I ${mm_common_prefix}/share/aclocal"
+  export ACLOCAL_PATH="${mm_common_prefix}/share/aclocal"
 
 This step is not necessary when using jhbuild, as it takes care of setting
 up the environment for using the locally built modules.
@@ -120,47 +165,76 @@ macros/mm-ax_cxx_compile_stdcxx.m4:
   http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html,
   except for the MM_ prefix.
 
-Automake include files
-----------------------
+Automake include files (Autotools)
+----------------------------------
 
-The Automake include files are located in the build/ directory.  The
-installed mm-common-prepare program copies all of the .am files into
+The Automake include files are located in the am_include/ directory.
+The installed mm-common-prepare program copies all of the .am files into
 a project's source tree.  If AC_CONFIG_AUX_DIR([...]) is specified in
 the configure.ac file, the .am files will be placed in the indicated
 subdirectory.
 
-build/generate-binding.am:
-  Variables and rules for running the gmmproc code generate to produce
+am_include/generate-binding.am:
+  Variables and rules for running the gmmproc code generator to produce
   the source code files for a C++ binding module.
 
-build/compile-binding.am:
+am_include/compile-binding.am:
   Variables and rules for compiling and linking the shared library which
   implements a C++ binding module.
 
-build/doc-reference.am:
+am_include/doc-reference.am:
   Variables and rules for building the API reference documentation using
   Doxygen, and to create a Devhelp book for the library.  The installation
   rules also take care of translating references to external documentation
   in the generated hypertext documents.
 
-build/dist-changelog.am:
+am_include/dist-changelog.am:
   A dist-hook rule to automatically generate a ChangeLog file when making
   a release, intended to be used by modules which use the version control
   log exclusively to document changes.
 
-Documentation utilities
------------------------
+Python build scripts (Meson)
+----------------------------
+
+These scripts can be called from meson.build files with run_command(),
+custom_target(), meson.add_postconf_script(), meson.add_install_script()
+and meson.add_dist_script().
+
+util/build_scripts/generate-binding.py:
+  Commands for running the gmmproc code generator to produce
+  the source code files for a C++ binding module.
+
+util/build_scripts/doc-reference.py:
+  Commands for building the API reference documentation using
+  Doxygen, and to create a Devhelp book for the library. The installation
+  rules also take care of translating references to external documentation
+  in the generated hypertext documents.
+
+util/build_scripts/dist-changelog.py:
+  A git command to generate a ChangeLog file when making a release,
+  intended to be used by modules which use the version control
+  log exclusively to document changes.
+
+util/build_scripts/dist-build-scripts.py:
+  Commands that trim the distribution directory before a tarball is made.
+  The scripts copied by mm-common-get are distributed, although they are
+  not checked into the git repository. All .gitignore files and an empty build/
+  directory are removed
+
+Documentation utilities (Meson and Autotools)
+---------------------------------------------
 
 These are two Perl scripts, a style sheet, and one XSL transformation
 which assist with the task of generating and installing the Doxygen
 reference documentation.  At least doc-install.pl is also required for
 tarball builds.
-To avoid copying these files into all binding modules, they are also
-distributed and installed with the glibmm module.  Those binding modules
-which cannot depend on glibmm must call MM_CONFIG_DOCTOOL_DIR([...]) in
-configure.ac to indicate to mm-common-prepare that it should copy the
-documentation utilities into the project's source tree.  Otherwise the
-files installed with glibmm will be used automatically.
+
+Autotools: To avoid copying these files into all binding modules, they are
+distributed and installed with the mm-common module.  Those binding modules
+which shall depend on mm-common only in maintainer-mode must call
+MM_CONFIG_DOCTOOL_DIR([...]) in configure.ac to indicate to mm-common-prepare
+that it should copy the documentation utilities into the project's source tree.
+Otherwise the files installed with mm-common will be used automatically.
 
 util/doc-postprocess.pl:
   A simple script to post-process the HTML files generated by Doxygen.
@@ -208,9 +282,9 @@ doctags/libstdc++.tag:
   The Doxygen tag file for the GNU libstdc++ reference documentation
   hosted at <http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/>.
   This file is distributed with release archives of mm-common, but not
-  checked into version control on gnome.org.  If mm-common is built in
-  maintainer-mode, the file will be downloaded automatically from the
-  gcc.gnu.org web server.
+  checked into version control on gnome.org.  If mm-common is built with
+  Autotools in maintainer-mode or with Meson and use-network=true,
+  the file will be downloaded automatically from the gcc.gnu.org web server.
   The file libstdc++.tag is installed into the package data directory
   of mm-common.  The mm-common-libstdc++ pkg-config module defines the
   variables ${doxytagfile} and ${htmlrefpub}, which can be queried for
index e898946..f933e4b 100644 (file)
@@ -15,7 +15,7 @@
 ## You should have received a copy of the GNU General Public License
 ## along with mm-common.  If not, see <http://www.gnu.org/licenses/>.
 
-AC_INIT([mm-common], [0.9.12], [https://bugzilla.gnome.org/enter_bug.cgi?product=mm-common],
+AC_INIT([mm-common], [1.0.0], [https://gitlab.gnome.org/GNOME/mm-common/issues/],
         [mm-common], [http://www.gtkmm.org/])
 AC_PREREQ([2.59])
 AC_CONFIG_SRCDIR([util/mm-common-prepare.in])
@@ -56,6 +56,7 @@ AC_CONFIG_FILES([
   doctags/mm-common-libstdc++-uninstalled.pc
   macros/mm-common.m4
   util/mm-common-prepare
+  util/mm-common-get
   util/mm-common-util.pc
   util/mm-common-util-uninstalled.pc
 ])
index 35cadea..ebd372f 100644 (file)
@@ -1,5 +1,5 @@
 # ===========================================================================
-#  https://www.gnu.org/software/autoconf-archive/MM_AX_CXX_COMPILE_STDCXX.html
+#  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
 # ===========================================================================
 #
 # SYNOPSIS
 #   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
 #   Copyright (c) 2015 Paul Norman <penorman@mac.com>
 #   Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
-#   Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
+#   Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
+#   Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved.  This file is offered as-is, without any
 #   warranty.
 
-#serial 8
-
 # Copied from ax_cxx_compile_stdcxx.m4 and added MM_ prefix to avoid
 # possible conflict with AX_CXX_COMPILE_STDCXX in other modules.
 
-dnl  This macro is based on the code from the MM_AX_CXX_COMPILE_STDCXX_11 macro
+#serial 11
+
+dnl  This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
 dnl  (serial version number 13).
 
 AC_DEFUN([MM_AX_CXX_COMPILE_STDCXX], [dnl
@@ -63,14 +64,6 @@ AC_DEFUN([MM_AX_CXX_COMPILE_STDCXX], [dnl
         [m4_fatal([invalid third argument `$3' to MM_AX_CXX_COMPILE_STDCXX])])
   AC_LANG_PUSH([C++])dnl
   ac_success=no
-  AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
-  ax_cv_cxx_compile_cxx$1,
-  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_MM_AX_CXX_COMPILE_STDCXX_testbody_$1])],
-    [ax_cv_cxx_compile_cxx$1=yes],
-    [ax_cv_cxx_compile_cxx$1=no])])
-  if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
-    ac_success=yes
-  fi
 
   m4_if([$2], [noext], [], [dnl
   if test x$ac_success = xno; then
@@ -200,11 +193,13 @@ namespace cxx11
 
     struct Base
     {
+      virtual ~Base() {}
       virtual void f() {}
     };
 
     struct Derived : public Base
     {
+      virtual ~Derived() override {}
       virtual void f() override {}
     };
 
@@ -588,20 +583,12 @@ m4_define([_MM_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus <= 201402L
+#elif __cplusplus < 201703L
 
 #error "This is not a C++17 compiler"
 
 #else
 
-#if defined(__clang__)
-  #define REALLY_CLANG
-#else
-  #if defined(__GNUC__)
-    #define REALLY_GCC
-  #endif
-#endif
-
 #include <initializer_list>
 #include <utility>
 #include <type_traits>
@@ -609,16 +596,12 @@ m4_define([_MM_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
 namespace cxx17
 {
 
-#if !defined(REALLY_CLANG)
   namespace test_constexpr_lambdas
   {
 
-    // TODO: test it with clang++ from git
-
     constexpr int foo = [](){return 42;}();
 
   }
-#endif // !defined(REALLY_CLANG)
 
   namespace test::nested_namespace::definitions
   {
@@ -853,12 +836,9 @@ namespace cxx17
 
   }
 
-#if !defined(REALLY_CLANG)
   namespace test_template_argument_deduction_for_class_templates
   {
 
-    // TODO: test it with clang++ from git
-
     template <typename T1, typename T2>
     struct pair
     {
@@ -877,7 +857,6 @@ namespace cxx17
     }
 
   }
-#endif // !defined(REALLY_CLANG)
 
   namespace test_non_type_auto_template_parameters
   {
@@ -891,12 +870,9 @@ namespace cxx17
 
   }
 
-#if !defined(REALLY_CLANG)
   namespace test_structured_bindings
   {
 
-    // TODO: test it with clang++ from git
-
     int arr[2] = { 1, 2 };
     std::pair<int, int> pr = { 1, 2 };
 
@@ -928,14 +904,10 @@ namespace cxx17
     const auto [ x3, y3 ] = f3();
 
   }
-#endif // !defined(REALLY_CLANG)
 
-#if !defined(REALLY_CLANG)
   namespace test_exception_spec_type_system
   {
 
-    // TODO: test it with clang++ from git
-
     struct Good {};
     struct Bad {};
 
@@ -953,7 +925,6 @@ namespace cxx17
     static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
 
   }
-#endif // !defined(REALLY_CLANG)
 
   namespace test_inline_variables
   {
@@ -978,6 +949,6 @@ namespace cxx17
 
 }  // namespace cxx17
 
-#endif  // __cplusplus <= 201402L
+#endif  // __cplusplus < 201703L
 
 ]])
diff --git a/meson.build b/meson.build
new file mode 100644 (file)
index 0000000..3255328
--- /dev/null
@@ -0,0 +1,332 @@
+# This file is part of mm-common.
+
+project('mm-common',
+  version: '1.0.0',
+  meson_version: '>= 0.50.0', # required for python3.path()
+  license: 'GPLv2+'
+)
+
+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
+
+# Use these instead of meson.source_root() and meson.build_root().
+# 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()
+
+script_dir = project_source_root / 'util' / 'meson_aux'
+
+# Install directories are relative to {prefix}.
+install_prefix = get_option('prefix')
+install_bindir = get_option('bindir')
+
+install_datadir = get_option('datadir')
+install_aclocal_macrodir = install_datadir / 'aclocal'
+install_pkgconfigdir = install_datadir / 'pkgconfig'
+install_docdir = install_datadir / 'doc' / meson.project_name()
+
+install_pkgdatadir = install_datadir / meson.project_name()
+install_build_supportdir = install_pkgdatadir / 'build'
+install_doctooldir = install_pkgdatadir / 'doctool'
+install_doctagsdir = install_pkgdatadir / 'doctags'
+
+install_mandir = get_option('mandir')
+install_man1dir = install_mandir / 'man1'
+
+# Configuration data for built files:
+#   doctags/mm-common-libstdc++.pc.in -> mm-common-libstdc++.pc
+#   doctags/mm-common-libstdc++-uninstalled.pc.in -> mm-common-libstdc++-uninstalled.pc
+#   macros/mm-common.m4.in -> mm-common.m4
+#   util/mm-common-get.1.in -> mm-common-get.1
+#   util/mm-common-get.in -> mm-common-get
+#   util/mm-common-prepare.1.in -> mm-common-prepare.1
+#   util/mm-common-prepare.in -> mm-common-prepare
+#   util/mm-common-util.pc.in -> mm-common-util.pc
+#   util/mm-common-util-uninstalled.pc.in -> mm-common-util-uninstalled.pc
+conf_data = configuration_data()
+conf_data.set('prefix', install_prefix)
+conf_data.set('datarootdir', '${prefix}' / install_datadir)
+conf_data.set('datadir', '${datarootdir}')
+conf_data.set('docdir', install_prefix / install_docdir)
+conf_data.set('PACKAGE_NAME', meson.project_name())
+conf_data.set('PACKAGE_TARNAME', meson.project_name())
+conf_data.set('PACKAGE_VERSION', meson.project_version())
+conf_data.set('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
+
+# These are installed so that mm-common-prepare can copy them
+# into projects at autogen.sh time.
+autotools_build_support_basefiles = [
+  'compile-binding.am',
+  'dist-changelog.am',
+  'doc-reference.am',
+  'generate-binding.am',
+]
+build_support_files = []
+foreach file : autotools_build_support_basefiles
+  build_support_files += 'am_include' / file
+endforeach
+
+# These are installed so that mm-common-get can copy them
+# into projects at Meson setup or configure time.
+meson_build_support_basefiles = [
+  'dist-build-scripts.py',
+  'dist-changelog.py',
+  'doc-reference.py',
+  'generate-binding.py',
+]
+foreach file : meson_build_support_basefiles
+  build_support_files += 'util' / 'build_scripts' / file
+endforeach
+install_data(build_support_files, install_dir: install_build_supportdir)
+
+# These are installed so that aclocal can copy them into aclocal.m4
+# at autogen.sh time.
+aclocal_macro_basefiles = [
+  'mm-ax_cxx_compile_stdcxx.m4',
+  'mm-ax_cxx_compile_stdcxx_11.m4',
+  'mm-dietlib.m4',
+  'mm-doc.m4',
+  'mm-module.m4',
+  'mm-pkg.m4',
+  'mm-warnings.m4',
+]
+aclocal_macro_files = []
+foreach file : aclocal_macro_basefiles
+  aclocal_macro_files += 'macros' / file
+endforeach
+install_data(aclocal_macro_files, install_dir: install_aclocal_macrodir)
+
+conf_data2 = configuration_data()
+conf_data2.merge_from(conf_data)
+conf_data2.set('configure_input', 'mm-common.m4.  Generated from macros/mm-common.m4.in')
+configure_file(
+  input: 'macros' / 'mm-common.m4.in',
+  output: '@BASENAME@',
+  configuration: conf_data2,
+  install_dir: install_aclocal_macrodir
+)
+
+if find_program('aclocal', required: false).found()
+  meson.add_install_script(
+    python3.path(),
+    script_dir / 'extra-install-cmd.py',
+    install_prefix / install_aclocal_macrodir
+  )
+endif
+
+# These are installed so that mm-common-prepare can copy them into projects
+# at autogen.sh time, if a directory path is given to MM_CONFIG_DOCTOOL_DIR(),
+# or they can be found via pkg-config --variable=doctooldir mm-common-util.
+# They are also installed so that mm-common-get can copy them
+# into projects at Meson setup or configure time.
+doctool_basefiles = [
+  'doc-install.pl',
+  'doc-postprocess.pl',
+  'doxygen.css',
+  'doxygen-extra.css',
+  'tagfile-to-devhelp2.xsl',
+]
+doctool_files = []
+foreach file : doctool_basefiles
+  doctool_files += 'util' / file
+endforeach
+install_data(doctool_files, install_dir: install_doctooldir)
+
+# Let other modules find the utils with pkg-config.
+configure_file(
+  input: 'doctags' / 'mm-common-libstdc++.pc.in',
+  output: '@BASENAME@',
+  configuration: conf_data,
+  install_dir: install_pkgconfigdir
+)
+
+configure_file(
+  input: 'util' / 'mm-common-util.pc.in',
+  output: '@BASENAME@',
+  configuration: conf_data,
+  install_dir: install_pkgconfigdir
+)
+
+configure_file(
+  input: 'doctags' / 'mm-common-libstdc++-uninstalled.pc.in',
+  output: '@BASENAME@',
+  configuration: conf_data,
+)
+
+configure_file(
+  input: 'util' / 'mm-common-util-uninstalled.pc.in',
+  output: '@BASENAME@',
+  configuration: conf_data,
+)
+
+# mm-common-get command.
+conf_data3 = configuration_data()
+conf_data3.merge_from(conf_data)
+conf_data3.set('configure_input', 'mm-common-get.  Generated from util/mm-common-get.in')
+conf_data3.set('datadir_py', install_prefix / install_datadir)
+configure_file(
+  input: 'util' / 'mm-common-get.in',
+  output: '@BASENAME@',
+  configuration: conf_data3,
+  install_dir: install_bindir,
+  install_mode: 'rwxr-xr-x'
+)
+
+# mm-common-get.1 manual page.
+configure_file(
+  input: 'util' / 'mm-common-get.1.in',
+  output: '@BASENAME@',
+  configuration: conf_data,
+  install_dir: install_man1dir
+)
+
+# mm-common-prepare command.
+conf_data4 = configuration_data()
+conf_data4.merge_from(conf_data)
+conf_data4.set('configure_input', 'mm-common-prepare.  Generated from util/mm-common-prepare.in')
+configure_file(
+  input: 'util' / 'mm-common-prepare.in',
+  output: '@BASENAME@',
+  configuration: conf_data4,
+  install_dir: install_bindir,
+  install_mode: 'rwxr-xr-x'
+)
+
+# mm-common-prepare.1 manual page.
+configure_file(
+  input: 'util' / 'mm-common-prepare.1.in',
+  output: '@BASENAME@',
+  configuration: conf_data,
+  install_dir: install_man1dir
+)
+
+# Skeleton project.
+skeletonmm_basefiles = [
+  '.gitignore',
+  'AUTHORS',
+  'COPYING',
+  'ChangeLog',
+  'meson.build',
+  'meson_options.txt',
+  'README',
+  'skeletonmm.doap',
+  'doc/reference/Doxyfile.in',
+  '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/meson.build',
+  'skeleton/skeletonmm/wrap_init.h',
+  'skeleton/src/skeleton.ccg',
+  'skeleton/src/skeleton.defs',
+  'skeleton/src/skeleton.hg',
+  'skeleton/src/skeleton_docs.xml',
+  '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
+  skeletonmm_files += 'skeletonmm' / file
+endforeach
+
+# Create tar archive of skeletonmm for installation.
+skeletonmm_tarball_script = script_dir / 'skeletonmm-tarball.py'
+tarball_filetype = run_command(python3, skeletonmm_tarball_script, 'check')
+tarball_filename = 'skeletonmm' + tarball_filetype.stdout()
+custom_target(tarball_filename,
+  input: skeletonmm_files,
+  output: tarball_filename,
+  command: [
+    python3,
+    skeletonmm_tarball_script,
+    '@OUTPUT@',
+    project_source_root,
+    skeletonmm_files,
+  ],
+  build_by_default: true,
+  install_dir: install_docdir,
+  install: true
+)
+install_data('README', install_dir: install_docdir)
+
+# Either curl or wget is required for downloading libstdc++.tag,
+# used by Doxygen.
+download_cmd = 'none'
+if get_option('use-network')
+  curl = find_program('curl', required: false)
+  download_cmd = 'curl'
+  if not curl.found()
+    wget = find_program('wget', required: true)
+    download_cmd = 'wget'
+  endif
+endif
+
+# Download libstdc++.tag if it does not exist or if it's out of date.
+custom_target('libstdc++.tag',
+  output: 'libstdc++.tag',
+  command: [
+    python3,
+    script_dir / 'libstdcxx-tag.py',
+    download_cmd,
+    project_source_root / 'doctags',
+    '@OUTPUT@',
+  ],
+  build_by_default: true,
+  build_always_stale: true,
+  install_dir: install_doctagsdir,
+  install: true
+)
+
+if not meson.is_subproject()
+  # Modify the contents of the distribution directory. (not allowed in a subproject)
+  meson.add_dist_script(
+    python3.path(),
+    script_dir / 'extra-dist-cmd.py',
+    project_source_root,
+    project_build_root,
+  )
+endif
+
+# Print a summary.
+summary = [
+  '',
+  '------',
+  meson.project_name() + ' ' + meson.project_version(),
+  '',
+  '       Use network: @0@'.format(get_option('use-network')),
+  'Directories:',
+  '            prefix: @0@'.format(install_prefix),
+  '            bindir: @0@'.format(install_prefix / install_bindir),
+  '           datadir: @0@'.format(install_prefix / install_datadir),
+  '            docdir: @0@'.format(install_prefix / install_docdir),
+  '  aclocal_macrodir: @0@'.format(install_prefix / install_aclocal_macrodir),
+  '      pkgconfigdir: @0@'.format(install_prefix / install_pkgconfigdir),
+  '        pkgdatadir: @0@'.format(install_prefix / install_pkgdatadir),
+  '  build_supportdir: @0@'.format(install_prefix / install_build_supportdir),
+  '        doctooldir: @0@'.format(install_prefix / install_doctooldir),
+  '        doctagsdir: @0@'.format(install_prefix / install_doctagsdir),
+  '           man1dir: @0@'.format(install_prefix / install_man1dir),
+  '------'
+]
+
+message('\n'.join(summary))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644 (file)
index 0000000..36e68be
--- /dev/null
@@ -0,0 +1,2 @@
+option('use-network', type: 'boolean', value: false,
+  description : 'Download Doxygen tag file from the network')
index 50ef223..371058d 100644 (file)
@@ -14,7 +14,7 @@ building tarball releases, unless configured to use maintainer-mode.</descriptio
   <homepage rdf:resource="http://www.gtkmm.org/" />
   <mailing-list rdf:resource="mailto:gtkmm-list@gnome.org" />
   <download-page rdf:resource="http://download.gnome.org/sources/mm-common/" />
-  <bug-database rdf:resource="http://bugzilla.gnome.org/browse.cgi?product=mm-common" />
+  <bug-database rdf:resource="https://gitlab.gnome.org/GNOME/mm-common/issues/" />
   <category rdf:resource="http://api.gnome.org/doap-extensions#core" />
   <programming-language>C++</programming-language>
 
index 22d053d..564fbd3 100644 (file)
@@ -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/Makefile.am b/skeletonmm/Makefile.am
deleted file mode 100644 (file)
index 3da9e94..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-## Copyright (c) 2010  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/>.
-
-ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}
-DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal
-
-if MAINTAINER_MODE
-src_subdirs = codegen skeleton/src
-else
-src_subdirs =
-endif
-if ENABLE_DOCUMENTATION
-doc_subdirs = doc
-else
-doc_subdirs =
-endif
-SUBDIRS = $(src_subdirs) skeleton/skeletonmm examples $(doc_subdirs)
-
-skeletonmm_includedir = $(includedir)/$(SKELETONMM_MODULE_NAME)
-skeletonmm_include_HEADERS = skeleton/skeletonmm.h
-
-skeletonmm_libincludedir = $(libdir)/$(SKELETONMM_MODULE_NAME)/include
-nodist_skeletonmm_libinclude_HEADERS = skeleton/skeletonmmconfig.h
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = skeleton/$(SKELETONMM_MODULE_NAME).pc
-
-dist_noinst_SCRIPTS = autogen.sh
-
-# Optional: auto-generate the ChangeLog file from the git log on make dist
-#include $(top_srcdir)/build/dist-changelog.am
diff --git a/skeletonmm/autogen.sh b/skeletonmm/autogen.sh
deleted file mode 100755 (executable)
index 6686611..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/sh -e
-test -n "$srcdir" || srcdir=`dirname "$0"`
-test -n "$srcdir" || srcdir=.
-
-mm-common-prepare --copy --force "$srcdir"
-autoreconf --force --install --verbose "$srcdir"
-test -n "$NOCONFIGURE" || "$srcdir/configure" --enable-maintainer-mode "$@"
diff --git a/skeletonmm/build/.gitignore b/skeletonmm/build/.gitignore
deleted file mode 100644 (file)
index 0590391..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/compile
-/compile-binding.am
-/config.*
-/depcomp
-/dist-changelog.am
-/doc-reference.am
-/generate-binding.am
-/install-sh
-/libtool.m4
-/lt*.m4
-/ltmain.sh
-/missing
-/stamp-h?
diff --git a/skeletonmm/codegen/Makefile.am b/skeletonmm/codegen/Makefile.am
deleted file mode 100644 (file)
index c846d71..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-## Copyright (c) 2010  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/>.
-
-AUTOMAKE_OPTIONS = subdir-objects
-
-include $(srcdir)/m4/filelist.am
-
-dist_noinst_DATA    = $(addprefix m4/,$(files_codegen_m4))
-dist_noinst_SCRIPTS = generate_defs_and_docs.sh
-noinst_PROGRAMS     = extradefs/generate_extra_defs
-
-extradefs_generate_extra_defs_SOURCES = extradefs/generate_extra_defs_skeleton.cc
-extradefs_generate_extra_defs_LDADD   = $(SKELETONMM_LIBS) -lglibmm_generate_extra_defs-2.4
-
-AM_CPPFLAGS = -I$(top_builddir) $(GTHREAD_CFLAGS) $(SKELETONMM_CFLAGS)
-AM_CXXFLAGS = $(SKELETONMM_WXXFLAGS)
-
-# Instruct GNU make to delete the targets of a rule after it failed, in
-# order to avoid the complication of handling that situation manually.
-.DELETE_ON_ERROR:
diff --git a/skeletonmm/codegen/generate_defs_and_docs.sh b/skeletonmm/codegen/generate_defs_and_docs.sh
deleted file mode 100755 (executable)
index 724b356..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-# skeletonmm/codegen/generate_defs_and_docs.sh
-
-# This script must be executed from directory skeletonmm/codegen.
-
-# Assumed directory structure:
-#   glibmm/tools/defs_gen/docextract_to_xml.py
-#   glibmm/tools/defs_gen/h2def.py
-#   glibmm/tools/enum.pl
-#   skeleton/src/*.h
-#   skeleton/src/*.c
-#   skeletonmm/codegen/extradefs/generate_extra_defs
-
-# 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
-
-GLIBMM_TOOLS_DIR=../../glibmm/tools
-SKELETON_DIR=../../skeleton
-SKELETONMM_SKELETON_SRC_DIR=../skeleton/src
-
-$GLIBMM_TOOLS_DIR/defs_gen/docextract_to_xml.py \
-  -s $SKELETON_DIR/src \
-  >$SKELETONMM_SKELETON_SRC_DIR/skeleton_docs.xml
-
-$GLIBMM_TOOLS_DIR/enum.pl \
-  $SKELETON_DIR/src/*.h \
-  >$SKELETONMM_SKELETON_SRC_DIR/skeleton_enum.defs
-
-$GLIBMM_TOOLS_DIR/defs_gen/h2def.py \
-  $SKELETON_DIR/src/*.h \
-  >$SKELETONMM_SKELETON_SRC_DIR/skeleton_method.defs
-
-extradefs/generate_extra_defs \
-  >$SKELETONMM_SKELETON_SRC_DIR/skeleton_signal.defs
-
diff --git a/skeletonmm/codegen/m4/filelist.am b/skeletonmm/codegen/m4/filelist.am
deleted file mode 100644 (file)
index 192f19f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-## This file is part of skeletonmm.
-
-files_codegen_m4 = convert.m4 convert_skeleton.m4
diff --git a/skeletonmm/configure.ac b/skeletonmm/configure.ac
deleted file mode 100644 (file)
index 10a6aaa..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-## Copyright (c) 2010  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/>.
-
-AC_INIT([skeletonmm], [1.2.3], [https://bugzilla.gnome.org/enter_bug.cgi?product=skeletonmm],
-        [skeletonmm], [http://www.gtkmm.org/])
-AC_PREREQ([2.59])
-
-AC_CONFIG_SRCDIR([skeleton/skeletonmm.h])
-AC_CONFIG_AUX_DIR([build])
-AC_CONFIG_MACRO_DIR([build])
-AC_CONFIG_HEADERS([build/config.h skeleton/skeletonmmconfig.h])
-
-AM_INIT_AUTOMAKE([1.9 -Wno-portability check-news dist-bzip2 no-define nostdinc tar-pax])
-# Support silent build rules.
-# Disable by either passing --disable-silent-rules to configure or passing V=1 to make.
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-AM_MAINTAINER_MODE
-AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
-
-MM_PREREQ([0.9.10])
-MM_INIT_MODULE([skeletonmm-1.0])
-
-# Copy the mm-common .pl scripts into doc/, and use them from there,
-# so we can dist them to avoid a tarball-build dependency.
-MM_CONFIG_DOCTOOL_DIR([doc])
-
-# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
-AC_SUBST([SKELETONMM_SO_VERSION], [0:0:0])
-
-AC_PROG_CXX
-MM_AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
-
-AC_DISABLE_STATIC
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
-
-AC_SUBST([SKELETONMM_MODULES], ['skeleton-1.0 >= 1.2 glibmm-2.4 >= 2.16'])
-PKG_CHECK_MODULES([SKELETONMM], [$SKELETONMM_MODULES])
-
-MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
-MM_PKG_CONFIG_SUBST([GMMPROC_DIR], [--variable=gmmprocdir glibmm-2.4])
-
-MM_ARG_ENABLE_DOCUMENTATION
-MM_ARG_WITH_TAGFILE_DOC([libstdc++.tag], [mm-common-libstdc++])
-MM_ARG_WITH_TAGFILE_DOC([libsigc++-2.0.tag], [sigc++-2.0])
-MM_ARG_WITH_TAGFILE_DOC([glibmm-2.4.tag], [glibmm-2.4])
-
-AC_LANG([C++])
-MM_ARG_ENABLE_WARNINGS([SKELETONMM_WXXFLAGS],
-                       [-Wall],
-                       [-pedantic -Wall -Wextra],
-                       [G SKELETON])
-
-AC_CONFIG_FILES([Makefile
-                 codegen/Makefile
-                 skeleton/${SKELETONMM_MODULE_NAME}.pc:skeleton/skeletonmm.pc.in
-                 skeleton/${SKELETONMM_MODULE_NAME}-uninstalled.pc:skeleton/skeletonmm-uninstalled.pc.in
-                 skeleton/src/Makefile
-                 skeleton/skeletonmm/Makefile
-                 examples/Makefile
-                 doc/Makefile
-                 doc/reference/Doxyfile])
-AC_OUTPUT
diff --git a/skeletonmm/doc/Makefile.am b/skeletonmm/doc/Makefile.am
deleted file mode 100644 (file)
index f271e13..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-## Copyright (c) 2010  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 $(top_srcdir)/skeleton/src/filelist.am
-include $(top_srcdir)/skeleton/skeletonmm/filelist.am
-
-skeletonmm_files_h = $(files_built_h) $(filter-out wrap_init.h,$(files_extra_h))
-
-book_name = $(SKELETONMM_MODULE_NAME)
-doc_input = $(top_srcdir)/skeleton/skeletonmm.h        $(addprefix\
-            $(top_srcdir)/skeleton/skeletonmm/,$(skeletonmm_files_h))
-
-include $(top_srcdir)/build/doc-reference.am
diff --git a/skeletonmm/doc/reference/.gitignore b/skeletonmm/doc/reference/.gitignore
deleted file mode 100644 (file)
index 7387cef..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Doxyfile
-/doxygen.log
-/skeletonmm-*.devhelp2
-/skeletonmm-*.tag
-/html/
index 82dd703..8f0147f 100644 (file)
@@ -298,10 +298,6 @@ PREDEFINED             = __cplusplus \
                          "G_GNUC_PURE=" \
                          "G_GNUC_WARN_UNUSED_RESULT=" \
                          "G_MODULE_EXPORT=" \
-                         GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED \
-                         GLIBMM_EXCEPTIONS_ENABLED \
-                         GLIBMM_PROPERTIES_ENABLED \
-                         GLIBMM_VFUNCS_ENABLED \
                          "SKELETONMM_API="
 EXPAND_AS_DEFINED      = SKELETONMM_MAJOR_VERSION \
                          SKELETONMM_MINOR_VERSION \
diff --git a/skeletonmm/doc/reference/meson.build b/skeletonmm/doc/reference/meson.build
new file mode 100644 (file)
index 0000000..9611195
--- /dev/null
@@ -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/.gitignore b/skeletonmm/examples/.gitignore
deleted file mode 100644 (file)
index d4109ac..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/example/example
diff --git a/skeletonmm/examples/Makefile.am b/skeletonmm/examples/Makefile.am
deleted file mode 100644 (file)
index 43341d0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-## Copyright (c) 2010  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/>.
-
-AUTOMAKE_OPTIONS = subdir-objects
-
-check_PROGRAMS = example/example
-
-local_includes = -I$(top_builddir)/skeleton $(if $(srcdir:.=),-I$(top_srcdir)/skeleton)
-local_libs = $(top_builddir)/skeleton/skeletonmm/libskeletonmm-$(SKELETONMM_API_VERSION).la
-
-AM_CPPFLAGS = -I$(top_builddir) $(local_includes) $(GTHREAD_CFLAGS) $(SKELETONMM_CFLAGS)
-AM_CXXFLAGS = $(SKELETONMM_WXXFLAGS)
-LDADD = $(SKELETONMM_LIBS) $(local_libs)
-
-example_example_SOURCES = example/example.cc
similarity index 93%
rename from skeletonmm/examples/example/example.cc
rename to skeletonmm/examples/example1/main.cc
index 4e8dbb0..3507caf 100644 (file)
@@ -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 (file)
index 0000000..69e2f0a
--- /dev/null
@@ -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 (file)
index 0000000..558b8b4
--- /dev/null
@@ -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 (file)
index 0000000..6611d15
--- /dev/null
@@ -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/.gitignore b/skeletonmm/skeleton/.gitignore
deleted file mode 100644 (file)
index 908d79b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/skeletonmmconfig.h
-/skeletonmm-*.pc
-/skeletonmm/skeleton.cc
-/skeletonmm/skeleton.h
-/skeletonmm/wrap_init.cc
-/src/.stamps/
diff --git a/skeletonmm/skeleton/meson.build b/skeletonmm/skeleton/meson.build
new file mode 100644 (file)
index 0000000..85fa533
--- /dev/null
@@ -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')
index 7125be1..e355e18 100644 (file)
@@ -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
index 30dfddd..7078e16 100644 (file)
@@ -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.
  *
index d74f343..b92cf53 100644 (file)
@@ -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/Makefile.am b/skeletonmm/skeleton/skeletonmm/Makefile.am
deleted file mode 100644 (file)
index 52dbdd6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-## Copyright (c) 2010  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/>.
-
-lib_LTLIBRARIES = libskeletonmm-@SKELETONMM_API_VERSION@.la
-
-include $(srcdir)/../src/filelist.am
-include $(srcdir)/filelist.am
-include $(top_srcdir)/build/compile-binding.am
-
-local_cppflags = $(binding_includes) $(binding_cppflags) -DSKELETONMM_BUILD=1
-
-AM_CPPFLAGS = $(local_cppflags) $(GTHREAD_CFLAGS) $(SKELETONMM_CFLAGS)
-AM_CXXFLAGS = $(SKELETONMM_WXXFLAGS)
-
-libskeletonmm_@SKELETONMM_API_VERSION@_la_SOURCES = $(binding_sources)
-libskeletonmm_@SKELETONMM_API_VERSION@_la_LDFLAGS = -no-undefined -version-info $(SKELETONMM_SO_VERSION)
-libskeletonmm_@SKELETONMM_API_VERSION@_la_LIBADD  = $(SKELETONMM_LIBS)
diff --git a/skeletonmm/skeleton/skeletonmm/filelist.am b/skeletonmm/skeleton/skeletonmm/filelist.am
deleted file mode 100644 (file)
index ac757b5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-## This file is part of skeletonmm.
-
-files_built_cc = $(files_hg:.hg=.cc) wrap_init.cc
-files_built_h  = $(files_hg:.hg=.h)
-files_built_ph = $(patsubst %.hg,private/%_p.h,$(files_hg))
-files_extra_cc =
-files_extra_h  = wrap_init.h
-files_extra_ph =
diff --git a/skeletonmm/skeleton/skeletonmm/meson.build b/skeletonmm/skeleton/skeletonmm/meson.build
new file mode 100644 (file)
index 0000000..ae36c58
--- /dev/null
@@ -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/private/.gitignore b/skeletonmm/skeleton/skeletonmm/private/.gitignore
deleted file mode 100644 (file)
index 0cb5a60..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/*_p.h
index 45a47f6..c0c7d6c 100644 (file)
@@ -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 */
index f6eccc4..8417fac 100644 (file)
@@ -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/Makefile.am b/skeletonmm/skeleton/src/Makefile.am
deleted file mode 100644 (file)
index 08d935f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-## Copyright (c) 2010  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/>.
-
-binding_name    = skeletonmm
-wrap_init_flags = --namespace=Skeleton --parent_dir=skeletonmm
-
-include $(srcdir)/filelist.am
-include $(top_srcdir)/codegen/m4/filelist.am
-include $(top_srcdir)/build/generate-binding.am
diff --git a/skeletonmm/skeleton/src/filelist.am b/skeletonmm/skeleton/src/filelist.am
deleted file mode 100644 (file)
index 4dcceb2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-## This file is part of skeletonmm.
-
-files_defs = \
-  skeleton.defs        \
-  skeleton_enum.defs   \
-  skeleton_method.defs \
-  skeleton_signal.defs \
-  skeleton_vfunc.defs  \
-  skeleton_docs.xml
-
-files_hg  = skeleton.hg
-files_ccg = $(files_hg:.hg=.ccg)
index be287f7..f7335ae 100644 (file)
@@ -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.
  *
index a2ffe9e..7abb537 100644 (file)
@@ -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)
index a9ae68b..0f74f34 100644 (file)
@@ -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
index 313314f..23d47db 100644 (file)
@@ -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 (file)
index 0000000..68dcdd1
--- /dev/null
@@ -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 (file)
index 0000000..4489920
--- /dev/null
@@ -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 (file)
index 0000000..56c1136
--- /dev/null
@@ -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 (executable)
index 0000000..30da5da
--- /dev/null
@@ -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)
@@ -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.
  *
  * 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 (file)
index 0000000..69f3b16
--- /dev/null
@@ -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/tools/generate_defs_and_docs.sh b/skeletonmm/tools/generate_defs_and_docs.sh
new file mode 100755 (executable)
index 0000000..025777e
--- /dev/null
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+
+# skeletonmm/codegen/generate_defs_and_docs.sh
+
+# Global environment variables:
+# GMMPROC_GEN_SOURCE_DIR  Top directory where source files are searched for.
+#                         Default value: $(dirname "$0")/../..
+#                         i.e. 2 levels above this file.
+# GMMPROC_GEN_BUILD_DIR   Top directory where built files are searched for.
+#                         Default value: $GMMPROC_GEN_SOURCE_DIR
+#
+# If you use jhbuild, you can set these environment variables equal to jhbuild's
+# configuration variables checkoutroot and buildroot, respectively.
+# Usually you can leave GMMPROC_GEN_SOURCE_DIR undefined.
+# If you have set buildroot=None, GMMPROC_GEN_BUILD_DIR can also be undefined.
+
+# Generated files:
+#   skeletonmm/skeleton/src/skeleton_docs.xml
+#   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")/.."
+
+# Where to search for source files.
+if [ -z "$GMMPROC_GEN_SOURCE_DIR" ]; then
+  GMMPROC_GEN_SOURCE_DIR="$root_dir/.."
+fi
+
+# Where to search for built files.
+if [ -z "$GMMPROC_GEN_BUILD_DIR" ]; then
+  GMMPROC_GEN_BUILD_DIR="$GMMPROC_GEN_SOURCE_DIR"
+fi
+
+# Scripts in glibmm. These are source files.
+gen_docs="$GMMPROC_GEN_SOURCE_DIR/glibmm/tools/defs_gen/docextract_to_xml.py"
+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/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 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.
+# autotools support, but don't require, non-source-dir builds.
+
+source_prefix="$GMMPROC_GEN_SOURCE_DIR/skeleton"
+build_prefix="$GMMPROC_GEN_BUILD_DIR/skeleton"
+### If skeleton is built with meson:
+if [ "$source_prefix" == "$build_prefix" ]; then
+  # skeleton is built with meson, which requires non-source-dir builds.
+  # This is what jhbuild does, if neccesary, to force non-source-dir builds.
+  build_prefix="$build_prefix/build"
+fi
+### If skeleton is built with autotools:
+# skeleton is built with autotools, which support, but don't require, non-source-dir builds.
+
+out_dir="$root_dir/skeleton/src"
+
+# Documentation
+echo === skeleton_docs.xml ===
+params="--with-properties --no-recursion"
+for dir in "$source_prefix/skeleton" "$build_prefix/skeleton"; do
+  if [ -d "$dir" ]; then
+    params="$params -s $dir"
+  fi
+done
+"$gen_docs" $params > "$out_dir/skeleton_docs.xml"
+
+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_enums.defs"
+
+# Functions and methods
+echo === 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_defs_skeleton > "$out_dir/skeleton_signals.defs"
+
similarity index 68%
rename from skeletonmm/codegen/m4/convert_skeleton.m4
rename to skeletonmm/tools/m4/convert_skeleton.m4
index 0c41fe1..11b1bdc 100644 (file)
@@ -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 (file)
index 0000000..8082503
--- /dev/null
@@ -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/*
diff --git a/util/build_scripts/dist-build-scripts.py b/util/build_scripts/dist-build-scripts.py
new file mode 100755 (executable)
index 0000000..7318bc7
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with meson.add_dist_script() in meson.build
+
+#                         sys.argv[1]      sys.argv[2]
+# dist-build-scripts.py <root_src_dir> <relative_script_dir>
+
+# <relative_script_dir> is the directory with the build scripts, relative to <root_source_dir>.
+
+import os
+import sys
+import shutil
+
+src_script_dir = os.path.join(sys.argv[1], sys.argv[2])
+dist_script_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[2])
+
+# Create the distribution script directory, if it does not exist.
+os.makedirs(dist_script_dir, exist_ok=True)
+
+# Distribute files that mm-common-get has copied to src_script_dir.
+files = [
+  'dist-build-scripts.py',
+  'dist-changelog.py',
+  'doc-reference.py',
+  'generate-binding.py'
+]
+for file in files:
+  shutil.copy(os.path.join(src_script_dir, file), dist_script_dir)
+
+# Don't distribute .gitignore files.
+for dirpath, dirnames, filenames in os.walk(os.getenv('MESON_DIST_ROOT')):
+  if '.gitignore' in filenames:
+    os.remove(os.path.join(dirpath, '.gitignore'))
+
+# Remove an empty MESON_DIST_ROOT/build directory.
+dist_build_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), 'build')
+if os.path.isdir(dist_build_dir):
+  try:
+    os.rmdir(dist_build_dir)
+  except OSError:
+    # Ignore the error, if not empty.
+    pass
diff --git a/util/build_scripts/dist-changelog.py b/util/build_scripts/dist-changelog.py
new file mode 100755 (executable)
index 0000000..c38fde3
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with meson.add_dist_script() in meson.build
+
+#                      sys.argv[1]
+# dist-changelog.py <root_source_dir>
+
+import os
+import sys
+import subprocess
+
+# Make a ChangeLog file for distribution.
+cmd = [
+  'git',
+  '--git-dir=' + os.path.join(sys.argv[1], '.git'),
+  '--work-tree=' + sys.argv[1],
+  'log',
+  '--no-merges',
+  '--date=short',
+  '--max-count=200',
+  '--pretty=tformat:%cd  %an  <%ae>%n%n  %s%n%w(0,0,2)%+b',
+]
+logfile = open(os.path.join(os.getenv('MESON_DIST_ROOT'), 'ChangeLog'), mode='w')
+result = subprocess.run(cmd, stdout=logfile)
+logfile.close()
+sys.exit(result.returncode)
diff --git a/util/build_scripts/doc-reference.py b/util/build_scripts/doc-reference.py
new file mode 100755 (executable)
index 0000000..c798d48
--- /dev/null
@@ -0,0 +1,175 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with custom_target(),
+# meson.add_install_script() or meson.add_dist_script() in meson.build.
+
+#                     argv[1]      argv[2]     argv[3:]
+# doc-reference.py <subcommand> <MMDOCTOOLDIR> <xxx>...
+
+# <MMDOCTOOLDIR> is an absolute path in the source directory.
+
+import os
+import sys
+import subprocess
+import shutil
+
+subcommand = sys.argv[1]
+MMDOCTOOLDIR = sys.argv[2]
+
+# Invoked from custom_target() in meson.build.
+def doxygen():
+  #    argv[3]         argv[4:]
+  # <doxytagfile> <doc_input_files>...
+
+  # <doxytagfile> is a relative or absolute path in the build directory.
+  # <doc_input_files> are absolute paths in the source or build directory.
+  doxytagfile = sys.argv[3]
+  doc_outdir = os.path.dirname(doxytagfile)
+
+  # Export this variable for use in the Doxygen configuration file.
+  child_env = os.environ.copy()
+  child_env['MMDOCTOOLDIR'] = MMDOCTOOLDIR
+
+  # Remove old files.
+  if os.path.isfile(doxytagfile):
+    os.remove(doxytagfile)
+  shutil.rmtree(os.path.join(doc_outdir, 'html'), ignore_errors=True)
+
+  # Relative paths in Doxyfile assume that Doxygen is run from the
+  # build directory one level above Doxyfile.
+  doxygen_cwd = os.path.join(doc_outdir, '..')
+
+  DOXYGEN = child_env.get('DOXYGEN', None)
+  if not DOXYGEN:
+    DOXYGEN = 'doxygen'
+  doxygen_input = '@INCLUDE = ' + os.path.join('reference', 'Doxyfile') + '\n' \
+                + 'INPUT = "' + '" "'.join(sys.argv[4:]) + '"\n'
+  # (Starting with Python 3.7 text=True is a more understandable equivalent to
+  # universal_newlines=True. Let's use only features in Python 3.5.)
+  result = subprocess.run([DOXYGEN, '-'], input=doxygen_input,
+    universal_newlines=True, env=child_env, cwd=doxygen_cwd)
+  if result.returncode:
+    return result.returncode
+
+  cmd = [
+    'perl',
+    '--',
+    os.path.join(MMDOCTOOLDIR, 'doc-postprocess.pl'),
+    os.path.join(doc_outdir, 'html', '*.html'),
+  ]
+  return subprocess.run(cmd).returncode
+
+# Invoked from custom_target() in meson.build.
+def devhelp():
+  #    argv[3]       argv[4]       argv[5]     argv[6]
+  # <doxytagfile> <devhelpfile> <book_name> <book_title>
+
+  # <doxytagfile> and <devhelpfile> are relative or absolute paths in the build directory.
+  doxytagfile = sys.argv[3]
+  devhelpfile = sys.argv[4]
+  book_name = sys.argv[5]
+  book_title = sys.argv[6]
+  tagfile_to_devhelp = os.path.join(MMDOCTOOLDIR, 'tagfile-to-devhelp2.xsl')
+
+  # The parameters to the Doxygen-to-Devhelp XSLT script.
+  cmd = [
+    'xsltproc',
+    '--stringparam', 'book_title', book_title,
+    '--stringparam', 'book_name', book_name,
+    '--stringparam', 'book_base', 'html',
+    '-o', devhelpfile,
+    tagfile_to_devhelp,
+    doxytagfile,
+  ]
+  return subprocess.run(cmd).returncode
+
+# Invoked from meson.add_install_script().
+def install_doc():
+  #    argv[3]       argv[4]      argv[5]        argv[6:]
+  # <devhelpfile> <devhelpdir> <htmlrefdir> <docinstall_flags>...
+
+  # <devhelpfile> is a relative or absolute path in the build directory.
+  # <htmlrefdir> and <devhelpdir> are installation directories, relative to {prefix}.
+  devhelpfile = sys.argv[3]
+  devhelpdir = os.path.join(os.getenv('MESON_INSTALL_DESTDIR_PREFIX'), sys.argv[4])
+  htmlrefdir = os.path.join(os.getenv('MESON_INSTALL_DESTDIR_PREFIX'), sys.argv[5])
+  build_dir = os.path.dirname(devhelpfile)
+
+  # Create the installation directories, if they do not exist.
+  os.makedirs(htmlrefdir, exist_ok=True)
+  os.makedirs(devhelpdir, exist_ok=True)
+
+  # Install html files.
+  cmd = [
+    'perl',
+    '--',
+    os.path.join(MMDOCTOOLDIR, 'doc-install.pl'),
+    '--verbose',
+    '--mode=0644',
+  ] + sys.argv[6:] + [
+    '-t', htmlrefdir,
+    '--glob',
+    '--',
+    os.path.join(build_dir, 'html', '*'),
+  ]
+  result1 = subprocess.run(cmd)
+
+  # Install the Devhelp file.
+  # rstrip('/') means remove trailing /, if any.
+  cmd = [
+    'perl',
+    '--',
+    os.path.join(MMDOCTOOLDIR, 'doc-install.pl'),
+    '--verbose',
+    '--mode=0644',
+    '--book-base=' + htmlrefdir.rstrip('/'),
+    '-t', devhelpdir,
+    '--',
+    devhelpfile,
+  ]
+  result2 = subprocess.run(cmd)
+
+  if result1.returncode:
+    return result1.returncode
+  return result2.returncode
+
+# Invoked from meson.add_dist_script().
+def dist_doc():
+  #      argv[3]              argv[4]       argv[5]     argv[6]
+  # <doctool_dist_dir> <doc_ref_build_dir> <tagfile> <devhelpfile>
+
+  # <doctool_dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
+  # <doc_ref_build_dir> is a relative or absolute path in the build directory.
+  # <tagfile> and <devhelpfile> are relative or absolute paths in the build directory.
+  doctool_dist_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3])
+  doc_ref_build_dir = sys.argv[4]
+  tagfile = sys.argv[5]
+  devhelpfile = sys.argv[6]
+
+  # Create the distribution directory, if it does not exist.
+  os.makedirs(os.path.join(doctool_dist_dir, 'reference'), exist_ok=True)
+
+  # Distribute files that mm-common-get has copied to MMDOCTOOLDIR.
+  # shutil.copy() does not copy timestamps.
+  for file in ['doc-install.pl', 'doc-postprocess.pl', 'doxygen-extra.css', 'tagfile-to-devhelp2.xsl']:
+    shutil.copy(os.path.join(MMDOCTOOLDIR, file), doctool_dist_dir)
+
+  # Distribute built files: tag file, devhelp file, html files.
+  for file in [tagfile, devhelpfile]:
+    shutil.copy(file, os.path.join(doctool_dist_dir, 'reference'))
+  shutil.copytree(os.path.join(doc_ref_build_dir, 'html'),
+                  os.path.join(doctool_dist_dir, 'reference', 'html'),
+                  copy_function=shutil.copy)
+  return 0
+
+# ----- Main -----
+if subcommand == 'doxygen':
+  sys.exit(doxygen())
+if subcommand == 'devhelp':
+  sys.exit(devhelp())
+if subcommand == 'install_doc':
+  sys.exit(install_doc())
+if subcommand == 'dist_doc':
+  sys.exit(dist_doc())
+print(sys.argv[0], ': illegal subcommand,', subcommand)
+sys.exit(1)
diff --git a/util/build_scripts/generate-binding.py b/util/build_scripts/generate-binding.py
new file mode 100755 (executable)
index 0000000..a1244a8
--- /dev/null
@@ -0,0 +1,185 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with run_command(), custom_target(),
+# meson.add_install_script() and meson.add_dist_script().
+
+#                        argv[1]   argv[2:]
+# generate-binding.py <subcommand> <xxx>...
+
+import os
+import sys
+import subprocess
+from pathlib import Path
+import shutil
+
+subcommand = sys.argv[1]
+
+# Invoked from custom_target() in meson.build.
+def generate_wrap_init():
+  #    argv[2]       argv[3]      argv[4]    argv[5:]
+  # <gmmproc_dir> <output_file> <namespace> <hg_files>...
+
+  # <gmmproc_dir> is an absolute path in glibmm's installation directory.
+  # <output_file> is a relative or absolute path in the build directory.
+  # <hg_files> are relative or absolute paths in the source directory.
+  gmmproc_dir = sys.argv[2]
+  output_file = sys.argv[3]
+  parent_dir = os.path.basename(os.path.dirname(output_file))
+  namespace = sys.argv[4]
+  cmd = [
+    'perl',
+    '--',
+    os.path.join(gmmproc_dir, 'generate_wrap_init.pl'),
+    '--namespace=' + namespace,
+    '--parent_dir=' + parent_dir,
+  ] + sys.argv[5:]
+  output_file_obj = open(output_file, mode='w')
+  result = subprocess.run(cmd, stdout=output_file_obj)
+  output_file_obj.close()
+  return result.returncode
+
+# Invoked from custom_target() in meson.build.
+def gmmproc():
+  #    argv[2]       argv[3]        argv[4]     argv[5]   argv[6:]
+  # <gmmproc_dir> <output_file> <basefilename> <src_dir> <m4_dirs>...
+
+  # <gmmproc_dir> is an absolute path in glibmm's installation directory.
+  # <output_file> is a relative or absolute path in the build directory.
+  # <src_dir> is an absolute path in the source directory.
+  # <m4_dirs> are absolute paths in the source directory.
+  gmmproc_dir = sys.argv[2]
+  output_file = sys.argv[3]
+  output_dir = os.path.dirname(output_file)
+  basefilename = sys.argv[4] # name without filetype
+  src_dir = sys.argv[5]
+
+  include_m4_dirs = []
+  for dir in sys.argv[6:]:
+    include_m4_dirs += ['-I', dir]
+
+  # Create the private/ directory, if it does not exist.
+  os.makedirs(os.path.join(output_dir, 'private'), exist_ok=True)
+
+  # gmmproc generates output_dir/basefilename.cc, output_dir/basefilename.h
+  # and output_dir/private/{basefilename}_p.h
+  cmd = [
+    'perl',
+    '-I' + os.path.join(gmmproc_dir, 'pm'),
+    '--',
+    os.path.join(gmmproc_dir, 'gmmproc'),
+  ] + include_m4_dirs + [
+    '--defs',
+    src_dir,
+    basefilename,
+    src_dir,
+    output_dir,
+  ]
+  result = subprocess.run(cmd)
+  if result.returncode:
+    return result.returncode
+
+  # gmmproc does not update the timestamps of output files that have not changed.
+  # That's by design, to avoid unnecessary recompilations.
+  # The updated timestamp of output_file shows meson that this custom_target()
+  # has been updated.
+  Path(output_file).touch(exist_ok=True)
+  return 0
+
+# Invoked from meson.add_install_script().
+def install_built_h_files():
+  #    argv[2]       argv[3]          argv[4:]
+  # <built_h_dir> <install_subdir> <basefilenames>...
+
+  # <built_h_dir> is an absolute path in the build directory or source directory.
+  # <install_subdir> is an installation directory, relative to {prefix}.
+  built_h_dir = sys.argv[2]
+  install_dir = os.path.join(os.getenv('MESON_INSTALL_DESTDIR_PREFIX'), sys.argv[3])
+
+  # Create the installation directory, if it does not exist.
+  os.makedirs(os.path.join(install_dir, 'private'), exist_ok=True)
+
+  for file in sys.argv[4:]:
+    path_h = os.path.join(built_h_dir, file+'.h')
+    print('Installing ', path_h, ' to ', install_dir)
+    # shutil.copy2() copies timestamps and some other file metadata.
+    shutil.copy2(path_h, install_dir)
+
+    path_h = os.path.join(built_h_dir, 'private', file+'_p.h')
+    install_priv_dir = os.path.join(install_dir, 'private')
+    print('Installing ', path_h, ' to ', install_priv_dir)
+    shutil.copy2(path_h, install_priv_dir)
+  return 0
+
+# Invoked from meson.add_dist_script().
+def dist_built_files():
+  #     argv[2]        argv[3]     argv[4:]
+  # <built_h_cc_dir> <dist_dir> <basefilenames>...
+
+  # <built_h_cc_dir> is an absolute path in the build directory or source directory.
+  # <dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
+  built_h_cc_dir = sys.argv[2]
+  dist_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3])
+
+  # Create the distribution directory, if it does not exist.
+  os.makedirs(os.path.join(dist_dir, 'private'), exist_ok=True)
+
+  # Distribute wrap_init.cc.
+  # shutil.copy() does not copy timestamps.
+  shutil.copy(os.path.join(built_h_cc_dir, 'wrap_init.cc'), dist_dir)
+
+  # Distribute .h/.cc/_p.h files built from .hg/.ccg files.
+  for file in sys.argv[4:]:
+    shutil.copy(os.path.join(built_h_cc_dir, file+'.h'), dist_dir)
+    shutil.copy(os.path.join(built_h_cc_dir, file+'.cc'), dist_dir)
+    shutil.copy(os.path.join(built_h_cc_dir, 'private', file+'_p.h'),
+                os.path.join(dist_dir, 'private'))
+  return 0
+
+# Invoked from run_command() in meson.build.
+def copy_built_files():
+  #  argv[2]    argv[3]    argv[4:]
+  # <from_dir> <to_dir> <basefilenames>...
+
+  # <from_dir> is an absolute or relative path of the directory to copy from.
+  # <to_dir> is an absolute or relative path of the directory to copy to.
+  from_dir = sys.argv[2]
+  to_dir = sys.argv[3]
+
+  # Create the destination directory, if it does not exist.
+  os.makedirs(os.path.join(to_dir, 'private'), exist_ok=True)
+
+  # Copy some built files if they exist in from_dir, but not in the destination
+  # directory, or if they are not up to date in the destination directory.
+  # (The term "source directory" is avoided here, because from_dir might not
+  # be what Meson calls a source directory as opposed to a build directory.)
+
+  # Copy wrap_init.cc.
+  from_file = os.path.join(from_dir, 'wrap_init.cc')
+  to_file = os.path.join(to_dir, 'wrap_init.cc')
+  if os.path.isfile(from_file) and ((not os.path.isfile(to_file))
+     or (os.stat(from_file).st_mtime > os.stat(to_file).st_mtime)):
+    shutil.copy(from_file, to_file)
+
+  # Copy .h/.cc/_p.h files built from .hg/.ccg files.
+  for basefile in sys.argv[4:]:
+    for file in [basefile+'.h', basefile+'.cc', os.path.join('private', basefile+'_p.h')]:
+      from_file = os.path.join(from_dir, file)
+      to_file = os.path.join(to_dir, file)
+      if os.path.isfile(from_file) and ((not os.path.isfile(to_file))
+         or (os.stat(from_file).st_mtime > os.stat(to_file).st_mtime)):
+        shutil.copy(from_file, to_file)
+  return 0
+
+# ----- Main -----
+if subcommand == 'generate_wrap_init':
+  sys.exit(generate_wrap_init())
+if subcommand == 'gmmproc':
+  sys.exit(gmmproc())
+if subcommand == 'install_built_h_files':
+  sys.exit(install_built_h_files())
+if subcommand == 'dist_built_files':
+  sys.exit(dist_built_files())
+if subcommand == 'copy_built_files':
+  sys.exit(copy_built_files())
+print(sys.argv[0], ': illegal subcommand,', subcommand)
+sys.exit(1)
diff --git a/util/meson_aux/extra-dist-cmd.py b/util/meson_aux/extra-dist-cmd.py
new file mode 100755 (executable)
index 0000000..5b04f06
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with meson.add_dist_script() in meson.build
+
+#                        argv[1]          argv[2]
+# extra-dist-cmd.py <root_source_dir> <root_build_dir>
+
+# Meson does not preserve timestamps on distributed files.
+# But this script preserves the timestamps on libstdc++.tag.
+
+import os
+import sys
+import subprocess
+import shutil
+
+root_source_dir = sys.argv[1]
+root_build_dir = sys.argv[2]
+
+# Make a ChangeLog file for distribution.
+cmd = [
+  'git',
+  '--git-dir=' + os.path.join(root_source_dir, '.git'),
+  '--work-tree=' + root_source_dir,
+  'log',
+  '--no-merges',
+  '--date=short',
+  '--max-count=200',
+  '--pretty=tformat:%cd  %an  <%ae>%n%n  %s%n%w(0,0,2)%+b',
+]
+logfile = open(os.path.join(os.getenv('MESON_DIST_ROOT'), 'ChangeLog'), mode='w')
+result = subprocess.run(cmd, stdout=logfile)
+logfile.close()
+
+# Distribute the libstdc++.tag file in addition to the files in the local git clone.
+# shutil.copy2() copies timestamps and some other file metadata.
+shutil.copy2(os.path.join(root_build_dir, 'libstdc++.tag'),
+             os.path.join(os.getenv('MESON_DIST_ROOT'), 'doctags'))
+
+sys.exit(result.returncode)
diff --git a/util/meson_aux/extra-install-cmd.py b/util/meson_aux/extra-install-cmd.py
new file mode 100755 (executable)
index 0000000..8414847
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with meson.add_install_script() in meson.build
+
+#                           argv[1]
+# extra-install-cmd.py <aclocal_macrodir>
+
+import os
+import sys
+import subprocess
+
+if not os.getenv('DESTDIR'):
+  # Inform the installer that M4 macro files installed in a directory
+  # not known to aclocal will not be picked up automatically.
+  # (Starting with Python 3.7 text=True is a more understandable equivalent to
+  # universal_newlines=True. Let's use only features in Python 3.5.)
+  result = subprocess.run(['aclocal', '--print-ac-dir'],
+                          stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+                          universal_newlines=True)
+  acdir = result.stdout
+  aclocal_path = os.getenv('ACLOCAL_PATH')
+  # acdir and aclocal_path can be sequences of os.pathsep-separated paths.
+  # Merge them to one sequence with leading and trailing os.pathsep.
+  # os.pathsep is ':' for Linux, ';' for Windows.
+  acdirs = os.pathsep
+  if aclocal_path:
+    acdirs += aclocal_path + os.pathsep
+  if acdir:
+    acdirs += acdir + os.pathsep
+
+  if (os.pathsep + sys.argv[1] + os.pathsep) not in acdirs:
+    # f'''.....''' would require Python 3.6. Avoid it.
+    print('''\
+                NOTE
+                ----
+The mm-common Autoconf macro files have been installed in a different
+directory than the system aclocal directory. In order for the installed
+macros to be found, it may be necessary to add the mm-common include
+path to the ACLOCAL_PATH environment variable:
+  ACLOCAL_PATH="$ACLOCAL_PATH:{}"
+  export ACLOCAL_PATH'''.format(sys.argv[1])
+    )
+sys.exit(0)
diff --git a/util/meson_aux/libstdcxx-tag.py b/util/meson_aux/libstdcxx-tag.py
new file mode 100755 (executable)
index 0000000..2873498
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with custom_target() in meson.build
+
+#                         argv[1]         argv[2]    argv[3]
+# libstdcxx-tag.py <curl-or-wget-or-none> <srcdir> <output_path>
+
+import os
+import sys
+import subprocess
+import shutil
+
+subcommand = sys.argv[1]
+srcdir = sys.argv[2]
+output_path = sys.argv[3]
+output_dirname, output_filename = os.path.split(output_path)
+if not output_dirname:
+  output_dirname = '.'
+
+# Remote location of the GNU libstdc++ Doxygen tag file.
+libstdcxx_tag_url = 'http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/' + output_filename
+
+def curl():
+  cmd = [
+    'curl',
+    '--compressed',
+    '--connect-timeout', '300',
+    '--globoff',
+    '--location',
+    '--max-time', '3600',
+    '--remote-time',
+    '--retry', '5',
+  ]
+  if os.path.isfile(output_path):
+    # Don't download the tag file unless it's newer than the local file.
+    cmd += ['--time-cond', output_path]
+
+  cmd += [
+    '--output', output_path,
+    libstdcxx_tag_url,
+  ]
+  return subprocess.run(cmd).returncode
+
+def wget():
+  cmd = [
+    'wget',
+    '--timestamping',
+    '--no-directories',
+    '--timeout=300',
+    '--tries=5',
+    '--directory-prefix=' + output_dirname,
+      libstdcxx_tag_url,
+    ]
+  return subprocess.run(cmd).returncode
+
+def dont_download_tag_file():
+  if os.path.isfile(output_path):
+    print('Did not check status of', output_path, 'because network is disabled.')
+  elif os.path.isfile(os.path.join(srcdir, output_filename)):
+    print('Warning:', output_path, 'does not exist.')
+    print('Copying from the source directory because network is disabled.')
+    print('If you want an up-to-date copy, reconfigure with the -Duse-network=true option.')
+    # shutil.copy2() copies timestamps and some other file metadata.
+    shutil.copy2(os.path.join(srcdir, output_filename), output_path)
+  else:
+    print('Error:', output_path, 'does not exist.', file=sys.stderr)
+    print('Downloading it is not possible because network is disabled.', file=sys.stderr)
+    print('Please reconfigure with the -Duse-network=true option.', file=sys.stderr)
+    return 1
+  return 0
+
+# ----- Main -----
+if subcommand == 'curl':
+  sys.exit(curl())
+if subcommand == 'wget':
+  sys.exit(wget())
+sys.exit(dont_download_tag_file())
diff --git a/util/meson_aux/skeletonmm-tarball.py b/util/meson_aux/skeletonmm-tarball.py
new file mode 100755 (executable)
index 0000000..576b522
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with run_command() or custom_target()
+# in meson.build
+
+#                              argv[1]           argv[2]       argv[3:]
+# skeletonmm-tarball.py <output_file_or_check> <source_dir> <input_files...>
+
+import os
+import sys
+import shutil
+import tarfile
+
+if sys.argv[1] == 'check':
+  # Called from run_command() during setup or configuration.
+  # Check which archive format can be used.
+  # In order from most wanted to least wanted: .tar.xz, .tar.gz, .tar
+  available_archive_formats = []
+  for af in shutil.get_archive_formats():
+    # Keep the formats in a list, skip the descriptions.
+    available_archive_formats += [af[0]]
+  if 'xztar' in available_archive_formats:
+    suffix = '.tar.xz'
+  elif 'gztar' in available_archive_formats:
+    suffix = '.tar.gz'
+  else: # Uncompressed tar format is always available.
+    suffix = '.tar'
+  print(suffix, end='') # stdout can be read in the meson.build file.
+  sys.exit(0)
+
+# Create an archive.
+output_file = sys.argv[1]
+source_dir = sys.argv[2]
+
+if output_file.endswith('.xz'):
+  mode = 'w:xz'
+elif output_file.endswith('.gz'):
+  mode = 'w:gz'
+else:
+  mode = 'w'
+
+tar_file = tarfile.open(output_file, mode=mode)
+os.chdir(source_dir) # Input filenames are relative to source_dir.
+for file in sys.argv[3:]:
+  tar_file.add(file)
+tar_file.close()
+# Errors raise exceptions. If an exception is raised, Meson+ninja will notice
+# that the command failed, despite exit(0).
+sys.exit(0)
+
+# shutil.make_archive() might be an alternative, but it only archives
+# whole directories. It's not useful, if you want to have full control
+# of which files are archived.
diff --git a/util/mm-common-get.1.in b/util/mm-common-get.1.in
new file mode 100644 (file)
index 0000000..ff8996c
--- /dev/null
@@ -0,0 +1,64 @@
+.TH MM-COMMON-GET 1 2019-09-12 GNOME "@PACKAGE_STRING@"
+.SH NAME
+mm-common-get \- Copy files from mm-common to a C++ binding module that uses Meson
+.SH SYNOPSIS
+.B mm-common-get
+.RI [ OPTION "]... " "BUILDSCRIPT-DIR DOCTOOL-DIR"
+.SH DESCRIPTION
+Run
+.B mm-common-get
+to copy the
+.I mm-common
+build support files into the source tree of a C++ binding module.
+.SH OPTIONS
+.TP
+.BR \-f ", " \-\-force
+forcefully replace existing files
+.TP
+.B \-\-help
+display a help message and exit
+.TP
+.B \-\-version
+show version information and exit
+.SH "EXIT STATUS"
+The exit status is 0 if OK, or 1 if an error occurred.
+.SH FILES
+The build support files currently copied by
+.B mm-common-get
+are listed below.
+.TP
+.BI "Meson build scripts copied to " BUILDSCRIPT-DIR :
+.PD 0
+.IP
+.I dist-build-scripts.py
+.IP
+.I dist-changelog.py
+.IP
+.I doc-reference.py
+.IP
+.I generate-binding.py
+.PD
+.TP
+.BI "Documentation utilities copied to " DOCTOOL-DIR :
+.PD 0
+.IP
+.I doc-install.pl
+.IP
+.I doc-postprocess.pl
+.IP
+.I doxygen.css
+.IP
+.I doxygen-extra.css
+.IP
+.I tagfile-to-devhelp2.xsl
+.PD
+.SH "SEE ALSO"
+.PD 0
+.BR mm-common-prepare (1)
+.PP
+.I @docdir@/README
+.PP
+.I @docdir@/skeletonmm.tar.xz or
+.PP
+.I @docdir@/skeletonmm.tar.gz
+.PD
diff --git a/util/mm-common-get.in b/util/mm-common-get.in
new file mode 100644 (file)
index 0000000..e0b28f0
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2019 The gtkmm Development Team
+#
+# @configure_input@
+#
+# mm-common is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation, either version 2 of the License,
+# or (at your option) any later version.
+#
+# mm-common is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with mm-common.  If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import os
+import argparse
+import shutil
+import filecmp
+
+pkgdatadir = os.path.join('@datadir_py@', '@PACKAGE_TARNAME@')
+progname = os.path.basename(sys.argv[0])
+
+parser = argparse.ArgumentParser(
+  description='Copy files from mm-common to a C++ binding module that uses Meson')
+parser.add_argument('--version', action='version', version='%(prog)s @PACKAGE_VERSION@')
+parser.add_argument('-f', '--force', help='replace existing files', action='store_true')
+parser.add_argument('buildscript_dir', help='where to store build scripts')
+parser.add_argument('doctool_dir', help='where to store doc tool files')
+args = parser.parse_args()
+
+forceflag = args.force
+buildscriptdir = args.buildscript_dir
+doctooldir = args.doctool_dir
+
+print(progname + ': putting Meson build scripts in ' + buildscriptdir)
+# Create the destination directory, if it does not exist.
+os.makedirs(buildscriptdir, exist_ok=True)
+for file in ['dist-build-scripts.py', 'dist-changelog.py', 'doc-reference.py', 'generate-binding.py']:
+  src_file = os.path.join(pkgdatadir, 'build', file)
+  dest_file = os.path.join(buildscriptdir, file)
+  # Don't update the timestamp of dest_file, if it's equal to src_file.
+  # if file-does-not-exist or (force and files-are-not-equal)
+  if (not os.path.isfile(dest_file)) or (forceflag and (not filecmp.cmp(src_file, dest_file))):
+    print(progname + ': copying file ' + file)
+    # shutil.copy() does not copy timestamps.
+    shutil.copy(src_file, dest_file)
+
+print(progname + ': putting documentation utilities in ' + doctooldir)
+os.makedirs(doctooldir, exist_ok=True)
+for file in ['doc-install.pl', 'doc-postprocess.pl',
+             'doxygen.css', 'doxygen-extra.css', 'tagfile-to-devhelp2.xsl']:
+  src_file = os.path.join(pkgdatadir, 'doctool', file)
+  dest_file = os.path.join(doctooldir, file)
+  if (not os.path.isfile(dest_file)) or (forceflag and (not filecmp.cmp(src_file, dest_file))):
+    print(progname + ': copying file ' + file)
+    shutil.copy(src_file, dest_file)
index 7658031..edbe042 100644 (file)
@@ -1,16 +1,16 @@
 .TH MM-COMMON-PREPARE 1 2014-08-13 GNOME "@PACKAGE_STRING@"
 .SH NAME
-mm-common-prepare \- Prepare a C++ binding module to use mm-common
+mm-common-prepare \- Prepare a C++ binding module to use mm-common and Autotools
 .SH SYNOPSIS
 .B mm-common-prepare
 .RI [ OPTION "]... [" SOURCE-DIR ]
 .SH DESCRIPTION
 Run
 .B mm-common-prepare
-to install the
+to copy the
 .I mm-common
 build support files into the source tree of a C++ binding module.
-The exact location where these files will be installed can be influenced
+The exact location these files will be copied to can be influenced
 through special macros in the
 .I configure.ac
 file.
@@ -30,17 +30,17 @@ If the
 macro is called with an explicit
 .I DOCTOOL-DIR
 argument, the common utilities required for generating and installing
-the reference documentation of a C++ binding module will be installed
-into the named subdirectory.
+the reference documentation of a C++ binding module will be copied
+to the named subdirectory.
 If
 .B MM_CONFIG_DOCTOOL_DIR
 is not used or does not specify a
 .I DOCTOOL-DIR
 argument,
 .B mm-common-prepare
-will not install the documentation utility files into the module's source tree.
+will not copy the documentation utility files into the module's source tree.
 Instead, it is assumed that the module depends on
-.I glibmm
+.I mm-common
 and can use the installed documentation utilities that come with it.
 .PP
 If no
@@ -63,11 +63,11 @@ show version information and exit
 .SH "EXIT STATUS"
 The exit status is 0 if OK, or 1 if an error occurred.
 .SH FILES
-The build support files currently installed by
+The build support files currently copied by
 .B mm-common-prepare
 are listed below.
 .TP
-.BI "Automake include files installed into " AUX-DIR :
+.BI "Automake include files copied to " AUX-DIR :
 .PD 0
 .IP
 .I compile-binding.am
@@ -79,7 +79,7 @@ are listed below.
 .I generate-binding.am
 .PD
 .TP
-.BI "Documentation utilities installed into " DOCTOOL-DIR :
+.BI "Documentation utilities copied to " DOCTOOL-DIR :
 .PD 0
 .IP
 .I doc-install.pl
@@ -94,9 +94,12 @@ are listed below.
 .PD
 .SH "SEE ALSO"
 .PD 0
-.BR autoreconf (1)
+.BR autoreconf (1),
+.BR mm-common-get (1)
 .PP
 .I @docdir@/README
 .PP
+.I @docdir@/skeletonmm.tar.xz or
+.PP
 .I @docdir@/skeletonmm.tar.gz
 .PD
index 5285095..3a0a7de 100644 (file)
@@ -35,7 +35,7 @@ do
     cat <<EOF
 Usage: $progname [OPTION]... [DIRECTORY | CONFIGURE-FILE]
 
-Prepare a C++ binding module to use mm-common.
+Prepare a C++ binding module to use mm-common and Autotools.
 
  -c, --copy          copy files rather than symlinking them
  -f, --force         replace existing files