When a frontend program needs to compile a file from another directory,
Mkvcbuild.pm usually does something like this:
> $pgdumpall->AddFile('src\bin\pg_dump\keywords.c');
> $pgdumpall->AddFile('src\backend\parser\kwlookup.c');
But for pg_xlogdump, it does this:
> foreach my $xf (glob('src/backend/access/rmgrdesc/*desc.c'))
> {
> my $bf = basename $xf;
> copy($xf, "contrib/pg_xlogdump/$bf");
> $pg_xlogdump->AddFile("contrib\\pg_xlogdump\\$bf");
> }
> copy(
> 'src/backend/access/transam/xlogreader.c',
> 'contrib/pg_xlogdump/xlogreader.c');
I.e. usually we instruct MSBuild to compile the source file from where
it is, but for pg_xlogdump, we copy the source file. Is there a reason
for this?
This was done by this commit:
> commit a64e33f030f3ba379a0d3e22fe6bcda9dc3bbc60
> Author: Andrew Dunstan <andrew@dunslane.net>
> Date: Mon Feb 25 12:00:53 2013 -0500
>
> Redo MSVC build implementation for pg_xlogdump.
>
> The previous commit didn't work on MSVC editions earlier than
> Visual Studio 2011, apparently. This works by copying files into the
> contrib directory, and making provision to clean them up, which should
> work on all editions.
Which followed this one:
> commit 786170d74f30bc8d3017149dc444f3f3e29029a7
> Author: Andrew Dunstan <andrew@dunslane.net>
> Date: Sun Feb 24 20:28:42 2013 -0500
>
> Provide MSVC build setup for pg_xlogdump.
But that earlier commit didn't use the straight AddFile approach either.
I'm guessing that the current state of affairs is just an oversight. I
tried changing it so that xlogreader.c is built into pg_xlogdump without
copying, and it seemed to work. But I'm using a very recent version of
MSVC - perhaps it won't work on pre-VS2011 versions.
Unless someone has some insights on this, I'm going to commit the
attached, and see what the buildfarm thinks of it.
- Heikki