Hi.  I noticed that the Makefile.am dist-hook snippet for
gitlog-to-changelog doesn't work if you happen to run 'make dist' in a
srcdir!=builddir setup.

I wish that some of snippets in the manual could be stored in a file
that I can 'include' from Makefile.am instead having to fix this
manually in each Makefile.am I copied this into...  but this doc fix is
a start.

/Simon
From bce825d7815edb5e17f3ba696128b90e519a1c1c Mon Sep 17 00:00:00 2001
From: Simon Josefsson <si...@josefsson.org>
Date: Fri, 27 Dec 2024 00:33:36 +0100
Subject: [PATCH] gitlog-to-changelog: Handle srcdir!=builddir builds.

* doc/gitlog-to-changelog.texi (dist-hook): Use --srcdir.
---
 doc/gitlog-to-changelog.texi | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/doc/gitlog-to-changelog.texi b/doc/gitlog-to-changelog.texi
index b4ec58b76a..c4bad5db47 100644
--- a/doc/gitlog-to-changelog.texi
+++ b/doc/gitlog-to-changelog.texi
@@ -29,10 +29,10 @@ top-level @file{Makefile.am} like this:
 dist-hook: gen-ChangeLog
 .PHONY: gen-ChangeLog
 gen-ChangeLog:
-        $(AM_V_GEN)if test -e .git; then                       \
+        $(AM_V_GEN)if test -e $(srcdir)/.git; then             \
           LC_ALL=en_US.UTF-8 TZ=UTC0                           \
             $(top_srcdir)/build-aux/gitlog-to-changelog        \
-              > $(distdir)/ChangeLog.tmp &&                    \
+              --srcdir=$(srcdir) > $(distdir)/ChangeLog.tmp && \
           mv -f $(distdir)/ChangeLog.tmp $(distdir)/ChangeLog; \
         fi
 @end example
@@ -52,9 +52,10 @@ time zone each individual commit was made in you can use the
 dist-hook: gen-ChangeLog
 .PHONY: gen-ChangeLog
 gen-ChangeLog:
-        $(AM_V_GEN)if test -e .git; then                       \
+        $(AM_V_GEN)if test -e $(srcdir)/.git; then             \
           $(top_srcdir)/build-aux/gitlog-to-changelog          \
-            --commit-timezone > $(distdir)/ChangeLog.tmp &&    \
+              --srcdir=$(srcdir) --commit-timezone             \
+              > $(distdir)/ChangeLog.tmp &&                    \
           mv -f $(distdir)/ChangeLog.tmp $(distdir)/ChangeLog; \
         fi
 @end example
@@ -89,13 +90,14 @@ use a @code{gen-ChangeLog} rule like the following:
 @example
 gen_start_ver = 8.31
 gen-ChangeLog:
-        $(AM_V_GEN)if test -e .git; then                           \
+        $(AM_V_GEN)if test -e $(srcdir)/.git; then                 \
           log_fix='$(srcdir)/build-aux/git-log-fix';               \
           test -e "$$log_fix"                                      \
             && amend_git_log=--amend=$$log_fix                     \
             || amend_git_log=;                                     \
           @{ LC_ALL=en_US.UTF-8 TZ=UTC0                             \
               $(top_srcdir)/build-aux/gitlog-to-changelog          \
+                --srcdir=$(srcdir)                                 \
                 "$$amend_git_log" -- 'v$(gen_start_ver)~..' &&     \
             printf '\n\nSee the source repo for older entries.\n'; \
           @} > $(distdir)/ChangeLog.tmp &&                          \
-- 
2.46.0

Attachment: signature.asc
Description: PGP signature

  • [PATCH] gitlog-to-changelog: Ha... Simon Josefsson via Gnulib discussion list

Reply via email to