Patrice Dumas wrote:
> Regarding the patch, the change related to ModulePath.pm is incorrect,
> ModulePath.pm should be in builddir and we do not distribute it.

Oops, you're right. My mistake.

> For the main change, your approach is correct, but it can also be done
> more simply without having to list and copy all the result files by
> changing the --subdir such that the files are only generated in srcdir.
> I attach a patch.

This is not complete.

1) With this patch, the main texi2any_internals.texi still is generated in the
build dir — which it shouldn't, since it is distributed.

Here is my procedure:
$ ./configure
$ make maintainer-clean
$ git diff -- doc/html_default_commands_args.texi doc/pod2texi.texi 
man/pod2texi.1 po_document/texinfo_document.pot 
tp/Texinfo/XS/gnulib/lib/unicase/special-casing-table.h 
tp/Texinfo/XS/gnulib/lib/uninorm/composition-table.h 
tp/Texinfo/XS/main/command_ids.h tp/Texinfo/XS/main/element_types.c 
tp/Texinfo/XS/main/element_types.h | patch -p1 -R
$ mkdir bb
$ cd bb
$ ../configure
$ make
$ make distclean
$ find . -type f
./texindex/texindex.awk
./doc/tp_api/texi2any_internals.texi

Find attached two patches, to generate these two distributed files in the
source directory. Tested.

Additionally, there is one more issue:

2) Texinfo/ModulePath.pm is no longer found in a particular situation
(not sure whether this situation is supported).

How to reproduce:

$ ./configure
$ make maintainer-clean
$ ./configure
$ make distcheck
...
make  distdir-am
make[4]: Entering directory '/TEXINFO/texinfo/doc'
Updating ./version.texi
Updating ./version-stnd.texi
Updating ./version-texi2any_api.texi
TEXINFO_DEV_SOURCE=1 top_srcdir=".." top_builddir=".." /usr/bin/perl -I 
../Pod-Simple-Texinfo/lib/ ../Pod-Simple-Texinfo/pod2texi.pl 
--base-level=subsubsection --no-section-nodes --headings-as-sections --subdir=. 
/TEXINFO/texinfo/Pod-Simple-Texinfo/pod2texi.pl > /dev/null
Can't locate Texinfo/ModulePath.pm in @INC (you may need to install the 
Texinfo::ModulePath module) (@INC contains: ../tp ../Pod-Simple-Texinfo/lib/ 
/etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 
/usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 
/usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base 
/usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34 
/usr/local/lib/site_perl) at ../Pod-Simple-Texinfo/pod2texi.pl line 75.
BEGIN failed--compilation aborted at ../Pod-Simple-Texinfo/pod2texi.pl line 112.
make[4]: *** [Makefile:2639: pod2texi.texi] Error 2
make[4]: Leaving directory '/TEXINFO/texinfo/doc'
make[3]: *** [Makefile:2347: distdir] Error 2
make[3]: Leaving directory '/TEXINFO/texinfo/doc'
make[2]: *** [Makefile:2031: distdir-am] Error 1
make[2]: Leaving directory '/TEXINFO/texinfo'
make[1]: *** [Makefile:2025: distdir] Error 2
make[1]: Leaving directory '/TEXINFO/texinfo'
make: *** [Makefile:2130: dist] Error 2

>From 0b47ecf06631f99bab63b4e1f857c8c483d69694 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 5 Aug 2024 19:01:40 +0200
Subject: [PATCH 1/2] build: Generate doc/tp_api/texi2any_internals.texi in the
 source directory.

* doc/tp_api/Makefile.am (texi2any_internals.texi): Move the generated
texi2any_internals.texi from the build dir to the source dir.
---
 doc/tp_api/Makefile.am | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/tp_api/Makefile.am b/doc/tp_api/Makefile.am
