Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Miles Bader
Pedro Alves  writes:
>> OK, you've all made clear you have your sensible reasons to have the '.info'
>
> ...
>> it available only though the new, undocumented option named (literally)
>> "hack!info-in-builddir".  I hope this is acceptable to you.
> ...
>> *undocumented* option '!hack!info-in-builddir' (whose name should
>> made it clear that it is not meant for public consumption).
>
> So will this be called a hack forever, or will the naming be revisited
> before a release?  IMO, either the feature is sensible, and there doesn't
> seem to be a good reason other users couldn't also use it, and hence it
> should get a non-hackish name and be documented; or it isn't sensible, and
> then it shouldn't exist.  Why the second-class treatment?

I suspect there are better, cleaner, ways to accomplish the underlying
goal, but I suppose the gcc maintainers don't want to spend the time
fiddling around with their build infrastructure for such a minor
issue...

-miles

-- 
Alone, adj. In bad company.



Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Pedro Alves
On 04/03/2012 09:04 PM, Stefano Lattarini wrote:

> OK, you've all made clear you have your sensible reasons to have the '.info'

...
> it available only though the new, undocumented option named (literally)
> "hack!info-in-builddir".  I hope this is acceptable to you.
...
> *undocumented* option '!hack!info-in-builddir' (whose name should
> made it clear that it is not meant for public consumption).

So will this be called a hack forever, or will the naming be revisited
before a release?  IMO, either the feature is sensible, and there doesn't
seem to be a good reason other users couldn't also use it, and hence it
should get a non-hackish name and be documented; or it isn't sensible, and
then it shouldn't exist.  Why the second-class treatment?

-- 
Pedro Alves



Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Ian Lance Taylor
Stefano Lattarini  writes:

> But since I'm not yet ready to publish this new feature, I intend to make
> it available only though the new, undocumented option named (literally)
> "hack!info-in-builddir".  I hope this is acceptable to you.

Sure, works for me.

Thanks.

Ian



Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Tom Tromey
> "Stefano" == Stefano Lattarini  writes:

Stefano> On a second though, by double-checking the existing code, I
Stefano> couldn't see how the 'cygnus' option could possibly influence
Stefano> the location of the generated info files -- and it turned out
Stefano> it didn't!  Despite what was documented in the manual, the
Stefano> 'cygnus' option did *not* cause the generated '.info' files to
Stefano> be placed in the builddir (see attached test case).

It certainly does for me:

barimba. pwd
/home/tromey/gnu/baseline-gdb/build/binutils
barimba. grep '^srcdir = ' Makefile
srcdir = ../../src/binutils
barimba. find . -name 'binutils.info'
./doc/binutils.info
barimba. find ../../src/binutils -name 'binutils.info'
barimba.

How did you test it?
If you built from a distribution tar, then it is expected that the info
file would be in srcdir.

Tom



Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Stefano Lattarini
OK, you've all made clear you have your sensible reasons to have the '.info'
files generated in the builddir in your use cases.  Since the actual change
required by automake to allow this is very small and safe, I'm ready to do
it (see attached patch, which I will push in a couple of days to 'master' if
there is no objection).

But since I'm not yet ready to publish this new feature, I intend to make
it available only though the new, undocumented option named (literally)
"hack!info-in-builddir".  I hope this is acceptable to you.

Regards,
  Stefano
>From de715b44d25ad523b558d7321ce87bcf8c0cdb09 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Stefano Lattarini 
Date: Tue, 3 Apr 2012 22:02:55 +0200
Subject: [PATCH] texinfo: hack to allow '.info' files to be generated in the
 builddir

The possibility to force the '.info' files to be generated in the
builddir rather than the srcdir is requested by the developers of
GCC, GDB, GNU binutils and the GNU bfd library.  The lack of such
a possibility being the last obstacle to the removal of the support
for Cygnus-style trees (for which such a setup for '.info' files
generation was automatically implied).

So allow the developers to have the '.info' files to be generated
in the builddir rather than the srcdir, through the use of the new
*undocumented* option '!hack!info-in-builddir' (whose name should
made it clear that it is not meant for public consumption).

See also the extensive discussion about automake bug#11034.

* lib/Automake/Options.pm (_is_valid_easy_option): Recognize the
new option.
* automake.in (handle_texinfo_helper): If it's set, initialize
'$insrc' to '0', so that info files will be generated in the
builddir.  Adjust comments to match.
* tests/txinfo-builddir.test: New test.
* tests/list-of-tests.mk: Add it.

Signed-off-by: Stefano Lattarini 
---
 automake.in|   28 +++-
 lib/Automake/Options.pm|1 +
 tests/list-of-tests.mk |1 +
 tests/txinfo-builddir.test |   74 
 4 files changed, 95 insertions(+), 9 deletions(-)
 create mode 100755 tests/txinfo-builddir.test

diff --git a/automake.in b/automake.in
index f96e36b..b793a12 100644
--- a/automake.in
+++ b/automake.in
@@ -3278,15 +3278,25 @@ sub handle_texinfo_helper ($)
   # have a single variable ($INSRC) that controls whether
   # the current .info file must be built in the source tree
   # or in the build tree.  Actually this variable is switched
