This patch changes the installscript for vcbuild to actually parse the
generated solution files for what to install, instead of blindly copying
everything as it previously did. With the previous quick-n-dirty
version, it would copy old DLLs if you reconfigured in a way that didn't
include subprojects like a PL for example.

The part of install.pl previously included in my pgregress patch (not
yet applied) are superseded by and included in this patch (only the
install.pl part is - the changes to the other build files and to the C
file are still very much current)

//Magnus
Index: src/tools/msvc/install.pl
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/install.pl,v
retrieving revision 1.1
diff -c -r1.1 install.pl
*** src/tools/msvc/install.pl   29 Nov 2006 19:49:31 -0000      1.1
--- src/tools/msvc/install.pl   2 Feb 2007 11:11:42 -0000
***************
*** 21,28 ****

  EnsureDirectories ('bin','lib','share','share/timezonesets');

! CopySetOfFiles('programs', "$conf\\*.exe", $target . '/bin/');
! CopySetOfFiles('libraries', "$conf\\*.dll", $target . '/lib/');
  copy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
  CopySetOfFiles('config files', "*.sample", $target . '/share/');
  CopySetOfFiles('timezone names', 'src\timezone\tznames\*.txt', $target . 
'/share/timezonesets/');
--- 21,27 ----

  EnsureDirectories ('bin','lib','share','share/timezonesets');

! CopySolutionOutput($conf, $target);
  copy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
  CopySetOfFiles('config files', "*.sample", $target . '/share/');
  CopySetOfFiles('timezone names', 'src\timezone\tznames\*.txt', $target . 
'/share/timezonesets/');
***************
*** 72,81 ****
                chomp;
                my $tgt = $target . basename($_);
                print ".";
!               copy($_, $tgt) || croak "Could not copy $_\n";
        }
        close($D);
        print "\n";
  }

  sub GenerateConversionScript {
--- 71,116 ----
                chomp;
                my $tgt = $target . basename($_);
                print ".";
!               copy($_, $tgt) || croak "Could not copy $_: $!\n";
        }
        close($D);
        print "\n";
+ }
+
+ sub CopySolutionOutput {
+    my $conf = shift;
+    my $target = shift;
+    my $rem = qr{Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"\) = 
"([^"]+)"};
+
+    my $sln = read_file("pgsql.sln") || croak "Could not open pgsql.sln\n";
+    print "Copying build output files...";
+    while ($sln =~ $rem) {
+       my $pf = $1;
+       my $dir;
+       my $ext;
+
+       $sln =~ s/$rem//;
+
+       my $proj = read_file("$pf.vcproj") || croak "Could not open 
$pf.vcproj\n";
+       if ($proj !~ qr{ConfigurationType="([^"]+)"}) {
+          croak "Could not parse $pf.vcproj\n";
+       }
+       if ($1 == 1) {
+          $dir = "bin";
+          $ext = "exe";
+       }
+       elsif ($1 == 2) {
+          $dir = "lib";
+          $ext = "dll";
+       }
+       else {
+          # Static lib, such as libpgport, only used internally during build, 
don't install
+          next;
+       }
+       copy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could 
not copy $pf.$ext\n";
+       print ".";
+    }
+    print "\n";
  }

  sub GenerateConversionScript {
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to