From 84a35aa0caddf31849bf70d1d561d33eed4b81ea Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Wed, 29 May 2019 09:28:05 +0200 Subject: Add support for building mm-common with meson mm-common can be built with either autotools or meson, but the files it installs and copies to other modules are only useful for modules that use autotools. --- util/meson_aux/extra-dist-cmd.sh | 17 ++++++++++++++++ util/meson_aux/extra-install-cmd.sh | 25 +++++++++++++++++++++++ util/meson_aux/libstdcxx-tag.sh | 39 ++++++++++++++++++++++++++++++++++++ util/meson_aux/skeletonmm-tarball.sh | 25 +++++++++++++++++++++++ util/mm-common-prepare.1.in | 20 +++++++++--------- 5 files changed, 117 insertions(+), 9 deletions(-) create mode 100755 util/meson_aux/extra-dist-cmd.sh create mode 100755 util/meson_aux/extra-install-cmd.sh create mode 100755 util/meson_aux/libstdcxx-tag.sh create mode 100755 util/meson_aux/skeletonmm-tarball.sh (limited to 'util') 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 + +# 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 + +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 + +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="$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 -- cgit v1.2.1