Subject: bug#61186: closed (Re: bug#61186: build failure when building from git source in a subdirectory)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 30 Jan 2023 22:58:02 +0000

Your bug report

#61186: build failure when building from git source in a subdirectory

which was filed against the gzip package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
61186: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61186
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#61186: build failure when building from git source in a subdirectory
From: Paul Eggert <[email-masked]>
To: Bruno Haible <[email-masked]>
Cc: [email-masked]
Date: Mon, 30 Jan 2023 14:57:24 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I installed that.

Subject: build failure when building from git source in a subdirectory
From: Bruno Haible <[email-masked]>
To: [email-masked]
Date: Mon, 30 Jan 2023 22:28:57 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

When building gzip from the git repository in a subdirectory (VPATH build),
I get a build failure.

How to reproduce:

$ unset GNULIB_SRCDIR
$ git clone https://git.savannah.gnu.org/git/gzip.git
$ cd gzip
$ ./bootstrap
$ mkdir vpath
$ cd vpath
$ ../configure
$ make
$ make check
...
make[3]: Entering directory '/tmp/gzip/vpath'
  GEN      gzip.doc
  GEN      gzip.doc.gz
/bin/bash: line 1: ../gzip.doc: No such file or directory
make[3]: *** [Makefile:2435: gzip.doc.gz] Error 1
make[3]: Leaving directory '/tmp/gzip/vpath'

The problem is that while gzip.doc is expected to be in the source
directory (1. because it's in EXTRA_DIST, 2. see the check-local rule),
it's being generated in the build directory. The GNU Coding Standards
<https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>
make it clear that the file should be generated in the source directory.

The attached patch fixes it. I verified that "make distcheck" passes.

>From 4174578109c1ba545d1ec4c79ae4943aca85650a Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Mon, 30 Jan 2023 22:24:17 +0100
Subject: [PATCH] Fix "make check" in a subdirectory (VPATH build).

* Makefile.am (gzip.doc): Generate gzip.doc in the source directory, not in the
build directory.
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 25b2042..3a7dfea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,7 +86,7 @@ version.h: Makefile
 
 gzip.doc: gzip.1
 	$(AM_V_GEN)groff -man -Tascii $(srcdir)/gzip.1 | col -b | uniq > $@-t \
-	  && mv $@-t $@
+	  && mv $@-t $(srcdir)/gzip.doc
 
 gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
 	$(AM_V_GEN)./gzip < $(srcdir)/gzip.doc >$@-t && mv $@-t $@
-- 
2.34.1