summaryrefslogtreecommitdiffstats
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/autotest.am9
-rwxr-xr-xbuild-aux/config.rpath6
-rwxr-xr-xbuild-aux/get-vcs-id49
-rw-r--r--build-aux/subst.am52
-rw-r--r--build-aux/tap.am4
-rwxr-xr-xbuild-aux/test-runner9
6 files changed, 100 insertions, 29 deletions
diff --git a/build-aux/autotest.am b/build-aux/autotest.am
index a4bb8ea..19054c5 100644
--- a/build-aux/autotest.am
+++ b/build-aux/autotest.am
@@ -4,6 +4,15 @@ DISTCLEANFILES += at/atconfig
AUTOTEST_DEPS = at/atconfig at/atlocal $(TESTSUITE)
+TEST_VERBOSE ?= 0
+TEST_PARALLEL ?= 1
+
+TEST_VERBOSE_OPT = $(TEST_VERBOSE:0=)
+
+TESTSUITEFLAGS =
+TESTSUITEFLAGS += -j$(TEST_PARALLEL)
+TESTSUITEFLAGS += $(TEST_VERBOSE_OPT:1=--verbose)
+
# The ":;" works around a Bash 3.2 bug when the output is not writable.
$(srcdir)/at/package.m4: $(top_srcdir)/configure.ac
:;{ \
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 24be79c..3893ddd 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -2,7 +2,7 @@
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
-# Copyright 1996-2020 Free Software Foundation, Inc.
+# Copyright 1996-2024 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
@@ -371,7 +371,7 @@ else
hardcode_direct=yes
hardcode_minus_L=yes
;;
- freebsd* | dragonfly*)
+ freebsd* | dragonfly* | midnightbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
@@ -547,7 +547,7 @@ case "$host_os" in
freebsd[23].*)
library_names_spec='$libname$shrext$versuffix'
;;
- freebsd* | dragonfly*)
+ freebsd* | dragonfly* | midnightbsd*)
library_names_spec='$libname$shrext'
;;
gnu*)
diff --git a/build-aux/get-vcs-id b/build-aux/get-vcs-id
new file mode 100755
index 0000000..cca511a
--- /dev/null
+++ b/build-aux/get-vcs-id
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# get-vcs-id
+#
+# Copyright © 2009-2024 Guillem Jover <guillem@debian.org>
+#
+# This program 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.
+#
+# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+#
+
+error()
+{
+ echo "get-vcs-id: error: $*" 1>&2
+ exit 1
+}
+
+if [ -f .dist-vcs-id ]; then
+ # Get the VCS id from the file distributed in the tarball.
+ id="$(cat .dist-vcs-id)"
+elif [ -d .git ] || [ -f .git ]; then
+ if ! command -v git >/dev/null; then
+ error "cannot get project VCS id, git checkout but git program not found"
+ fi
+
+ # Get the VCS id from the git repository.
+ id="$(git rev-list -1 HEAD 2>/dev/null)"
+
+ # Check if we are on a dirty checkout.
+ git update-index --refresh -q >/dev/null
+ dirty=$(git diff-index --name-only HEAD 2>/dev/null)
+ if [ -n "$dirty" ]; then
+ id="$id-dirty"
+ fi
+else
+ error "cannot get project VCS id, not a git checkout nor a distribution tarball."
+fi
+
+# Use printf to avoid the trailing new line that m4_esyscmd would not handle.
+printf "%s" "$id"
diff --git a/build-aux/subst.am b/build-aux/subst.am
index 5515930..9c96e5c 100644
--- a/build-aux/subst.am
+++ b/build-aux/subst.am
@@ -4,44 +4,44 @@
# Shell support.
-do_shell_subst = $(AM_V_GEN) $(SED) \
- -e "s:^ADMINDIR=.*$$:ADMINDIR='$(admindir)':" \
- -e "s:^BACKUPSDIR=.*$$:BACKUPSDIR='$(backupsdir)':" \
- -e "s:^PKGDATADIR_DEFAULT=.*$$:PKGDATADIR_DEFAULT='$(pkgdatadir)':" \
- -e "s:^version=['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":" \
- -e "s:^TAR=.*$$:TAR='$(TAR)':" \
- # EOL
+subst_shell_rules = "\
+ s{^ADMINDIR=.*$$}{ADMINDIR='$(admindir)'}; \
+ s{^BACKUPSDIR=.*$$}{BACKUPSDIR='$(backupsdir)'}; \
+ s{^PKGDATADIR_DEFAULT=.*$$}{PKGDATADIR_DEFAULT='$(pkgdatadir)'}; \
+ s{^version=['\"][^'\"]*[\"']}{version=\"$(PACKAGE_VERSION)\"}; \
+ s{^TAR=.*$$}{TAR='$(TAR)'}; \
+ "
+
+subst_shell_filter = $(PERL) -p -e $(subst_shell_rules)
+subst_shell_file = $(PERL) -i -p -e $(shell_subst_rules)
SUFFIXES += .sh
.sh: Makefile
@test -d `dirname $@` || $(MKDIR_P) `dirname $@`
- $(do_shell_subst) <$< >$@
+ $(AM_V_GEN) $(subst_shell_filter) <$< >$@
$(AM_V_at) chmod +x $@
# Perl support.
-do_perl_subst = $(AM_V_GEN) $(SED) \
- -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
- -e "s:our \$$CONFDIR = .*;:our \$$CONFDIR = '$(pkgconfdir)';:" \
- -e "s:our \$$ADMINDIR = .*;:our \$$ADMINDIR = '$(admindir)';:" \
- -e "s:our \$$LIBDIR = .*;:our \$$LIBDIR = '$(pkglibexecdir)';:" \
- -e "s:our \$$DATADIR = .*;:our \$$DATADIR = '$(pkgdatadir)';:" \
- -e "s:our \$$PROGMAKE = .*;:our \$$PROGMAKE = '$(MAKE)';:" \
- -e "s:our \$$PROGTAR = .*;:our \$$PROGTAR = '$(TAR)';:" \
- -e "s:our \$$PROGPATCH = .*;:our \$$PROGPATCH = '$(PATCH)';:" \
- -e "s:our \$$PROGVERSION = .*;:our \$$PROGVERSION = '$(PACKAGE_VERSION)';:" \
- # EOL
+subst_perl_rules = "\
+ s{^\#!\s*/usr/bin/perl}{\#!$(PERL)}; \
+ s{our \\\$$CONFDIR = .*;}{our \\\$$CONFDIR = '$(pkgconfdir)';}; \
+ s{our \\\$$ADMINDIR = .*;}{our \\\$$ADMINDIR = '$(admindir)';}; \
+ s{our \\\$$LIBDIR = .*;}{our \\\$$LIBDIR = '$(pkglibexecdir)';}; \
+ s{our \\\$$DATADIR = .*;}{our \\\$$DATADIR = '$(pkgdatadir)';}; \
+ s{our \\\$$PROGMAKE = .*;}{our \\\$$PROGMAKE = '$(MAKE)';}; \
+ s{our \\\$$PROGTAR = .*;}{our \\\$$PROGTAR = '$(TAR)';}; \
+ s{our \\\$$PROGPATCH = .*;}{our \\\$$PROGPATCH = '$(PATCH)';}; \
+ s{our \\\$$PROGVERSION = .*;}{our \\\$$PROGVERSION = '$(PACKAGE_VERSION)';}; \
+ "
+
+subst_perl_filter = $(PERL) -p -e $(subst_perl_rules)
+subst_perl_file = $(PERL) -i -p -e $(subst_perl_rules)
SUFFIXES += .pl
.pl: Makefile
@test -d `dirname $@` || $(MKDIR_P) `dirname $@`
- $(do_perl_subst) <$< >$@
+ $(AM_V_GEN) $(subst_perl_filter) <$< >$@
$(AM_V_at) chmod +x $@
-
-# Makefile support.
-
-do_make_subst = $(AM_V_GEN) $(SED) \
- -e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):" \
- # EOL
diff --git a/build-aux/tap.am b/build-aux/tap.am
index 9ec8de6..f05d4ba 100644
--- a/build-aux/tap.am
+++ b/build-aux/tap.am
@@ -18,6 +18,10 @@ tap-clean:
tap-check: $(test_data) $(test_programs) $(test_scripts)
[ -z "$(test_tmpdir)" ] || $(MKDIR_P) $(test_tmpdir)
$(TEST_ENV_VARS) \
+ TEST_PARALLEL=$(TEST_PARALLEL) \
+ TEST_VERBOSE=$(TEST_VERBOSE) \
+ abs_srcdir=$(abs_srcdir) \
+ abs_builddir=$(abs_builddir) \
abs_top_srcdir=$(abs_top_srcdir) \
abs_top_builddir=$(abs_top_builddir) \
srcdir=$(srcdir) builddir=$(builddir) \
diff --git a/build-aux/test-runner b/build-aux/test-runner
index 73c33fb..d73369b 100755
--- a/build-aux/test-runner
+++ b/build-aux/test-runner
@@ -13,6 +13,14 @@ $ENV{LC_ALL} = 'C';
$ENV{DPKG_COLORS} = 'never';
$ENV{PATH} = "$binroot/src:$binroot/scripts:$binroot/utils:$ENV{PATH}";
+my %options;
+# XXX: We need force the file formatter to workaround verbose + parallel
+# not working correctly, as the console formatter eats the test output,
+# see <https://github.com/Perl-Toolchain-Gang/Test-Harness/issues/105>.
+if ($ENV{TEST_VERBOSE} && $ENV{TEST_PARALLEL} > 1) {
+ $options{formatter_class} = 'TAP::Formatter::File';
+}
+
my $harness = TAP::Harness->new({
exec => sub {
my (undef, $test) = @_;
@@ -27,6 +35,7 @@ my $harness = TAP::Harness->new({
verbosity => $ENV{TEST_VERBOSE},
jobs => $ENV{TEST_PARALLEL},
failures => 1,
+ %options,
});
my $aggregate = $harness->runtests(@ARGV);