-  # off for .info files that appear to be cleaned; this is
-  # for backward compatibility with package such as Texinfo,
-  # which do things like
-  #   info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
-  #   DISTCLEANFILES = texinfo texinfo-* info*.info*
-  #   # Do not create info files for distribution.
-  #   dist-info:
-  # in order not to distribute .info files.
-  my $insrc = ($out_file =~ $user_cleaned_files) ? 0 : 1;
+  # off in two cases:
+  #  (1) For '.info' files that appear to be cleaned; this is for
+  #  backward compatibility with package such as Texinfo,
+  #  which do things like
+  #info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
+  #DISTCLEANFILES = texinfo texinfo-* info*.info*
+  ## Do not create info files for distribution.
+  #dist-info:
+  #  in order not to distribute .info files.
+  #  (2) When the undocumented option '!hack!info-in-builddir'
+  #  is given.  This is done to allow the developers of
+  #  GCC, GDB, GNU binutils and the GNU bfd library to force
+  #  force the '.info' files to be generated in the builddir
+  #  rather than the srcdir, as was once done when the (now
+  #  obsolete) 'cygnus' option was given.  See automake
+  #  bug#11034 for more discussion.
+  my $insrc = 1;
+  $insrc = 0 if $out_file =~ $user_cleaned_files;
+  $insrc = 0 if option '!hack!info-in-builddir';
 
   my $soutdir = '$(srcdir)/' . $outdir;
   $outdir = $soutdir if $insrc;
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 2f977bd..ee33837 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -267,6 +267,7 @@ sub _is_valid_easy_option ($)
 {
   my $opt = shift;
   return scalar grep { $opt eq $_ } qw(
+!hack!info-in-builddir
 check-news
 color-tests
 cygnus
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index de022a2..fa57ce5 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -1181,6 +1181,7 @@ txinfo31.test \
 txinfo32.test \
 txinfo33.test \
 txinfo-unrecognized-extension.test \
+txinfo-builddir.test \
 transform.test \
 transform2.test \
 transform3.test \
diff --git a/tests/txinfo-builddir.test b/tests/txinfo-builddir.test
new file mode 100755
index 000..64ca190
--- /dev/null
+++ b/tests/txinfo-builddir.test
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 2012 Fre

Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Stefano Lattarini
On 04/03/2012 10:05 PM, Stefano Lattarini wrote:
> On 04/03/2012 10:04 PM, Stefano Lattarini wrote:
>> OK, you've all made clear you have your sensible reasons to have the '.info'
>> files generated in the builddir in your use cases.  Since the actual change
>> required by automake to allow this is very small and safe, I'm ready to do
>> it (see attached patch, which I will push in a couple of days to 'master' if
>> there is no objection).
>>
>> But since I'm not yet ready to publish this new feature, I intend to make
>> it available only though the new, undocumented option named (literally)
>> "hack!info-in-builddir".  I hope this is acceptable to you.
>>
On a second though, by double-checking the existing code, I couldn't see how
the 'cygnus' option could possibly influence the location of the generated
info files -- and it turned out it didn't!  Despite what was documented in
the manual, the 'cygnus' option did *not* cause the generated '.info' files
to be placed in the builddir (see attached test case).  This is true for at
least for automake 1.9.6, 1.10.3, 1.11.1, 1.11.4, and automake built from
the master branch (I've checked them all).  Since nobody ever complained
about such a breakage, I conclude that the feature was not truly needed, and
I'm thus withdrawing my previous patch.

Regards,
  Stefano
#! /bin/sh
# Copyright (C) 2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .

# The cygnus option do not really cause the '.info' files to be
# generated in the builddir!

required=makeinfo
. ./defs || Exit 1

cat >> configure.ac < Makefile.am << 'END'
AUTOMAKE_OPTIONS = cygnus -Wno-override
info_TEXINFOS = foo.texi
END

cat > foo.texi << 'END'
\input texinfo
@setfilename foo.info
@settitle foo
@node Top
Hello walls.
@bye
END

$ACLOCAL
$AUTOMAKE --add-missing
$AUTOCONF

mkdir build
cd build
../configure
$MAKE info
ls -l . ..
test -f foo.info
test ! -f ../foo.info

:


Re: bug#11034: Binutils, GDB, GCC and Automake's 'cygnus' option

2012-04-03 Thread Stefano Lattarini
On 04/03/2012 10:04 PM, Stefano Lattarini wrote:
> OK, you've all made clear you have your sensible reasons to have the '.info'
> files generated in the builddir in your use cases.  Since the actual change
> required by automake to allow this is very small and safe, I'm ready to do
> it (see attached patch, which I will push in a couple of days to 'master' if
> there is no objection).
> 
> But since I'm not yet ready to publish this new feature, I intend to make
> it available only though the new, undocumented option named (literally)
> "hack!info-in-builddir".  I hope this is acceptable to you.
> 
Oops, with this squashed in:

  diff --git a/tests/txinfo-builddir.test b/tests/txinfo-builddir.test
  index 64ca190..a09af80 100755
  --- a/tests/txinfo-builddir.test
  +++ b/tests/txinfo-builddir.test
  @@ -27,7 +27,7 @@ required=makeinfo
   echo AC_OUTPUT >> configure.ac

   cat > Makefile.am << 'END'
  -AUTOMAKE_OPTIONS = cygnus ##!hack!info-in-builddir
  +AUTOMAKE_OPTIONS = !hack!info-in-builddir
   info_TEXINFOS = foo.texi subdir/bar.texi
   subdir_bar_TEXINFOS = subdir/inc.texi
   END

Sorry for the noise,
  Stefano