public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Simon Marchi <simark@simark.ca>, Eli Zaretskii <eliz@gnu.org>,
	gdb-patches@sourceware.org,
	Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH] gdb/doc: use silent-rules.mk in the Makefile
Date: Sun, 26 May 2024 23:58:35 +0100	[thread overview]
Message-ID: <87zfsc9o4k.fsf@redhat.com> (raw)
In-Reply-To: <8734q4b5an.fsf@redhat.com>


First, massive apologies for blocking the release!

I think the patch below should fix this issue.  I've tried to explain
myself in the commit message, so I'll not repeat it again here.

I'm not actually at work for the next couple of days.  I'll try to check
for feedback on this each evening so I can respond to feedback and/or
merge this, but apologies if I'm a little slow in replying.

If the feedback is positive and someone wants to merge this, feel free.

Anyway, let me know what you think.

Thanks,
Andrew

---

commit bd4ee411ce843be8c32c660b1d1f56ff7f275286
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Sun May 26 23:30:37 2024 +0100

    gdb/doc: don't have .pod targets separate to man page targets
    
    While preparing the new release it was discovered that commit:
    
      commit 824083f34c222aa7419e2ea58e82d6f230d5f531
      Date:   Fri Apr 12 17:47:20 2024 +0100
    
          gdb/doc: use silent-rules.mk in the Makefile
    
    was causing problems.  Given a release tar file, an attempt to build
    and install GDB would give an error like this:
    
      [...]
        TEXI2POD gdb.pod
      cannot find GDBvn.texi at ../../../gdb-15.0.50.20240508/gdb/doc/../../etc/texi2pod.pl line 251, <GEN0> line 16.
      make[5]: *** [Makefile:663: gdb.pod] Error 2
    
    The problem here is how the man pages are built, and how they are
    distributed within a release.
    
    Within the development (git) tree, the man page files are not part of
    the source tree, these files are built as needed.  Within a release
    tar file though, the man pages are included.  The idea being that a
    user can build and install GDB, including getting the man pages,
    without having to install the tools needed to generate the man pages.
    
    The man pages are generated in a two step process.  First the .texi
    file is processed with texi2pod to create a .pod file, then this .pod
    file is processed to create the .1 or .5 man file.
    
    Prior to the above commit these two steps were combined into a single
    recipe, this meant that when a user performed a build/install from a
    release tree all of the dependencies, as well as the final result,
    were all present in the source tree, and so nothing needed to be
    rebuilt.
    
    However, the above commit split the two steps apart.  Now we had a
    separate rule for building the .pod files, and the .1/.5 man page
    files depended on the relevant .pod file.
    
    As the .pod files are not shipped in a GDB release, this meant that
    one of the dependencies of the man page files was now missing.  As a
    result if a user tried to install from a release tree a rebuild of the
    .pod files would be attempted, and if that succeeded then building the
    man pages would follow that.
    
    Unfortunately, building the .pod files would fail as the GDBvn.texi
    file, though present in the source tree, was not present in the build
    tree, which is where it is needed for the .pod file generation to
    work.
    
    To fix this, I propose merging the .pod creation and the .1/.5 man
    page creation back into a single recipe.  Having these two steps split
    is probably the "cleaner" solution, but makes it harder for us to
    achieve our goal of shipping the prebuilt man page files.  I've added
    a comment explaining what's going on (such a comment would have
    prevented this mistake having been made in the first place).
    
    One possibly weird thing here is that I have left both an
    ECHO_TEXI2POD and a ECHO_TEXI2MAN in the rule $(MAN1S) and $(MAN5S)
    recipes.  This is 100% not going to break anything, these just print
    two different progress messages while executing the recipes, but I'm
    not sure if this is considered poor style or not.  Maybe we're only
    supposed to have a single ECHO_* per recipe?
    
    Anyway, even if this is poor style, I figure it really is just a style
    thing.  We can tweak this later as needed.  Otherwise, this commit
    should fix the current issue blocking the next GDB release.

diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index 3f3fe7b7ed9..6a112b98d0e 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -658,17 +658,30 @@ annotate/index.html: $(ANNOTATE_DOC_FILES)
 		-I $(srcdir) \
 		$(srcdir)/annotate.texinfo
 
-# Man pages
-%.pod : gdb.texinfo $(GDB_DOC_FILES)
-	$(ECHO_TEXI2POD) $(TEXI2POD) $(MANCONF) -D$* < $(srcdir)/gdb.texinfo > $@
-
-$(MAN1S) : %.1 : %.pod $(GDB_DOC_FILES)
+# Man pages.  The TEXI2POD and TEXI2MAN steps are performed within a
+# single recipe to support how we distribute GDB releases.  A release
+# includes the .1 and .5 man pages in the source tree, but not the
+# .pod files.
+#
+# When building and installing a release of GDB it should not be
+# necessary to rebuild the .1 or .5 man page files, nor should it be
+# necessary to rebuild the .pod files.
+#
+# If we split the .pod creation from the creation of the .1 and .5
+# pages, then the .pod files must become a dependency, this will
+# trigger an attempt to rebuild these files while building and
+# installing a release of GDB, which is something we don't want.
+$(MAN1S) : %.1 : $(GDB_DOC_FILES)
+	$(ECHO_TEXI2POD) $(TEXI2POD) $(MANCONF) -D$* < $(srcdir)/gdb.texinfo > $*.pod
 	$(ECHO_TEXI2MAN) ($(POD2MAN1) $*.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
+	$(SILENCE) rm -f $*.pod
 
-$(MAN5S) : %.5 : %.pod $(GDB_DOC_FILES)
+$(MAN5S) : %.5 : $(GDB_DOC_FILES)
+	$(ECHO_TEXI2POD) $(TEXI2POD) $(MANCONF) -D$* < $(srcdir)/gdb.texinfo > $*.pod
 	$(ECHO_TEXI2MAN) ($(POD2MAN1) $*.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
+	$(SILENCE) rm -f $*.pod
 
 force:
 


  reply	other threads:[~2024-05-26 22:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 17:00 Andrew Burgess
2024-04-12 18:31 ` Eli Zaretskii
2024-04-12 22:32   ` Andrew Burgess
2024-04-13  7:02     ` Eli Zaretskii
2024-04-15 13:55       ` Andrew Burgess
2024-04-15 14:18         ` Simon Marchi
2024-04-16  7:48           ` Andrew Burgess
2024-04-16  8:47             ` Andrew Burgess
2024-04-16 15:01               ` Simon Marchi
2024-04-17 21:00                 ` Andrew Burgess
2024-05-08 17:46                   ` Andrew Burgess
2024-05-26 18:20                     ` Joel Brobecker
2024-05-26 22:02                       ` Andrew Burgess
2024-05-26 22:58                         ` Andrew Burgess [this message]
2024-05-28 15:25                           ` Tom Tromey
2024-04-15 14:37         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfsc9o4k.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).