dist-hook:
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
+ ${AM_V_GEN}echo $(COPYRIGHT_YEAR) > $(distdir)/.year
today = $(shell date +%Y-%m-%d)
version_regexp = $(subst .,\.,$(VERSION))
[strace-devel@lists.sourceforge.net],
[strace],
[https://strace.io])
-AC_COPYRIGHT([Copyright (C) 1999-2017 The strace developers.])
+m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year]))
+AC_COPYRIGHT([Copyright (C) 1999-]copyright_year[ The strace developers.])
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AC_USE_SYSTEM_EXTENSIONS
AX_CODE_COVERAGE
+AC_DEFINE([COPYRIGHT_YEAR], "[copyright_year]", [Current copyright year.])
+AC_SUBST([COPYRIGHT_YEAR], [copyright_year])
+
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
--- /dev/null
+#! /bin/sh
+
+: ${YEAR_FILE:=$1}
+: ${DEFAULT_YEAR:=$2}
+
+year=
+
+[ -n "${YEAR_FILE}" ] || {
+ echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
+ exit 1
+}
+
+[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
+
+[ -n "${year}" ] ||
+ year="$(git show --format=format:%cd --no-patch --date=format:%Y)"
+
+[ -n "${year}" ] || year="${DEFAULT_YEAR}"
+
+[ -n "${year}" ] || year="$(date "+%Y")"
+
+[ -n "${year}" ] || {
+ echo >&2 'Undefined year.'
+ exit 1
+}
+
+printf "%s" "${year}"
print_version(void)
{
printf("%s -- version %s\n"
- "Copyright (C) %s The strace developers <%s>.\n"
+ "Copyright (C) 1991-%s The strace developers <%s>.\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
- PACKAGE_NAME, PACKAGE_VERSION, "1991-2017", PACKAGE_URL);
+ PACKAGE_NAME, PACKAGE_VERSION, COPYRIGHT_YEAR, PACKAGE_URL);
}
static void
%prep
%setup -q
echo -n %version-%release > .tarball-version
+echo -n @COPYRIGHT_YEAR@ > .year
%build
echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
../../config.h
}
+config_year=$(getval COPYRIGHT_YEAR)
+
+[ "$year" -ge "$config_year" ] && [ "$config_year" -ge 2017 ] || {
+ echo >&2 "The year derived from config.h (${config_year}) does not pass sanity checks."
+ exit 1
+}
+
cat > "$EXP" << __EOF__
$(getval PACKAGE_NAME) -- version $(getval PACKAGE_VERSION)
-Copyright (C) 1991-$year The strace developers <$(getval PACKAGE_URL)>.
+Copyright (C) 1991-${config_year} The strace developers <$(getval PACKAGE_URL)>.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
__EOF__