Subject: Re: bug#54063: automake cannot run without generated Texinfo manual

From: Mike Frysinger <[email-masked]>
Date: Thu, 24 Feb 2022 22:32:20 -0500

On 24 Feb 2022 11:19, Patrice Dumas wrote:
> On Thu, Feb 24, 2022 at 01:52:21AM -0500, Mike Frysinger wrote:
> > On 19 Feb 2022 15:03, Patrice Dumas wrote:
> > > In Texinfo, we have a texinfo manual which is automatically generated
> > > from Pod sections from Texinfo perl modules.  When this generated manual
> > > is removed, automake cannot run anymore.  To workaround this issue, we
> > > have a generation of a fake manual that contains only @setfilename manual.info 
> > > in the autogen.sh script that can be used to bootstrap some other
> > > autogenerated things, in particular Makefile fragments.  However, this
> > > is not practical, in particular if the generated manual is removed and
> > > the Makefile.am file is modified, one need to redo a fake manual in
> > > order to have things being ok again.
> > > 
> > > It seems to me that one way to avoid the issue would be if automake used
> > > only the texinfo manual name to construct the rules.  It would probably
> > > be a good thing to do irrespective of this issue, as @setfilename is not
> > > as important as it used to be, now it is fully optional, and we probably
> > > should consider as a best practice not to have @setfilename in Texinfo
> > > manuals.
> > > 
> > > The manual is in doc/tp_api in the texinfo sources, it is tp_api.texi.
> > 
> > automake already has some fallback logic if @setfilename isn't set -- it
> > uses the basename of the source file and changes .texi to .info.  but it
> > doesn't work if the file doesn't exist.  i think that should be easy to
> > support.
> > 
> > --- a/bin/automake.in
> > +++ b/bin/automake.in
> > @@ -3062,7 +3062,8 @@ sub scan_texinfo_file
> >  {
> >    my ($filename) = @_;
> >  
> > -  my $texi = new Automake::XFile "< $filename";
> > +  my $source = -e $filename ? $filename : "/dev/null";
> > +  my $texi = new Automake::XFile "< $source";
> >    verb "reading $filename";
> >  
> >    my ($outfile, $vfile);
> > 
> > if this is the only thing you need, then i won't think any harder about it.
> 
> I have not tested but it looks good (or a variation with the same effect
> if /dev/null is not portable).

automake already relies on redirecting to /dev/null, so shouldn't be an issue.

> The only issue I see is if after the
> file is generated the @setfilename is not the same as the file base name
> there will be errors.  I do not think that automake should support that
> setup, but maybe it would be good to state it in the documentation.
> Maybe something like:
> 
> "Texinfo files that are generated should have a basename matching
> @setfilename, if there is a @setfilename."

sounds reasonable, but i don't think this is a new issue.
-mike