index fb3a48531a..0bba24acd3 100644
--- a/doc/tp_api/Makefile.am
+++ b/doc/tp_api/Makefile.am
@@ -84,8 +84,16 @@ $(top_builddir)/tp/Texinfo/ModulePath.pm:
 
 texi2any_internals.texi: $(texi2any_internals_dependencies) texi2any_internals_indices.texi texi2any_internals_preamble.texi $(top_builddir)/tp/Texinfo/ModulePath.pm
 	if $(MAKEINFO_ENVIRONMENT) $(PERL) -I $(top_srcdir)/Pod-Simple-Texinfo/lib/ $(top_srcdir)/Pod-Simple-Texinfo/pod2texi.pl --base-level=section --preamble - --subdir=$(srcdir)/api_includes $(texi2any_internals_dependencies) < $(srcdir)/texi2any_internals_preamble.texi >$@.tmp ; then \
-	  cat $@.tmp  | sed -e 's/^@bye/@__bye/' | sed -e '/^@__bye/r $(srcdir)/texi2any_internals_indices.texi' | sed -e 's/^@__bye//' > $@ ; \
-	fi ; rm -f $@.tmp
+	  cat $@.tmp  | sed -e 's/^@bye/@__bye/' | sed -e '/^@__bye/r $(srcdir)/texi2any_internals_indices.texi' | sed -e 's/^@__bye//' > texi2any_internals.texi ; \
+	  if test '$(srcdir)' != '.' ; then \
+	    if cmp texi2any_internals.texi $(srcdir)/texi2any_internals.texi >/dev/null 2>&1 ; then \
+	      rm -f texi2any_internals.texi ; \
+	    else \
+	      mv texi2any_internals.texi $(srcdir)/texi2any_internals.texi ; \
+	    fi ; \
+	  fi ; \
+	fi ; \
+	rm -f $@.tmp
 
 endif
 
-- 
2.34.1

>From a808812c4c3b10de6b7744dbe59265d4a30fec20 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 5 Aug 2024 19:01:50 +0200
Subject: [PATCH 2/2] build: Generate texindex/texindex.awk in the source
 directory.

* texindex/Makefile.am (texindex.awk): Move the generated texindex.awk
from the build dir to the source dir.
* man/Makefile.am (man/Makefile.am): Set environment variable TEXINDEX_SCRIPT,
so that the texindex program find its texindex.awk script.
---
 man/Makefile.am      | 5 ++++-
 texindex/Makefile.am | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/man/Makefile.am b/man/Makefile.am
index 6ff35bf204..779d193a02 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -96,7 +96,10 @@ $(srcdir)/makeinfo.1: $(tpdir)/texi2any.pl $(common_mandeps)
 	rm $@.tmp
 
 $(srcdir)/texindex.1: $(top_srcdir)/texindex/ti.twjr $(common_mandeps)
-	@name="sort Texinfo index files" && $(man_rule_bin)
+	@name="sort Texinfo index files" \
+	  && TEXINDEX_SCRIPT=$(top_srcdir)/texindex/texindex.awk \
+	  && export TEXINDEX_SCRIPT \
+	  && $(man_rule_bin)
 
 # 
 # For texi2dvi, do not depend on the current user's settings.
diff --git a/texindex/Makefile.am b/texindex/Makefile.am
index f378f46fcf..157455dcb3 100644
--- a/texindex/Makefile.am
+++ b/texindex/Makefile.am
@@ -54,7 +54,8 @@ texindex: texindex.in Makefile
 texindex.awk: ti.twjr
 	$(GAWK) -f $(srcdir)/jrtangle $(srcdir)/ti.twjr || rm -f texindex.awk
 	$(do_subst) <texindex.awk >texindex.awk-tmp
-	mv texindex.awk-tmp texindex.awk
+	rm -f texindex.awk
+	mv texindex.awk-tmp $(srcdir)/texindex.awk
 
 # how to build the pdf of the program-as-document.
 ti.pdf: ti.texi
-- 
2.34.1

Reply via email to