diff options
-rw-r--r-- | Makefile.am | 9 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | meson.build | 280 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rwxr-xr-x | util/meson_aux/extra-dist-cmd.sh | 17 | ||||
-rwxr-xr-x | util/meson_aux/extra-install-cmd.sh | 25 | ||||
-rwxr-xr-x | util/meson_aux/libstdcxx-tag.sh | 39 | ||||
-rwxr-xr-x | util/meson_aux/skeletonmm-tarball.sh | 25 | ||||
-rw-r--r-- | util/mm-common-prepare.1.in | 20 |
9 files changed, 419 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am index 49858c9..4f7ad94 100644 --- a/Makefile.am +++ b/Makefile.am @@ -124,6 +124,15 @@ 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.sh \ + util/meson_aux/extra-install-cmd.sh \ + util/meson_aux/libstdcxx-tag.sh \ + util/meson_aux/skeletonmm-tarball.sh + # Remote location of the GNU libstdc++ Doxygen tag file. libstdcxx_tag_url = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag @@ -11,6 +11,17 @@ 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. + +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 in the skeletonmm directory show the start of a project that will +use autotools. + Skeleton C++ binding module =========================== diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..17fbf43 --- /dev/null +++ b/meson.build @@ -0,0 +1,280 @@ +# This file is part of mm-common. + +project('mm-common', + version: '0.9.12', + meson_version: '>= 0.49.0', + license: 'GPLv2' +) + +# Installation directories. +mm_common_prefix = get_option('prefix') +mm_common_bindir = join_paths(mm_common_prefix, get_option('bindir')) + +mm_common_datadir = join_paths(mm_common_prefix, get_option('datadir')) +mm_common_aclocal_macrodir = join_paths(mm_common_datadir, 'aclocal') +mm_common_pkgconfigdir = join_paths(mm_common_datadir, 'pkgconfig') +mm_common_docdir = join_paths(mm_common_datadir, 'doc', meson.project_name()) + +mm_common_pkgdatadir = join_paths(mm_common_datadir, meson.project_name()) +mm_common_build_supportdir = join_paths(mm_common_pkgdatadir, 'build') +mm_common_doctooldir = join_paths(mm_common_pkgdatadir, 'doctool') +mm_common_doctagsdir = join_paths(mm_common_pkgdatadir, 'doctags') + +mm_common_mandir = join_paths(mm_common_prefix, get_option('mandir')) +mm_common_man1dir = join_paths(mm_common_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-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', mm_common_prefix) +conf_data.set('datarootdir', join_paths('${prefix}', get_option('datadir'))) +conf_data.set('datadir', '${datarootdir}') +conf_data.set('docdir', mm_common_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. +build_support_basefiles = [ + 'compile-binding.am', + 'dist-changelog.am', + 'doc-reference.am', + 'generate-binding.am', +] +build_support_files = [] +foreach i : build_support_basefiles + build_support_files += join_paths('am_include', i) +endforeach +install_data(build_support_files, install_dir: mm_common_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 i : aclocal_macro_basefiles + aclocal_macro_files += join_paths('macros', i) +endforeach +install_data(aclocal_macro_files, install_dir: mm_common_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: join_paths('macros', 'mm-common.m4.in'), + output: '@BASENAME@', + configuration: conf_data2, + install_dir: mm_common_aclocal_macrodir +) + +if find_program('aclocal', required: false).found() + meson.add_install_script( + join_paths('util', 'meson_aux', 'extra-install-cmd.sh'), + mm_common_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. +doctool_basefiles = [ + 'doc-install.pl', + 'doc-postprocess.pl', + 'doxygen.css', + 'doxygen-extra.css', + 'tagfile-to-devhelp2.xsl', +] +doctool_files = [] +foreach i : doctool_basefiles + doctool_files += join_paths('util', i) +endforeach +install_data(doctool_files, install_dir: mm_common_doctooldir) + +# Let other modules find the utils with pkg-config. +configure_file( + input: join_paths('doctags', 'mm-common-libstdc++.pc.in'), + output: '@BASENAME@', + configuration: conf_data, + install_dir: mm_common_pkgconfigdir +) + +configure_file( + input: join_paths('util', 'mm-common-util.pc.in'), + output: '@BASENAME@', + configuration: conf_data, + install_dir: mm_common_pkgconfigdir +) + +configure_file( + input: join_paths('doctags', 'mm-common-libstdc++-uninstalled.pc.in'), + output: '@BASENAME@', + configuration: conf_data, +) + +configure_file( + input: join_paths('util', 'mm-common-util-uninstalled.pc.in'), + output: '@BASENAME@', + configuration: conf_data, +) + +# mm-common-prepare command. +conf_data3 = configuration_data() +conf_data3.merge_from(conf_data) +conf_data3.set('configure_input', 'mm-common-prepare. Generated from util/mm-common-prepare.in') +configure_file( + input: join_paths('util', 'mm-common-prepare.in'), + output: '@BASENAME@', + configuration: conf_data3, + install_dir: mm_common_bindir +) + +# mm-common-prepare.1 manual page. +configure_file( + input: join_paths('util', 'mm-common-prepare.1.in'), + output: '@BASENAME@', + configuration: conf_data, + install_dir: mm_common_man1dir +) + +# Skeleton project. +skeletonmm_basefiles = [ + 'autogen.sh', + '.gitignore', + 'AUTHORS', + 'COPYING', + 'ChangeLog', + 'Makefile.am', + 'README', + 'configure.ac', + 'skeletonmm.doap', + 'build/.gitignore', + 'codegen/generate_defs_and_docs.sh', + 'codegen/Makefile.am', + 'codegen/extradefs/generate_extra_defs_skeleton.cc', + 'codegen/m4/convert.m4', + 'codegen/m4/convert_skeleton.m4', + 'codegen/m4/filelist.am', + 'doc/Makefile.am', + 'doc/reference/.gitignore', + 'doc/reference/Doxyfile.in', + 'examples/.gitignore', + 'examples/Makefile.am', + 'examples/example/example.cc', + 'skeleton/.gitignore', + 'skeleton/skeletonmm-uninstalled.pc.in', + 'skeleton/skeletonmm.h', + 'skeleton/skeletonmm.pc.in', + 'skeleton/skeletonmmconfig.h.in', + 'skeleton/skeletonmm/Makefile.am', + 'skeleton/skeletonmm/filelist.am', + 'skeleton/skeletonmm/wrap_init.h', + 'skeleton/skeletonmm/private/.gitignore', + 'skeleton/src/Makefile.am', + 'skeleton/src/filelist.am', + 'skeleton/src/skeleton.ccg', + 'skeleton/src/skeleton.defs', + 'skeleton/src/skeleton.hg', + 'skeleton/src/skeleton_docs.xml', + 'skeleton/src/skeleton_enum.defs', + 'skeleton/src/skeleton_method.defs', + 'skeleton/src/skeleton_signal.defs', + 'skeleton/src/skeleton_vfunc.defs', +] +skeletonmm_files = [] +foreach i : skeletonmm_basefiles + skeletonmm_files += join_paths('skeletonmm', i) +endforeach + +# tar and either xz or gzip are required for the skeletonmm.tar.[xz|gz] file. +tar = find_program('tar', required: true) +xz = find_program('xz', required: false) +if not xz.found() + gzip = find_program('gzip', required: true) +endif + +# Create tar archive of skeletonmm for installation. +tarball_filename = xz.found() ? 'skeletonmm.tar.xz' : 'skeletonmm.tar.gz' +custom_target(tarball_filename, + input: skeletonmm_files, + output: tarball_filename, + command: [ + files(join_paths('util', 'meson_aux', 'skeletonmm-tarball.sh')), + meson.current_source_dir(), + '@OUTPUT@', + skeletonmm_files, + ], + build_by_default: true, + install_dir: mm_common_docdir, + install: true +) +install_data('README', install_dir: mm_common_docdir) + +# Either curl or wget is required for downloading libstdc++.tag, +# used by Doxygen. +curl = find_program('curl', required: false) +if not curl.found() + wget = find_program('wget', required: true) +endif + +# Download libstdc++.tag if it does not exist or if it's out of date. +custom_target('libstdc++.tag', + output: 'libstdc++.tag', + command: [ + files(join_paths('util', 'meson_aux', 'libstdcxx-tag.sh')), + '@0@'.format(get_option('use-network')), # true or false + curl.found() ? 'curl' : 'wget', + join_paths(meson.current_source_dir(), 'doctags'), + '@OUTPUT@', + ], + build_by_default: true, + build_always_stale: true, + install_dir: mm_common_doctagsdir, + install: true +) + +# Modify the contents of the distribution directory. +meson.add_dist_script( + join_paths('util', 'meson_aux', 'extra-dist-cmd.sh'), + meson.current_source_dir(), + meson.current_build_dir(), + join_paths('meson-dist', meson.project_name() + '-' + meson.project_version()), +) + +# Print a summary. +summary = [ + '', + '------', + meson.project_name() + ' ' + meson.project_version(), + '', + ' Use network: @0@'.format(get_option('use-network')), + 'Directories:', + ' prefix: @0@'.format(mm_common_prefix), + ' bindir: @0@'.format(mm_common_bindir), + ' datadir: @0@'.format(mm_common_datadir), + ' docdir: @0@'.format(mm_common_docdir), + ' aclocal_macrodir: @0@'.format(mm_common_aclocal_macrodir), + ' pkgconfigdir: @0@'.format(mm_common_pkgconfigdir), + ' pkgdatadir: @0@'.format(mm_common_pkgdatadir), + ' build_supportdir: @0@'.format(mm_common_build_supportdir), + ' doctooldir: @0@'.format(mm_common_doctooldir), + ' doctagsdir: @0@'.format(mm_common_doctagsdir), + ' man1dir: @0@'.format(mm_common_man1dir), + '------' +] + +message('\n'.join(summary)) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..36e68be --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,2 @@ +option('use-network', type: 'boolean', value: false, + description : 'Download Doxygen tag file from the network') diff --git a/util/meson_aux/extra-dist-cmd.sh b/util/meson_aux/extra-dist-cmd.sh new file mode 100755 index 0000000..b73c1f4 --- /dev/null +++ b/util/meson_aux/extra-dist-cmd.sh @@ -0,0 +1,17 @@ +#!/bin/bash -e + +# External command, intended to be called with meson.add_dist_script() in meson.build + +# extra-dist-cmd.sh <root_source_dir> <root_build_dir> <relative_dist_dir> + +# relative_dist_dir is the distribution directory path relative to root_build_dir. +# Meson does not preserve timestamps on distributed files. +# But this script preserves the timestamps on libstdc++.tag. + +# 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' > "$2/$3/ChangeLog" + +# Distribute the libstdc++.tag file in addition to the files in the local git clone. +cd "$2" +cp --preserve=timestamps "libstdc++.tag" "$3/doctags/" diff --git a/util/meson_aux/extra-install-cmd.sh b/util/meson_aux/extra-install-cmd.sh new file mode 100755 index 0000000..79f44b0 --- /dev/null +++ b/util/meson_aux/extra-install-cmd.sh @@ -0,0 +1,25 @@ +#!/bin/bash -e + +# External command, intended to be called with meson.add_install_script() in meson.build + +# extra-install-cmd.sh <aclocal_macrodir> + +if [ -z "$DESTDIR" ]; then + # Inform the installer that M4 macro files installed in a directory + # not known to aclocal will not be picked up automatically. + acdir="$(aclocal --print-ac-dir 2>/dev/null || :)" + case ":$ACLOCAL_PATH:$acdir:" in + *":$1:"*) + ;; + *) + echo "NOTE" + echo "----" + echo "The mm-common Autoconf macro files have been installed in a different" + echo "directory than the system aclocal directory. In order for the installed" + echo "macros to be found, it may be necessary to add the mm-common include" + echo "path to the ACLOCAL_PATH environment variable:" + echo " ACLOCAL_PATH=\"\$ACLOCAL_PATH:$1\"" + echo " export ACLOCAL_PATH" + ;; + esac +fi diff --git a/util/meson_aux/libstdcxx-tag.sh b/util/meson_aux/libstdcxx-tag.sh new file mode 100755 index 0000000..73354a8 --- /dev/null +++ b/util/meson_aux/libstdcxx-tag.sh @@ -0,0 +1,39 @@ +#!/bin/bash -e + +# External command, intended to be called with custom_target() in meson.build + +# libstdcxx-tag.sh <use_network> <curl-or-wget> <srcdir> <output_path> + +output_dirname="$(dirname "$4")" +output_filename="$(basename "$4")" + +# Remote location of the GNU libstdc++ Doxygen tag file. +libstdcxx_tag_url="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/$output_filename" + +if [ "$1" != "true" ]; then + if [ -f "$4" ]; then + echo "Did not check status of $4 because network is disabled." + elif [ -f "$3/$output_filename" ]; then + echo "Warning: $4 does not exist." + echo "Copying from the source directory because network is disabled." + echo "If you want an up-to-date copy, reconfigure with the -Duse-network=true option." + cp --preserve=timestamps "$3/$output_filename" "$4" + else + echo "Error: $4 does not exist." >&2 + echo "Downloading it is not possible because network is disabled." >&2 + echo "Please reconfigure with the -Duse-network=true option." >&2 + exit 1 + fi +elif [ "$2" = "curl" ]; then + # These options don't contain filenames, and thus no spaces that + # must be preserved in the call to curl. + simple_curl_options="--compressed --connect-timeout 300 --globoff --location --max-time 3600 --remote-time --retry 5" + if [ -f "$4" ]; then + curl $simple_curl_options --time-cond "$4" --output "$4" "$libstdcxx_tag_url" + else + curl $simple_curl_options --output "$4" "$libstdcxx_tag_url" + fi +else + wget --timestamping --no-directories --timeout=300 --tries=5 \ + --directory-prefix="$output_dirname" "$libstdcxx_tag_url" +fi diff --git a/util/meson_aux/skeletonmm-tarball.sh b/util/meson_aux/skeletonmm-tarball.sh new file mode 100755 index 0000000..c36f126 --- /dev/null +++ b/util/meson_aux/skeletonmm-tarball.sh @@ -0,0 +1,25 @@ +#!/bin/bash -e + +# External command, intended to be called with custom_target() in meson.build + +# skeletonmm-tarball.sh <source_dir> <output_file> <input_files...> + +source_dir="$1" +output_file="$2" +shift; shift + +# These options don't contain filenames, and thus no spaces that +# must be preserved in the call to tar. +tar_options="--create --dereference --old-archive --file=-" + +case "$output_file" in + *.xz) + ( cd "$source_dir"; tar $tar_options "$@" ) | xz --to-stdout --extreme >"$output_file" + ;; + *.gz) + ( cd "$source_dir"; tar $tar_options "$@" ) | gzip --to-stdout --best --no-name >"$output_file" + ;; + *) echo "Error: Unknown filetype, $output_file" + exit 1 + ;; +esac diff --git a/util/mm-common-prepare.1.in b/util/mm-common-prepare.1.in index 7658031..a9ebd50 100644 --- a/util/mm-common-prepare.1.in +++ b/util/mm-common-prepare.1.in @@ -7,10 +7,10 @@ mm-common-prepare \- Prepare a C++ binding module to use mm-common .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 @@ -98,5 +98,7 @@ are listed below. .PP .I @docdir@/README .PP +.I @docdir@/skeletonmm.tar.xz or +.PP .I @docdir@/skeletonmm.tar.gz .PD |