[PATCH util-macros 1/2] Add XORG_AUTHORS macro to generate a list of authors from git

Gaetan Nadon memsize at videotron.ca
Thu Apr 3 09:52:36 PDT 2014


The macro generates a list of authors and creates the AUTHORS file in the
module root directory.

The AUTHORS_CMD is based on the ChangeLog command. A test for the git
directory has been added so the 'git log' command is not invoked when we know
that git is not reachable.

The make targets for testing:
    make AUTHORS
    make dist
    make distcheck
Testing should be done from both a git module and a tarball.

The git "shortlog" command has been tried but it does not work when invoked
inside the Makefile. Looking at several projects on the web, they all use
the git log command.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 xorg-macros.m4.in |    1 +
 xorgversion.m4    |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index f160a40..20b999e 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1807,6 +1807,7 @@ XORG_STRICT_OPTION
 XORG_RELEASE_VERSION
 XORG_CHANGELOG
 XORG_INSTALL
+XORG_AUTHORS
 XORG_MANPAGE_SECTIONS
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
     [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
diff --git a/xorgversion.m4 b/xorgversion.m4
index 19f2ffd..6393100 100644
--- a/xorgversion.m4
+++ b/xorgversion.m4
@@ -62,3 +62,19 @@ mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
 echo 'git directory not found: installing possibly empty changelog.' >&2)"
 AC_SUBST([CHANGELOG_CMD])
 ]) # XORG_CHANGELOG
+
+# XORG_AUTHORS()
+# --------------
+# Minimum version: 1.20.0
+#
+# Defines the variable AUTHORS_CMD as the command to generate
+# AUTHORS from git.
+#
+#
+AC_DEFUN([XORG_AUTHORS], [
+AUTHORS_CMD="(GIT_DIR=\$(top_srcdir)/.git test -d \$(top_srcdir)/.git && git log --format='%aN' | sort -u > \$(top_srcdir)/.authors.tmp && \
+mv \$(top_srcdir)/.authors.tmp \$(top_srcdir)/AUTHORS) \
+|| (rm -f \$(top_srcdir)/.authors.tmp; touch \$(top_srcdir)/AUTHORS; \
+echo 'git directory not found: installing possibly empty AUTHORS.' >&2)"
+AC_SUBST([AUTHORS_CMD])
+]) # XORG_AUTHORS
-- 
1.7.9.5



More information about the xorg-devel mailing list