Index: src/tools/msvc/Project.pm =================================================================== RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Project.pm,v retrieving revision 1.5 diff -c -r1.5 Project.pm *** src/tools/msvc/Project.pm 4 Jan 2007 17:58:19 -0000 1.5 --- src/tools/msvc/Project.pm 11 Jan 2007 21:24:38 -0000 *************** *** 252,261 **** } # Dump the project ! open(F, ">$self->{name}.vcproj") || croak("Could not write to $self->{name}.vcproj\n"); ! $self->WriteHeader(*F); ! $self->WriteReferences(*F); ! print F < EOF my @dirstack = (); --- 252,261 ---- } # Dump the project ! my $dump = ''; ! $dump .= $self->WriteHeader(); ! $dump .= $self->WriteReferences(); ! $dump .= < EOF my @dirstack = (); *************** *** 271,277 **** last if (length($dir) == length(join('\\',@dirstack))); last if (substr($dir, length(join('\\',@dirstack)),1) eq '\\'); } ! print F ' ' x $#dirstack . " \n"; pop @dirstack; } # Now walk forwards and create whatever directories are needed --- 271,277 ---- last if (length($dir) == length(join('\\',@dirstack))); last if (substr($dir, length(join('\\',@dirstack)),1) eq '\\'); } ! $dump .= ' ' x $#dirstack . " \n"; pop @dirstack; } # Now walk forwards and create whatever directories are needed *************** *** 280,317 **** $left =~ s/^\\//; my @pieces = split /\\/, $left; push @dirstack, $pieces[0]; ! print F ' ' x $#dirstack . " \n"; } ! print F ' ' x $#dirstack . " ' . GenerateCustomTool('Running bison on ' . $f, 'cmd /V:ON /c src/tools/msvc\pgbison.bat ' . $f, $of) . '' . "\n"; } elsif ($f =~ /\.l$/) { my $of = $f; $of =~ s/\.l$/.c/; $of =~ s{^src\\pl\\plpgsql\\src\\scan.c$}{src\\pl\\plpgsql\\src\\pl_scan.c}; ! print F '>' . GenerateCustomTool('Running flex on ' . $f, 'src/tools/msvc\pgflex.bat ' . $f,$of) . '' . "\n"; } elsif (defined($uniquefiles{$file})) { # File already exists, so fake a new name my $obj = $dir; $obj =~ s/\\/_/g; ! print F ">{name}\\$obj" . "_$file.obj\" />{name}\\$obj" . "_$file.obj\" />\n"; } else { $uniquefiles{$file} = 1; ! print F " />\n"; } } while ($#dirstack >= 0) { ! print F ' ' x $#dirstack . " \n"; pop @dirstack; } ! $self->Footer(*F); close(F); } --- 280,331 ---- $left =~ s/^\\//; my @pieces = split /\\/, $left; push @dirstack, $pieces[0]; ! $dump .= ' ' x $#dirstack . " \n"; } ! $dump .= ' ' x $#dirstack . " ' . "\n"; } elsif ($f =~ /\.l$/) { my $of = $f; $of =~ s/\.l$/.c/; $of =~ s{^src\\pl\\plpgsql\\src\\scan.c$}{src\\pl\\plpgsql\\src\\pl_scan.c}; ! $dump .= '>' . GenerateCustomTool('Running flex on ' . $f, 'src/tools/msvc\pgflex.bat ' . $f,$of) . '' . "\n"; } elsif (defined($uniquefiles{$file})) { # File already exists, so fake a new name my $obj = $dir; $obj =~ s/\\/_/g; ! $dump .= ">{name}\\$obj" . "_$file.obj\" />{name}\\$obj" . "_$file.obj\" />\n"; } else { $uniquefiles{$file} = 1; ! $dump .= " />\n"; } } while ($#dirstack >= 0) { ! $dump .= ' ' x $#dirstack . " \n"; pop @dirstack; } ! $dump .= $self->Footer(); ! my $oldcont = read_file("$self->{name}.vcproj",1); ! if ($oldcont) { ! my $dump2 = $dump; ! $dump2 =~ s/ProjectGUID="[^"]+"//gs; ! $dump2 =~ s/ReferencedProjectIdentifier="[^"]+"//gs; ! $oldcont =~ s/ProjectGUID="[^"]+"//gs; ! $oldcont =~ s/ReferencedProjectIdentifier="[^"]+"//gs; ! if ($dump2 eq $oldcont) { ! #print "Not rewriting $self->{name}\n"; ! return; ! } ! } ! open(F, ">$self->{name}.vcproj") || croak("Could not write to $self->{name}.vcproj\n"); ! print F $dump; close(F); } *************** *** 325,357 **** } sub WriteReferences { ! my ($self, $f) = @_; ! print $f " \n"; foreach my $ref (@{$self->{references}}) { ! print $f " {guid}\" Name=\"$ref->{name}\" />\n"; } ! print $f " \n"; } sub WriteHeader { ! my ($self, $f) = @_; ! ! print $f < EOF ! $self->WriteConfiguration($f, 'Debug', { defs=>'_DEBUG;DEBUG=1;', wholeopt=>0 , opt=>0, strpool=>'false', runtime=>3 }); ! $self->WriteConfiguration($f, 'Release', { defs=>'', wholeopt=>0, opt=>3, strpool=>'true', runtime=>2 }); ! print $f < EOF } sub WriteConfiguration { ! my ($self, $f, $cfgname, $p) = @_; my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4); my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd"; my $libs = ''; --- 339,373 ---- } sub WriteReferences { ! my ($self) = @_; ! my $t = " \n"; foreach my $ref (@{$self->{references}}) { ! $t .= " {guid}\" Name=\"$ref->{name}\" />\n"; } ! $t .= " \n"; ! return $t; } sub WriteHeader { ! my ($self) = @_; ! my $t = < EOF ! $t .= $self->WriteConfiguration('Debug', { defs=>'_DEBUG;DEBUG=1;', wholeopt=>0 , opt=>0, strpool=>'false', runtime=>3 }); ! $t .= $self->WriteConfiguration('Release', { defs=>'', wholeopt=>0, opt=>3, strpool=>'true', runtime=>2 }); ! $t .= < EOF + return $t; } sub WriteConfiguration { ! my ($self, $cfgname, $p) = @_; ! my $t = ''; my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4); my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd"; my $libs = ''; *************** *** 367,382 **** } $libs =~ s/ $//; $libs =~ s/__CFGNAME__/$cfgname/g; ! print $f < --- 383,400 ---- } $libs =~ s/ $//; $libs =~ s/__CFGNAME__/$cfgname/g; ! my $pth = $self->{solution}->{options}->{pthread}; ! $pth = '' unless $pth; ! $t .= < *************** *** 391,419 **** if ($self->{implib}) { my $l = $self->{implib}; $l =~ s/__CFGNAME__/$cfgname/g; ! print $f "\t\tImportLibrary=\"$l\"\n"; } if ($self->{def}) { my $d = $self->{def}; $d =~ s/__CFGNAME__/$cfgname/g; ! print $f "\t\tModuleDefinitionFile=\"$d\"\n"; } ! print $f "\t/>\n"; ! print $f "\t{name}\\$self->{name}.lib\" IgnoreDefaultLibraryNames=\"libc\" />\n"; ! print $f "\t\n"; if ($self->{builddef}) { ! print $f "\t{name}\" />\n"; } ! print $f < EOF } sub Footer { ! my ($self, $f) = @_; ! print $f < --- 409,438 ---- if ($self->{implib}) { my $l = $self->{implib}; $l =~ s/__CFGNAME__/$cfgname/g; ! $t .= "\t\tImportLibrary=\"$l\"\n"; } if ($self->{def}) { my $d = $self->{def}; $d =~ s/__CFGNAME__/$cfgname/g; ! $t .= "\t\tModuleDefinitionFile=\"$d\"\n"; } ! $t .= "\t/>\n"; ! $t .= "\t{name}\\$self->{name}.lib\" IgnoreDefaultLibraryNames=\"libc\" />\n"; ! $t .= "\t\n"; if ($self->{builddef}) { ! $t .= "\t{name}\" />\n"; } ! $t .= < EOF + return $t; } sub Footer { ! my ($self) = @_; ! return < *************** *** 424,433 **** --- 443,456 ---- # Utility function that loads a complete file sub read_file { my $filename = shift; + my $ignorenoexist = shift; my $F; my $t = $/; undef $/; + if ($ignorenoexist) { + open($F, $filename) || return ''; + } open($F, $filename) || croak "Could not open file $filename\n"; my $txt = <$F>; close($F); Index: src/tools/msvc/Solution.pm =================================================================== RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Solution.pm,v retrieving revision 1.5 diff -c -r1.5 Solution.pm *** src/tools/msvc/Solution.pm 29 Dec 2006 16:49:02 -0000 1.5 --- src/tools/msvc/Solution.pm 11 Jan 2007 21:21:21 -0000 *************** *** 269,297 **** } } ! open(SLN,">pgsql.sln") || croak "Could not write to pgsql.sln\n"; ! print SLN <{projects}}) { foreach my $proj (@{$self->{projects}->{$fld}}) { ! print SLN <{name}.vcproj", "$proj->{guid}" EndProject EOF } if ($fld ne "") { $flduid{$fld} = Win32::GuidGen(); ! print SLN <{projects}}) { foreach my $proj (@{$self->{projects}->{$fld}}) { ! $dump .= <{name}.vcproj", "$proj->{guid}" EndProject EOF } if ($fld ne "") { $flduid{$fld} = Win32::GuidGen(); ! $dump .= <{projects}}) { foreach my $proj (@{$self->{projects}->{$fld}}) { ! print SLN <{guid}.Debug|Win32.ActiveCfg = Debug|Win32 ! $proj->{guid}.Debug|Win32.Build.0 = Debug|Win32 $proj->{guid}.Release|Win32.ActiveCfg = Release|Win32 $proj->{guid}.Release|Win32.Build.0 = Release|Win32 EOF } } ! print SLN <{projects}}) { foreach my $proj (@{$self->{projects}->{$fld}}) { ! $dump .= <{guid}.Debug|Win32.ActiveCfg = Debug|Win32 ! $proj->{guid}.Debug|Win32.Build.0 = Debug|Win32 $proj->{guid}.Release|Win32.ActiveCfg = Release|Win32 $proj->{guid}.Release|Win32.Build.0 = Release|Win32 EOF } } ! $dump .= <{projects}}) { next if ($fld eq ""); foreach my $proj (@{$self->{projects}->{$fld}}) { ! print SLN "\t\t$proj->{guid} = $flduid{$fld}\n"; } } ! print SLN <{projects}}) { next if ($fld eq ""); foreach my $proj (@{$self->{projects}->{$fld}}) { ! $dump .= "\t\t$proj->{guid} = $flduid{$fld}\n"; } } ! $dump .= <pgsql.sln") || croak "Could not write to pgsql.sln\n"; + + print SLN $dump; close(SLN); }