[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] texinfo: info files can be generated in the builddir
From: |
Stefano Lattarini |
Subject: |
[PATCH 1/3] texinfo: info files can be generated in the builddir |
Date: |
Mon, 31 Dec 2012 11:02:48 +0100 |
User can now ask info files to be built in the $(builddir), rather than
the $(srcdir), by specifying the Automake option 'info-in-builddir'.
This feature was requested by the developers of GCC, GDB, GNU binutils
and the GNU bfd library. See the extensive discussion about automake
bug#11034 for more details.
OK, to be honest, having '.info' files built in the builddir was
*already* possible, but only using ugly and undocumented hacks involving
definition of the CLEANFILES and/or DISTCLEANFILES. For example, the
binutils project did something like this in the relevant 'Makefile.am':
# Automake 1.9 will only build info files in the objdir if they are
# mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
# though, so we use a bogus condition.
if GENINSRC_NEVER
DISTCLEANFILES = binutils.info
endif
See also the extensive discussion about automake bug#11034; in
particular, the following messages:
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11034#65>
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11034#80>
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11034#86>
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11034#101>
* lib/Automake/Options.pm (_is_valid_easy_option): Recognize the
new 'info-in-builddir' 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.
* t/txinfo-builddir.sh: New test.
* t/list-of-tests.mk: Add it.
Signed-off-by: Stefano Lattarini <address@hidden>
---
automake.in | 38 +++++++++------
lib/Automake/Options.pm | 1 +
t/list-of-tests.mk | 1 +
t/txinfo-builddir.sh | 127 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 152 insertions(+), 15 deletions(-)
create mode 100755 t/txinfo-builddir.sh
diff --git a/automake.in b/automake.in
index 3253f7f..b0d9f44 100644
--- a/automake.in
+++ b/automake.in
@@ -3253,23 +3253,31 @@ 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;
-
- my $soutdir = '$(srcdir)/' . $outdir;
- $outdir = $soutdir if $insrc;
+ # 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 'info-in-builddir' is given.
+ # This is done to allow the developers of GCC, GDB, GNU
+ # binutils and the GNU bfd library to force the '.info' files
+ # to be generated in the builddir rather than the srcdir, as
+ # was once done when the (now removed) '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 'info-in-builddir';
+
+ $outdir = '$(srcdir)/' . $outdir if $insrc;
# If user specified file_TEXINFOS, then use that as explicit
# dependency list.
@texi_deps = ();
- push (@texi_deps, "$soutdir$vtexi") if $vtexi;
+ push (@texi_deps, "$outdir$vtexi") if $vtexi;
my $canonical = canonicalize ($infobase);
if (var ($canonical . "_TEXINFOS"))
@@ -3323,8 +3331,8 @@ sub handle_texinfo_helper ($)
new Automake::Location,
TEXI => $texi,
VTI => $vti,
- STAMPVTI => "${soutdir}stamp-$vti",
- VTEXI => "$soutdir$vtexi",
+ STAMPVTI => "${outdir}stamp-$vti",
+ VTEXI => "$outdir$vtexi",
MDDIR => $conf_dir,
DIRSTAMP => $dirstamp);
}
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 186d4ca..98119fc 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -276,6 +276,7 @@ sub _is_valid_easy_option ($)
dist-tarZ
dist-xz
dist-zip
+ info-in-builddir
no-define
no-dependencies
no-dist
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index cd41e6a..b5ce4c3 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1183,6 +1183,7 @@ t/txinfo29.sh \
t/txinfo31.sh \
t/txinfo32.sh \
t/txinfo33.sh \
+t/txinfo-builddir.sh \
t/txinfo-no-clutter.sh \
t/txinfo-unrecognized-extension.sh \
t/transform.sh \
diff --git a/t/txinfo-builddir.sh b/t/txinfo-builddir.sh
new file mode 100755
index 0000000..148a1a6
--- /dev/null
+++ b/t/txinfo-builddir.sh
@@ -0,0 +1,127 @@
+#! /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 <http://www.gnu.org/licenses/>.
+
+# Check that info files are built in builddir when needed.
+# This test that this can be done through the so far undocumented
+# option 'info-in-builddir', as requested by at least GCC, GDB,
+# GNU binutils and the GNU bfd library. See automake bug#11034.
+
+required='makeinfo tex texi2dvi'
+. test-init.sh
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = info-in-builddir
+info_TEXINFOS = foo.texi subdir/bar.texi mu.texi
+subdir_bar_TEXINFOS = subdir/inc.texi
+CLEANFILES = mu.info
+
+# mu.info should not be rebuilt in the current directory, since
+# it's up-to-date in $(srcdir).
+# This can be caused by a subtle issue related to VPATH handling
+# of version.texi (see also the comment in texi-vers.am): because
+# stamp-vti is newer than version.texi, the 'version.texi: stamp-vti'
+# rule is always triggered. Still that's not a reason for 'make'
+# to think 'version.texi' has been created...
+check-local:
+ test ! -e mu.info
+ test -f ../mu.info
+END
+
+mkdir subdir
+
+cat > foo.texi << 'END'
+\input texinfo
address@hidden foo.info
address@hidden foo
address@hidden Top
+Hello walls.
address@hidden version.texi
address@hidden
+END
+
+cat > mu.texi << 'END'
+\input texinfo
address@hidden mu.info
address@hidden mu
address@hidden Top
+Mu mu mu.
address@hidden
+END
+
+cat > subdir/bar.texi << 'END'
+\input texinfo
address@hidden bar.info
address@hidden bar
address@hidden Top
+Hello walls.
address@hidden inc.texi
address@hidden
+END
+
+echo "I'm included." > subdir/inc.texi
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE info
+test -f foo.info
+test -f subdir/bar.info
+test -f mu.info
+test -f stamp-vti
+test -f version.texi
+test ! -e ../foo.info
+test ! -e ../subdir/bar.info
+test ! -e ../mu.info
+test ! -e ../stamp-vti
+test ! -e ../version.texi
+$MAKE clean
+test -f foo.info
+test -f subdir/bar.info
+test ! -e mu.info
+test -f stamp-vti
+test -f version.texi
+
+# Make sure stamp-vti is older that version.texi.
+# (A common situation in a real tree).
+$sleep
+touch stamp-vti
+
+$MAKE distcheck
+# Being distributed, this file should have been rebuilt.
+test -f mu.info
+
+$MAKE distclean
+test -f stamp-vti
+test -f version.texi
+test -f foo.info
+test -f subdir/bar.info
+test ! -e mu.info
+
+../configure
+$MAKE maintainer-clean
+test ! -e stamp-vti
+test ! -e version.texi
+test ! -e foo.info
+test ! -e subdir/bar.info
+test ! -e mu.info
+
+:
--
1.8.1.rc3.27.g3b73c7d