[mm-common/wip/kjellahl/meson-build] Support modules that are built with Meson
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mm-common/wip/kjellahl/meson-build] Support modules that are built with Meson
- Date: Wed, 28 Aug 2019 13:06:44 +0000 (UTC)
commit 7964a3312f15b187b90c4dcd5670b1f31853ce65
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed Aug 28 15:04:30 2019 +0200
Support modules that are built with Meson
* Makefile.am:
* meson.build: Install files from util/build_scripts/.
* README: Describe the new files.
* util/build_scripts/*.sh: New files for modules built with Meson.
* util/mm-common-prepare.1.in: Describe the new mm-common-prepare options.
* util/mm-common-prepare.in: New options: --doctooldir=DIR, --buildscriptdir=DIR.
See MR !2
Makefile.am | 8 +-
README | 85 ++++++++++++++----
meson.build | 19 +++-
util/build_scripts/dist-build-scripts.sh | 26 ++++++
util/build_scripts/dist-changelog.sh | 9 ++
util/build_scripts/doc-reference.sh | 116 ++++++++++++++++++++++++
util/build_scripts/generate-binding.sh | 150 +++++++++++++++++++++++++++++++
util/mm-common-prepare.1.in | 36 ++++++--
util/mm-common-prepare.in | 53 ++++++++++-
9 files changed, 474 insertions(+), 28 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 4f7ad94..ae16eab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,13 +22,17 @@ bin_SCRIPTS = util/mm-common-prepare
man1_MANS = util/mm-common-prepare.1
# These are installed so that mm-common-prepare can copy them
-# into projects at autogen.sh time:
+# into projects at autogen.sh time, or at meson setup or configure time:
build_supportdir = $(pkgdatadir)/build
dist_build_support_DATA = \
am_include/compile-binding.am \
am_include/dist-changelog.am \
am_include/doc-reference.am \
- am_include/generate-binding.am
+ am_include/generate-binding.am \
+ util/build_scripts/dist-build-scripts.sh \
+ util/build_scripts/dist-changelog.sh \
+ util/build_scripts/doc-reference.sh \
+ util/build_scripts/generate-binding.sh
# These are installed so that aclocal can copy them into aclocal.m4
# at autogen.sh time:
diff --git a/README b/README
index 4995ef8..11ee5de 100644
--- a/README
+++ b/README
@@ -14,13 +14,15 @@ is available at <http://gcc.gnu.org/onlinedocs/libstdc++/>.
Autotools or Meson?
===================
-mm-common can be built with autotools or meson. Building with autotools
+mm-common can be built with Autotools or Meson. Building with Autotools
may be phased out in the future.
-Most of the files that mm-common installs and mm-common-prepare copies to
-other modules are useful only if those modules are built with autotools.
+The files that mm-common installs and mm-common-prepare copies to
+other modules are useful both in modules that are built with Autotools and
+in modules that are built with Meson.
+
The files in the skeletonmm directory show the start of a project that will
-use autotools.
+use Autotools.
Skeleton C++ binding module
===========================
@@ -28,7 +30,7 @@ Skeleton C++ binding module
When creating a new C++ binding module based on mm-common, the easiest way
to get started is to copy the skeletonmm directory shipped with mm-common.
It contains the build support files required for a C++ binding module using
-gmmproc and glibmm.
+Autotools, 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
@@ -42,8 +44,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
@@ -70,8 +72,28 @@ 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-prepare and Meson
+---------------------------
+
+The mm-common-prepare 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
+
+ is_git_build = run_command('test', '-d', project_source_root / '.git').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_prepare = find_program('mm-common-prepare', required: maintainer_mode)
+
+ if maintainer_mode and mm_common_prepare.found()
+ # Copy files to untracked/docs and untracked/build_scripts.
+ run_command(mm_common_prepare, '--force', '--copy',
+ '--doctooldir=' + project_source_root / 'untracked' / 'docs',
+ '--buildscriptdir=' + project_source_root / 'untracked' / 'build_scripts')
+ endif
+
+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
@@ -131,8 +153,8 @@ 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 am_include/ directory.
The installed mm-common-prepare program copies all of the .am files into
@@ -159,14 +181,43 @@ am_include/dist-changelog.am:
a release, intended to be used by modules which use the version control
log exclusively to document changes.
-Documentation utilities
------------------------
+Shell 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.sh:
+ Commands for running the gmmproc code generator to produce
+ the source code files for a C++ binding module.
+
+util/build_scripts/doc-reference.sh:
+ 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.sh:
+ 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.sh:
+ Commands that trim the distribution directory before a tarball is made.
+ The scripts copied by mm-common-prepare are distributed, although they are
+ not checked into the git repository. All .gitignore files and an empty build/
+ diretory 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
+
+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
@@ -219,9 +270,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
diff --git a/meson.build b/meson.build
index a47e2df..ead4cc7 100644
--- a/meson.build
+++ b/meson.build
@@ -43,16 +43,29 @@ conf_data.set('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_versi
# These are installed so that mm-common-prepare can copy them
# into projects at autogen.sh time.
-build_support_basefiles = [
+autotools_build_support_basefiles = [
'compile-binding.am',
'dist-changelog.am',
'doc-reference.am',
'generate-binding.am',
]
build_support_files = []
-foreach file : build_support_basefiles
+foreach file : autotools_build_support_basefiles
build_support_files += 'am_include' / file
endforeach
+
+# These are installed so that mm-common-prepare can copy them
+# into projects at Meson setup or configure time.
+meson_build_support_basefiles = [
+ 'dist-build-scripts.sh',
+ 'dist-changelog.sh',
+ 'doc-reference.sh',
+ 'generate-binding.sh',
+]
+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
@@ -92,6 +105,8 @@ 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-prepare can copy them
+# into projects at Meson setup or configure time.
doctool_basefiles = [
'doc-install.pl',
'doc-postprocess.pl',
diff --git a/util/build_scripts/dist-build-scripts.sh b/util/build_scripts/dist-build-scripts.sh
new file mode 100755
index 0000000..f8066df
--- /dev/null
+++ b/util/build_scripts/dist-build-scripts.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+
+# External command, intended to be called with meson.add_dist_script() in meson.build
+
+# $1 $2
+# dist-build-scripts.sh <root_src_dir> <relative_script_dir>
+
+# <relative_script_dir> is the directory with the build scripts, relative to <root_source_dir>.
+src_script_dir="$1/$2"
+dist_script_dir="$MESON_DIST_ROOT/$2"
+
+# Create the distribution directory, if it does not exist.
+# -p == --parents (Posix does not support long options.)
+mkdir -p "$dist_script_dir"
+
+# Distribute files that mm-common-prepare has copied to $src_script_dir.
+for file in dist-build-scripts.sh dist-changelog.sh doc-reference.sh generate-binding.sh; do
+ cp "$src_script_dir/$file" "$dist_script_dir/"
+done
+
+# Remove all .gitignore files and an empty $MESON_DIST_ROOT/build directory.
+find "$MESON_DIST_ROOT" -name ".gitignore" -exec rm '{}' \;
+if [ -d "$MESON_DIST_ROOT/build" ]; then
+ # Ignore the error, if not empty.
+ rmdir "$MESON_DIST_ROOT/build" 2>/dev/null || true
+fi
diff --git a/util/build_scripts/dist-changelog.sh b/util/build_scripts/dist-changelog.sh
new file mode 100755
index 0000000..03a38b0
--- /dev/null
+++ b/util/build_scripts/dist-changelog.sh
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+# External command, intended to be called with meson.add_dist_script() in meson.build
+
+# dist-changelog.sh <root_source_dir>
+
+# Make a ChangeLog file for distribution.
+git --git-dir="$1/.git" --work-tree="$1" log --no-merges --date=short --max-count=200 \
+ --pretty='tformat:%cd %an <%ae>%n%n %s%n%w(0,0,2)%+b' > "$MESON_DIST_ROOT/ChangeLog"
diff --git a/util/build_scripts/doc-reference.sh b/util/build_scripts/doc-reference.sh
new file mode 100755
index 0000000..6b4db2a
--- /dev/null
+++ b/util/build_scripts/doc-reference.sh
@@ -0,0 +1,116 @@
+#!/bin/sh -e
+
+# External command, intended to be called with custom_target(),
+# meson.add_install_script() or meson.add_dist_script() in meson.build.
+
+# $0 $1 $2 $3...
+# doc-reference.sh <subcommand> <MMDOCTOOLDIR> <xxx>...
+
+# <MMDOCTOOLDIR> is an absolute path in the source directory.
+
+subcommand="$1"
+MMDOCTOOLDIR="$2"
+shift 2
+
+case "$subcommand" in
+doxygen)
+ # $1 $2...
+ # <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="$1"
+ doc_outdir="$(dirname "$1")"
+ shift
+
+ # Export this variable for use in the Doxygen configuration file.
+ export MMDOCTOOLDIR
+
+ # Remove old files.
+ # -fR == --force --recursive
+ rm -f "$doxytagfile"
+ rm -fR "$doc_outdir/html"
+
+ # Relative paths in Doxyfile assume that Doxygen is run from the
+ # build directory one level above Doxyfile.
+ saved_wd="$(pwd)"
+ cd "$doc_outdir/.."
+ if [ -z "$DOXYGEN" ]; then
+ DOXYGEN=doxygen
+ fi
+ (echo '@INCLUDE =' reference/Doxyfile && echo 'INPUT =' $*) | "$DOXYGEN" -
+ cd "$saved_wd"
+ perl -- "$MMDOCTOOLDIR/doc-postprocess.pl" "$doc_outdir/html/*.html"
+ ;;
+devhelp)
+ # $1 $2 $3 $4
+ # <doxytagfile> <devhelpfile> <book_name> <book_title>
+
+ # <doxytagfile> and <devhelpfile> are relative or absolute paths in the build directory.
+ doxytagfile="$1"
+ devhelpfile="$2"
+ book_name="$3"
+ book_title="$4"
+ tagfile_to_devhelp="$MMDOCTOOLDIR/tagfile-to-devhelp2.xsl"
+
+ # The parameters to the Doxygen-to-Devhelp XSLT script.
+ xsltproc \
+ --stringparam book_title "$book_title" \
+ --stringparam book_name "$book_name" \
+ --stringparam book_base html \
+ -o "$devhelpfile" "$tagfile_to_devhelp" "$doxytagfile"
+ ;;
+install_doc)
+ # $1 $2 $3 $4...
+ # <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="$1"
+ devhelpdir="$MESON_INSTALL_DESTDIR_PREFIX/$2"
+ htmlrefdir="$MESON_INSTALL_DESTDIR_PREFIX/$3"
+ build_dir="$(dirname "$devhelpfile")"
+ shift 3
+
+ # Create the install directories, if they do not exist.
+ # -p == --parents (Posix does not support long options.)
+ mkdir -p "$htmlrefdir"
+ mkdir -p "$devhelpdir"
+
+ # Install html files.
+ perl -- "$MMDOCTOOLDIR/doc-install.pl" --verbose --mode=0644 \
+ "$@" -t "$htmlrefdir" --glob -- "$build_dir/html/*"
+
+ # Install the Devhelp file.
+ # ${name%/} means remove trailing /, if any.
+ perl -- "$MMDOCTOOLDIR/doc-install.pl" --verbose --mode=0644 \
+ --book-base="${htmlrefdir%/}" -t "$devhelpdir" -- "$devhelpfile"
+ ;;
+dist_doc)
+ # $1 $2 $3 $4
+ # <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="$MESON_DIST_ROOT/$1"
+ doc_ref_build_dir="$2"
+ tagfile="$3"
+ devhelpfile="$4"
+
+ # Create the distribution directory, if it does not exist.
+ mkdir -p "$doctool_dist_dir/reference"
+
+ # Distribute files that mm-common-prepare has copied to $MMDOCTOOLDIR.
+ for file in doc-install.pl doc-postprocess.pl tagfile-to-devhelp2.xsl doxygen-extra.css; do
+ cp "$MMDOCTOOLDIR/$file" "$doctool_dist_dir/"
+ done
+
+ # Distribute built files: tag file, devhelp file, html files.
+ for file in "$tagfile" "$devhelpfile"; do
+ cp "$file" "$doctool_dist_dir/reference/"
+ done
+ # -R == --recursive
+ cp -R "$doc_ref_build_dir/html/" "$doctool_dist_dir/reference/"
+ ;;
+esac
diff --git a/util/build_scripts/generate-binding.sh b/util/build_scripts/generate-binding.sh
new file mode 100755
index 0000000..433c6d5
--- /dev/null
+++ b/util/build_scripts/generate-binding.sh
@@ -0,0 +1,150 @@
+#!/bin/sh -e
+
+# External command, intended to be called with run_command(), custom_target(),
+# meson.add_install_script() and meson.add_dist_script().
+
+# $0 $1 $2...
+# generate-binding.sh <subcommand> <xxx>...
+
+subcommand="$1"
+shift
+
+case "$subcommand" in
+generate_wrap_init)
+ # $1 $2 $3 $4...
+ # <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="$1"
+ output_file="$2"
+ output_dir="$(dirname "$2")"
+ parent_dir="$(basename "$output_dir")"
+ namespace="$3"
+ shift 3
+
+ perl -- "$gmmproc_dir/generate_wrap_init.pl" --namespace="$namespace" --parent_dir="$parent_dir" "$@"
"$output_file"
+ ;;
+gmmproc)
+ # $1 $2 $3 $4 $5...
+ # <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="$1"
+ output_file="$2"
+ output_dir="$(dirname "$2")"
+ basefilename="$3" # name without filetype
+ src_dir="$4"
+ shift 4
+
+ include_m4_dirs=""
+ for dir in "$@"; do
+ include_m4_dirs="$include_m4_dirs -I $dir"
+ done
+
+ # Create the private/ directory, if it does not exist.
+ # -p == --parents (Posix does not support long options.)
+ mkdir -p "$output_dir/private"
+
+ # gmmproc generates $output_dir/$basefilename.cc, $output_dir/$basefilename.h
+ # and $output_dir/private/${basefilename}_p.h
+ perl -I"$gmmproc_dir/pm" -- "$gmmproc_dir/gmmproc" $include_m4_dirs \
+ --defs "$src_dir" "$basefilename" "$src_dir" "$output_dir"
+
+ # 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.
+ touch "$output_file"
+ ;;
+install_built_h_files)
+ # $1 $2 $3...
+ # <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="$1"
+ install_dir="$MESON_INSTALL_DESTDIR_PREFIX/$2"
+ shift 2
+
+ # Create the install directory, if it does not exist.
+ # -p == --parents
+ mkdir -p "$install_dir/private"
+
+ for file in "$@"; do
+ echo Installing $built_h_dir/$file.h to $install_dir
+ # -p == --preserve
+ cp -p "$built_h_dir/$file.h" "$install_dir"
+ echo Installing $built_h_dir/private/${file}_p.h to $install_dir/private
+ cp -p "$built_h_dir/private/${file}_p.h" "$install_dir/private"
+ done
+ ;;
+dist_built_files)
+ # $1 $2 $3...
+ # <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="$1"
+ dist_dir="$MESON_DIST_ROOT/$2"
+ shift 2
+
+ # Create the distribution directory, if it does not exist.
+ # -p == --parents
+ mkdir -p "$dist_dir/private"
+
+ # Distribute wrap_init.cc.
+ cp "$built_h_cc_dir/wrap_init.cc" "$dist_dir"
+
+ # Distribute .h/_p.h/.cc files built from .hg/.ccg files.
+ for file in "$@"; do
+ cp "$built_h_cc_dir/$file.h" "$built_h_cc_dir/$file.cc" "$dist_dir"
+ cp "$built_h_cc_dir/private/${file}_p.h" "$dist_dir/private"
+ done
+ ;;
+copy_built_files)
+ # $1 $2 $3...
+ # <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="$1"
+ to_dir="$2"
+ shift 2
+
+ # Create the destination directory, if it does not exist.
+ # -p == --parents
+ mkdir -p "$to_dir/private"
+
+ # 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="$from_dir/wrap_init.cc"
+ to="$to_dir/wrap_init.cc"
+ if [ -f "$from" ] && { [ ! -f "$to" ] || [ "$from" -nt "$to" ]; }; then
+ cp "$from" "$to"
+ fi
+ # Copy .h/_p.h/.cc files built from .hg/.ccg files.
+ for basefile in "$@"; do
+ for file in "$basefile.h" "$basefile.cc"; do
+ from="$from_dir/$file"
+ to="$to_dir/$file"
+ if [ -f "$from" ] && { [ ! -f "$to" ] || [ "$from" -nt "$to" ]; }; then
+ cp "$from" "$to"
+ fi
+ done
+ from="$from_dir/private/${basefile}_p.h"
+ to="$to_dir/private/${basefile}_p.h"
+ if [ -f "$from" ] && { [ ! -f "$to" ] || [ "$from" -nt "$to" ]; }; then
+ cp "$from" "$to"
+ fi
+ done
+ ;;
+esac
diff --git a/util/mm-common-prepare.1.in b/util/mm-common-prepare.1.in
index a9ebd50..c16a344 100644
--- a/util/mm-common-prepare.1.in
+++ b/util/mm-common-prepare.1.in
@@ -1,4 +1,4 @@
-.TH MM-COMMON-PREPARE 1 2014-08-13 GNOME "@PACKAGE_STRING@"
+.TH MM-COMMON-PREPARE 1 2019-08-25 GNOME "@PACKAGE_STRING@"
.SH NAME
mm-common-prepare \- Prepare a C++ binding module to use mm-common
.SH SYNOPSIS
@@ -10,8 +10,8 @@ Run
to copy the
.I mm-common
build support files into the source tree of a C++ binding module.
-The exact location these files will be copied to can be influenced
-through special macros in the
+If the module is built with Autotools, the exact location these files
+will be copied to can be influenced through special macros in the
.I configure.ac
file.
.TP
@@ -43,7 +43,9 @@ Instead, it is assumed that the module depends on
.I mm-common
and can use the installed documentation utilities that come with it.
.PP
-If no
+If neither
+.BR \-\-doctooldir ", " \-\-buildscriptdir
+nor a
.I SOURCE-DIR
argument has been specified on the command line, the current working
directory will be used.
@@ -60,6 +62,16 @@ display a help message and exit
.TP
.B \-\-version
show version information and exit
+.TP
+.BI \-\-doctooldir= DOCTOOL-DIR
+copy the documentation utility files to
+.I DOCTOOL-DIR
+(Meson build)
+.TP
+.BI \-\-buildscriptdir= BUILDSCRIPT-DIR
+copy the build scripts to
+.I BUILDSCRIPT-DIR
+(Meson build)
.SH "EXIT STATUS"
The exit status is 0 if OK, or 1 if an error occurred.
.SH FILES
@@ -67,7 +79,7 @@ The build support files currently copied by
.B mm-common-prepare
are listed below.
.TP
-.BI "Automake include files copied to " AUX-DIR :
+.BI "Automake include files copied to " AUX-DIR " (Autotools):"
.PD 0
.IP
.I compile-binding.am
@@ -79,7 +91,19 @@ are listed below.
.I generate-binding.am
.PD
.TP
-.BI "Documentation utilities copied to " DOCTOOL-DIR :
+.BI "Shell build scripts copied to " BUILDSCRIPT-DIR " (Meson):"
+.PD 0
+.IP
+.I dist-build-scripts.sh
+.IP
+.I dist-changelog.sh
+.IP
+.I doc-reference.sh
+.IP
+.I generate-binding.sh
+.PD
+.TP
+.BI "Documentation utilities copied to " DOCTOOL-DIR " (Autotools and Meson):"
.PD 0
.IP
.I doc-install.pl
diff --git a/util/mm-common-prepare.in b/util/mm-common-prepare.in
index 5285095..9ed8502 100644
--- a/util/mm-common-prepare.in
+++ b/util/mm-common-prepare.in
@@ -27,6 +27,8 @@ installcmd='ln -s'
instaction=symlinking
forceflag=
target=.
+doctooldir=
+buildscriptdir=
for arg
do
@@ -41,6 +43,9 @@ Prepare a C++ binding module to use mm-common.
-f, --force replace existing files
--help display this help message
--version print version information
+ --doctooldir=DIR where to store doc tool files (Meson build)
+ --buildscriptdir=DIR where to store build scripts (Meson build)
+ DIRECTORY | CONFIGURE-FILE (Autotools build)
EOF
exit 0
;;
@@ -60,6 +65,12 @@ EOF
instaction=copying
forceflag=' -f'
;;
+ --doctooldir=*)
+ doctooldir="${arg#--doctooldir=}"
+ ;;
+ --buildscriptdir=*)
+ buildscriptdir="${arg#--buildscriptdir=}"
+ ;;
-*)
echo "$progname: error: unrecognized option '$arg'" >&2
exit 1
@@ -70,6 +81,46 @@ EOF
esac
done
+# Copy or link files for Meson build.
+if [ -n "$doctooldir" ]; then
+ echo "$progname: putting documentation utilities in '$doctooldir'."
+ # -p == --parents (Posix does not support long options.)
+ mkdir -p "$doctooldir"
+
+ for file in doc-install.pl doc-postprocess.pl doxygen.css doxygen-extra.css tagfile-to-devhelp2.xsl
+ do
+ # Don't update the timestamp of $doctooldir/$file, if it's equal to "$pkgdatadir/doctool/$file".
+ # if file-does-not-exist || (force && files-are-not-equal)
+ # -s == --quiet, --silent
+ if test ! -f "$doctooldir/$file" || \
+ { test -n "$forceflag" && ! cmp -s "$pkgdatadir/doctool/$file" "$doctooldir/$file"; }; then
+ echo "$progname: $instaction file '$file'"
+ $installcmd$forceflag "$pkgdatadir/doctool/$file" "$doctooldir/$file"
+ fi
+ done
+fi
+
+if [ -n "$buildscriptdir" ]; then
+ echo "$progname: putting Meson build scripts in '$buildscriptdir'."
+ mkdir -p "$buildscriptdir"
+
+ for file in dist-build-scripts.sh dist-changelog.sh doc-reference.sh generate-binding.sh
+ do
+ if test ! -f "$buildscriptdir/$file" || \
+ { test -n "$forceflag" && ! cmp -s "$pkgdatadir/build/$file" "$buildscriptdir/$file"; }; then
+ echo "$progname: $instaction file '$file'"
+ $installcmd$forceflag "$pkgdatadir/build/$file" "$buildscriptdir/$file"
+ fi
+ done
+fi
+
+if [ -n "$doctooldir" -o -n "$buildscriptdir" ]; then
+ exit 0
+fi
+
+# Copy or link files for Autotools build.
+# The configure.ac file is read in order to find directories where to store files.
+
if test -d "$target"; then
srcdir=$target
acfile=$target/configure.ac
@@ -89,7 +140,7 @@ auxdir=`sed -n "s/^[$s]*AC_CONFIG_AUX_DIR([[$s]*\\([^])\$,$s]*\\).*/\\1/p" "$acf
doctooldir=`sed -n "s/^[$s]*MM_CONFIG_DOCTOOL_DIR([[$s]*\\([^])\$,$s]*\\).*/\\1/p" "$acfile"`
auxdir=$srcdir${auxdir:+/}$auxdir
-echo "$progname: putting auxiliary files in '$auxdir'."
+echo "$progname: putting auxiliary Automake files in '$auxdir'."
test -d "$auxdir" || mkdir "$auxdir"
for file in compile-binding.am dist-changelog.am doc-reference.am generate-binding.am
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]