[PATCH] Fix move-if-change for VPATH builds

Dmitry Shatrov shatrov@gmail.com
Sat Dec 22 22:12:00 GMT 2007


Hello, binutils list!

I'm proposing a patch that fixes a problem I've had with building
binutils-2.18. Building binutils-2.18 fails under the following
conditions:
1. makeinfo is not installed
2. binutils are built in an external directory "binutils-build"

I am building it from an external directory because the "Linux From
Scratch" book says that it is a recommended way of building binutils.

The build is failing because in binutils-2.18.tar.bz2 the timestamp of
bfd/elf.c is greater than the timestamp of bfd/doc/elf.texi, so elf.texi
is treated as requiring reubilding. As the result, bfd/doc/elf.texi gets
reextracted from bfd/elf.c, and its timestamp becomes greater than the
timestamp of bfd.texinfo. Building the latter fails, because makeinfo is
missing.

This problem doesn't get triggered when building from the directory
where binutils is unpacked, because there is the "move-if-change" script
which determines that the newly extracted elf.tmp is actually the same
as the present elf.texi, and thus the timestamp of elf.texi doesn't get
changed. It turns out that the "move-if-change" script in its current
form is inappropriate for VPATH builds: it doesn't break anything, but
also doesn't help in situations it is meant to help.

What I suggest is making "move-if-change" aware of the directory where
building is performed by passing "$(srcdir)" to it as the first
argument. The only change in the algorithm is adding the following rule:
"If the destination file "dstfile" is the same as the source file and
the destination file doesn't exist in the current directory, then create
a symbolic link "dstfile" pointing to "$(srcdir)/dstfile".

The rest of the patch is about making all invocations of
"move-if-change" to supply "$(srcdir)" as the first argument.

The patch is against current binutils from CVS.

I've tested it for a while, with both texinfo installed and removed, for
VPATH and non-VPATH builds, and for different combinations of timestamps
on corresponding ".c", ".texi" and ".info" files, and it seems to work
fine.

The patch includes changes to several "configure.ac" and "Makefile.am"
files, but I didn't update corresponding "configure" and "Makefile.in"
files before diff'ing, so autoconf and automake have to be invoked in
all directories with the changed files after applying the patch.

Wbr,
Dmitry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils_move-if-changed_vpath.patch
Type: text/x-patch
Size: 21347 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20071222/bba5af48/attachment.bin>


More information about the Binutils mailing list