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 <and...@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 <and...@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
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 989a2ec..473a310 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -13,7 +13,6 @@ use Project;
 use Solution;
 use Cwd;
 use File::Copy;
-use File::Basename;
 use Config;
 use VSObjectFactory;
 use List::Util qw(first);
@@ -628,15 +627,11 @@ sub mkvcbuild
 	  (grep { $_->{name} eq 'pg_xlogdump' }
 		  @{ $solution->{projects}->{contrib} })[0];
 	$pg_xlogdump->AddDefine('FRONTEND');
-	foreach my $xf (glob('src/backend/access/rmgrdesc/*desc.c'))
+	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");
+		$pg_xlogdump->AddFile($xf)
 	}
-	copy(
-		'src/backend/access/transam/xlogreader.c',
-		'contrib/pg_xlogdump/xlogreader.c');
+	$pg_xlogdump->AddFile('src\backend\access\transam\xlogreader.c');
 
 	$solution->Save();
 	return $solution->{vcver};
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index 9c7ea42..fbe3cc6 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -92,11 +92,6 @@ REM Clean up datafiles built with contrib
 REM cd contrib
 REM for /r %%f in (*.sql) do if exist %%f.in del %%f
 
-REM clean up files copied into contrib\pg_xlogdump
-if exist contrib\pg_xlogdump\xlogreader.c del /q contrib\pg_xlogdump\xlogreader.c
-for %%f in (contrib\pg_xlogdump\*desc.c) do if not %%f==contrib\pg_xlogdump\rmgrdesc.c del /q %%f
-
-
 cd %D%
 
 REM Clean up ecpg regression test files
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to