mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -13,158 +13,159 @@ use base qw(Project);
|
||||
|
||||
sub _new
|
||||
{
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{filenameExtension} = '.vcxproj';
|
||||
$self->{filenameExtension} = '.vcxproj';
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub WriteHeader
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
my ($self, $f) = @_;
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
EOF
|
||||
$self->WriteConfigurationHeader($f, 'Debug');
|
||||
$self->WriteConfigurationHeader($f, 'Release');
|
||||
print $f <<EOF;
|
||||
$self->WriteConfigurationHeader($f, 'Debug');
|
||||
$self->WriteConfigurationHeader($f, 'Release');
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>$self->{guid}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
|
||||
EOF
|
||||
$self->WriteConfigurationPropertyGroup($f, 'Release',{ wholeopt=>'false' });
|
||||
$self->WriteConfigurationPropertyGroup($f, 'Debug',{ wholeopt=>'false' });
|
||||
print $f <<EOF;
|
||||
$self->WriteConfigurationPropertyGroup($f, 'Release',{wholeopt=>'false'});
|
||||
$self->WriteConfigurationPropertyGroup($f, 'Debug',{wholeopt=>'false'});
|
||||
print $f <<EOF;
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
EOF
|
||||
$self->WritePropertySheetsPropertyGroup($f, 'Release');
|
||||
$self->WritePropertySheetsPropertyGroup($f, 'Debug');
|
||||
print $f <<EOF;
|
||||
$self->WritePropertySheetsPropertyGroup($f, 'Release');
|
||||
$self->WritePropertySheetsPropertyGroup($f, 'Debug');
|
||||
print $f <<EOF;
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
EOF
|
||||
$self->WriteAdditionalProperties($f, 'Debug');
|
||||
$self->WriteAdditionalProperties($f, 'Release');
|
||||
print $f <<EOF;
|
||||
$self->WriteAdditionalProperties($f, 'Debug');
|
||||
$self->WriteAdditionalProperties($f, 'Release');
|
||||
print $f <<EOF;
|
||||
</PropertyGroup>
|
||||
EOF
|
||||
$self->WriteItemDefinitionGroup(
|
||||
$f, 'Debug',
|
||||
{
|
||||
defs=>'_DEBUG;DEBUG=1;',
|
||||
opt=>'Disabled',
|
||||
strpool=>'false',
|
||||
runtime=>'MultiThreadedDebugDLL'
|
||||
}
|
||||
);
|
||||
$self->WriteItemDefinitionGroup($f, 'Release',
|
||||
{ defs=>'', opt=>'Full', strpool=>'true', runtime=>'MultiThreadedDLL' });
|
||||
$self->WriteItemDefinitionGroup(
|
||||
$f, 'Debug',
|
||||
{
|
||||
defs=>'_DEBUG;DEBUG=1;',
|
||||
opt=>'Disabled',
|
||||
strpool=>'false',
|
||||
runtime=>'MultiThreadedDebugDLL'
|
||||
}
|
||||
);
|
||||
$self->WriteItemDefinitionGroup($f, 'Release',
|
||||
{defs=>'', opt=>'Full', strpool=>'true', runtime=>'MultiThreadedDLL'});
|
||||
}
|
||||
|
||||
sub AddDefine
|
||||
{
|
||||
my ($self, $def) = @_;
|
||||
my ($self, $def) = @_;
|
||||
|
||||
$self->{defines} .= $def . ';';
|
||||
$self->{defines} .= $def . ';';
|
||||
}
|
||||
|
||||
sub WriteReferences
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
my ($self, $f) = @_;
|
||||
|
||||
my @references = @{$self->{references}};
|
||||
my @references = @{$self->{references}};
|
||||
|
||||
if (scalar(@references))
|
||||
{
|
||||
print $f <<EOF;
|
||||
if (scalar(@references))
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
foreach my $ref (@references)
|
||||
{
|
||||
print $f <<EOF;
|
||||
foreach my $ref (@references)
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ProjectReference Include="$ref->{name}$ref->{filenameExtension}">
|
||||
<Project>$ref->{guid}</Project>
|
||||
</ProjectReference>
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub WriteFiles
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
print $f <<EOF;
|
||||
my ($self, $f) = @_;
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
my @grammarFiles = ();
|
||||
my @resourceFiles = ();
|
||||
my %uniquefiles;
|
||||
foreach my $fileNameWithPath (sort keys %{ $self->{files} })
|
||||
{
|
||||
confess "Bad format filename '$fileNameWithPath'\n"
|
||||
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
|
||||
my $dir = $1;
|
||||
my $fileName = $2;
|
||||
if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
|
||||
{
|
||||
push @grammarFiles, $fileNameWithPath;
|
||||
}
|
||||
elsif ($fileNameWithPath =~ /\.rc$/)
|
||||
{
|
||||
push @resourceFiles, $fileNameWithPath;
|
||||
}
|
||||
elsif (defined($uniquefiles{$fileName}))
|
||||
{
|
||||
my @grammarFiles = ();
|
||||
my @resourceFiles = ();
|
||||
my %uniquefiles;
|
||||
foreach my $fileNameWithPath (sort keys %{$self->{files}})
|
||||
{
|
||||
confess "Bad format filename '$fileNameWithPath'\n"
|
||||
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
|
||||
my $dir = $1;
|
||||
my $fileName = $2;
|
||||
if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
|
||||
{
|
||||
push @grammarFiles, $fileNameWithPath;
|
||||
}
|
||||
elsif ($fileNameWithPath =~ /\.rc$/)
|
||||
{
|
||||
push @resourceFiles, $fileNameWithPath;
|
||||
}
|
||||
elsif (defined($uniquefiles{$fileName}))
|
||||
{
|
||||
|
||||
# File already exists, so fake a new name
|
||||
my $obj = $dir;
|
||||
$obj =~ s/\\/_/g;
|
||||
# File already exists, so fake a new name
|
||||
my $obj = $dir;
|
||||
$obj =~ s/\\/_/g;
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<ClCompile Include="$fileNameWithPath">
|
||||
<ObjectFileName Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">.\\debug\\$self->{name}\\${obj}_$fileName.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">.\\release\\$self->{name}\\${obj}_$fileName.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
EOF
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniquefiles{$fileName} = 1;
|
||||
print $f <<EOF;
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniquefiles{$fileName} = 1;
|
||||
print $f <<EOF;
|
||||
<ClCompile Include="$fileNameWithPath" />
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
if (scalar(@grammarFiles))
|
||||
{
|
||||
print $f <<EOF;
|
||||
if (scalar(@grammarFiles))
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
foreach my $grammarFile (@grammarFiles)
|
||||
{
|
||||
(my $outputFile = $grammarFile) =~ s/\.(y|l)$/.c/;
|
||||
if ($grammarFile =~ /\.y$/)
|
||||
{
|
||||
$outputFile =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
|
||||
print $f <<EOF;
|
||||
foreach my $grammarFile (@grammarFiles)
|
||||
{
|
||||
(my $outputFile = $grammarFile) =~ s/\.(y|l)$/.c/;
|
||||
if ($grammarFile =~ /\.y$/)
|
||||
{
|
||||
$outputFile =~
|
||||
s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
|
||||
print $f <<EOF;
|
||||
<CustomBuild Include="$grammarFile">
|
||||
<Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running bison on $grammarFile</Message>
|
||||
<Command Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"</Command>
|
||||
@ -176,10 +177,10 @@ EOF
|
||||
<Outputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
EOF
|
||||
}
|
||||
else #if ($grammarFile =~ /\.l$/)
|
||||
{
|
||||
print $f <<EOF;
|
||||
}
|
||||
else #if ($grammarFile =~ /\.l$/)
|
||||
{
|
||||
print $f <<EOF;
|
||||
<CustomBuild Include="$grammarFile">
|
||||
<Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running flex on $grammarFile</Message>
|
||||
<Command Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"</Command>
|
||||
@ -191,33 +192,33 @@ EOF
|
||||
<Outputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
EOF
|
||||
}
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
}
|
||||
if (scalar(@resourceFiles))
|
||||
{
|
||||
print $f <<EOF;
|
||||
}
|
||||
if (scalar(@resourceFiles))
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
foreach my $rcFile (@resourceFiles)
|
||||
{
|
||||
print $f <<EOF;
|
||||
foreach my $rcFile (@resourceFiles)
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ResourceCompile Include="$rcFile" />
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub WriteConfigurationHeader
|
||||
{
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
<ProjectConfiguration Include="$cfgname|$self->{platform}">
|
||||
<Configuration>$cfgname</Configuration>
|
||||
<Platform>$self->{platform}</Platform>
|
||||
@ -227,13 +228,13 @@ EOF
|
||||
|
||||
sub WriteConfigurationPropertyGroup
|
||||
{
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype =
|
||||
($self->{type} eq "exe")
|
||||
?'Application'
|
||||
:($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype =
|
||||
($self->{type} eq "exe")
|
||||
?'Application'
|
||||
:($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<PropertyGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" Label="Configuration">
|
||||
<ConfigurationType>$cfgtype</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
@ -245,8 +246,8 @@ EOF
|
||||
|
||||
sub WritePropertySheetsPropertyGroup
|
||||
{
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
<ImportGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" Label="PropertySheets">
|
||||
<Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -255,8 +256,8 @@ EOF
|
||||
|
||||
sub WriteAdditionalProperties
|
||||
{
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
<OutDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</OutDir>
|
||||
<IntDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</IntDir>
|
||||
<LinkIncremental Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">false</LinkIncremental>
|
||||
@ -265,21 +266,21 @@ EOF
|
||||
|
||||
sub WriteItemDefinitionGroup
|
||||
{
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype =
|
||||
($self->{type} eq "exe")
|
||||
?'Application'
|
||||
:($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
|
||||
my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';');
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype =
|
||||
($self->{type} eq "exe")
|
||||
?'Application'
|
||||
:($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
|
||||
my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';');
|
||||
|
||||
my $targetmachine = $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
|
||||
my $targetmachine = $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
|
||||
|
||||
my $includes = $self->{includes};
|
||||
unless ($includes eq '' or $includes =~ /;$/)
|
||||
{
|
||||
$includes .= ';';
|
||||
}
|
||||
print $f <<EOF;
|
||||
my $includes = $self->{includes};
|
||||
unless ($includes eq '' or $includes =~ /;$/)
|
||||
{
|
||||
$includes .= ';';
|
||||
}
|
||||
print $f <<EOF;
|
||||
<ItemDefinitionGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">
|
||||
<ClCompile>
|
||||
<Optimization>$p->{opt}</Optimization>
|
||||
@ -314,49 +315,49 @@ sub WriteItemDefinitionGroup
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>$targetmachine</TargetMachine>
|
||||
EOF
|
||||
if ($self->{disablelinkerwarnings})
|
||||
{
|
||||
print $f
|
||||
if ($self->{disablelinkerwarnings})
|
||||
{
|
||||
print $f
|
||||
" <AdditionalOptions>/ignore:$self->{disablelinkerwarnings} \%(AdditionalOptions)</AdditionalOptions>\n";
|
||||
}
|
||||
if ($self->{implib})
|
||||
{
|
||||
my $l = $self->{implib};
|
||||
$l =~ s/__CFGNAME__/$cfgname/g;
|
||||
print $f " <ImportLibrary>$l</ImportLibrary>\n";
|
||||
}
|
||||
if ($self->{def})
|
||||
{
|
||||
my $d = $self->{def};
|
||||
$d =~ s/__CFGNAME__/$cfgname/g;
|
||||
print $f " <ModuleDefinitionFile>$d</ModuleDefinitionFile>\n";
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
if ($self->{implib})
|
||||
{
|
||||
my $l = $self->{implib};
|
||||
$l =~ s/__CFGNAME__/$cfgname/g;
|
||||
print $f " <ImportLibrary>$l</ImportLibrary>\n";
|
||||
}
|
||||
if ($self->{def})
|
||||
{
|
||||
my $d = $self->{def};
|
||||
$d =~ s/__CFGNAME__/$cfgname/g;
|
||||
print $f " <ModuleDefinitionFile>$d</ModuleDefinitionFile>\n";
|
||||
}
|
||||
print $f <<EOF;
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>src\\include;\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
EOF
|
||||
if ($self->{builddef})
|
||||
{
|
||||
print $f <<EOF;
|
||||
if ($self->{builddef})
|
||||
{
|
||||
print $f <<EOF;
|
||||
<PreLinkEvent>
|
||||
<Message>Generate DEF file</Message>
|
||||
<Command>perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}</Command>
|
||||
</PreLinkEvent>
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemDefinitionGroup>
|
||||
EOF
|
||||
}
|
||||
|
||||
sub Footer
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
$self->WriteReferences($f);
|
||||
my ($self, $f) = @_;
|
||||
$self->WriteReferences($f);
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
@ -376,13 +377,13 @@ use base qw(MSBuildProject);
|
||||
|
||||
sub new
|
||||
{
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '10.00';
|
||||
$self->{vcver} = '10.00';
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,393 +12,394 @@ use File::Basename;
|
||||
|
||||
sub _new
|
||||
{
|
||||
my ($classname, $name, $type, $solution) = @_;
|
||||
my $good_types = {
|
||||
lib => 1,
|
||||
exe => 1,
|
||||
dll => 1,
|
||||
};
|
||||
confess("Bad project type: $type\n") unless exists $good_types->{$type};
|
||||
my $self = {
|
||||
name => $name,
|
||||
type => $type,
|
||||
guid => Win32::GuidGen(),
|
||||
files => {},
|
||||
references => [],
|
||||
libraries => [],
|
||||
suffixlib => [],
|
||||
includes => '',
|
||||
prefixincludes => '',
|
||||
defines => ';',
|
||||
solution => $solution,
|
||||
disablewarnings => '4018;4244;4273;4102;4090;4267',
|
||||
disablelinkerwarnings => '',
|
||||
platform => $solution->{platform},
|
||||
};
|
||||
my ($classname, $name, $type, $solution) = @_;
|
||||
my $good_types = {
|
||||
lib => 1,
|
||||
exe => 1,
|
||||
dll => 1,
|
||||
};
|
||||
confess("Bad project type: $type\n") unless exists $good_types->{$type};
|
||||
my $self = {
|
||||
name => $name,
|
||||
type => $type,
|
||||
guid => Win32::GuidGen(),
|
||||
files => {},
|
||||
references => [],
|
||||
libraries => [],
|
||||
suffixlib => [],
|
||||
includes => '',
|
||||
prefixincludes => '',
|
||||
defines => ';',
|
||||
solution => $solution,
|
||||
disablewarnings => '4018;4244;4273;4102;4090;4267',
|
||||
disablelinkerwarnings => '',
|
||||
platform => $solution->{platform},
|
||||
};
|
||||
|
||||
bless($self, $classname);
|
||||
return $self;
|
||||
bless($self, $classname);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub AddFile
|
||||
{
|
||||
my ($self, $filename) = @_;
|
||||
my ($self, $filename) = @_;
|
||||
|
||||
$self->{files}->{$filename} = 1;
|
||||
$self->{files}->{$filename} = 1;
|
||||
}
|
||||
|
||||
sub AddFiles
|
||||
{
|
||||
my $self = shift;
|
||||
my $dir = shift;
|
||||
my $self = shift;
|
||||
my $dir = shift;
|
||||
|
||||
while (my $f = shift)
|
||||
{
|
||||
$self->{files}->{$dir . "\\" . $f} = 1;
|
||||
}
|
||||
while (my $f = shift)
|
||||
{
|
||||
$self->{files}->{$dir . "\\" . $f} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub ReplaceFile
|
||||
{
|
||||
my ($self, $filename, $newname) = @_;
|
||||
my $re = "\\\\$filename\$";
|
||||
my ($self, $filename, $newname) = @_;
|
||||
my $re = "\\\\$filename\$";
|
||||
|
||||
foreach my $file ( keys %{ $self->{files} } )
|
||||
{
|
||||
foreach my $file (keys %{$self->{files}})
|
||||
{
|
||||
|
||||
# Match complete filename
|
||||
if ($filename =~ /\\/)
|
||||
{
|
||||
if ($file eq $filename)
|
||||
{
|
||||
delete $self->{files}{$file};
|
||||
$self->{files}{$newname} = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
elsif ($file =~ m/($re)/)
|
||||
{
|
||||
delete $self->{files}{$file};
|
||||
$self->{files}{"$newname\\$filename"} = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
confess("Could not find file $filename to replace\n");
|
||||
# Match complete filename
|
||||
if ($filename =~ /\\/)
|
||||
{
|
||||
if ($file eq $filename)
|
||||
{
|
||||
delete $self->{files}{$file};
|
||||
$self->{files}{$newname} = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
elsif ($file =~ m/($re)/)
|
||||
{
|
||||
delete $self->{files}{$file};
|
||||
$self->{files}{"$newname\\$filename"} = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
confess("Could not find file $filename to replace\n");
|
||||
}
|
||||
|
||||
sub RemoveFile
|
||||
{
|
||||
my ($self, $filename) = @_;
|
||||
my $orig = scalar keys %{ $self->{files} };
|
||||
delete $self->{files}->{$filename};
|
||||
if ($orig > scalar keys %{$self->{files}} )
|
||||
{
|
||||
return;
|
||||
}
|
||||
confess("Could not find file $filename to remove\n");
|
||||
my ($self, $filename) = @_;
|
||||
my $orig = scalar keys %{$self->{files}};
|
||||
delete $self->{files}->{$filename};
|
||||
if ($orig > scalar keys %{$self->{files}})
|
||||
{
|
||||
return;
|
||||
}
|
||||
confess("Could not find file $filename to remove\n");
|
||||
}
|
||||
|
||||
sub RelocateFiles
|
||||
{
|
||||
my ($self, $targetdir, $proc) = @_;
|
||||
foreach my $f (keys %{$self->{files}})
|
||||
{
|
||||
my $r = &$proc($f);
|
||||
if ($r)
|
||||
{
|
||||
$self->RemoveFile($f);
|
||||
$self->AddFile($targetdir . '\\' . basename($f));
|
||||
}
|
||||
}
|
||||
my ($self, $targetdir, $proc) = @_;
|
||||
foreach my $f (keys %{$self->{files}})
|
||||
{
|
||||
my $r = &$proc($f);
|
||||
if ($r)
|
||||
{
|
||||
$self->RemoveFile($f);
|
||||
$self->AddFile($targetdir . '\\' . basename($f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub AddReference
|
||||
{
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
|
||||
while (my $ref = shift)
|
||||
{
|
||||
push @{$self->{references}},$ref;
|
||||
$self->AddLibrary("__CFGNAME__\\" . $ref->{name} . "\\" . $ref->{name} . ".lib");
|
||||
}
|
||||
while (my $ref = shift)
|
||||
{
|
||||
push @{$self->{references}},$ref;
|
||||
$self->AddLibrary("__CFGNAME__\\" . $ref->{name} . "\\" . $ref->{name} . ".lib");
|
||||
}
|
||||
}
|
||||
|
||||
sub AddLibrary
|
||||
{
|
||||
my ($self, $lib, $dbgsuffix) = @_;
|
||||
my ($self, $lib, $dbgsuffix) = @_;
|
||||
|
||||
if ($lib =~ m/\s/)
|
||||
{
|
||||
$lib = '"' . $lib . """;
|
||||
}
|
||||
if ($lib =~ m/\s/)
|
||||
{
|
||||
$lib = '"' . $lib . """;
|
||||
}
|
||||
|
||||
push @{$self->{libraries}}, $lib;
|
||||
if ($dbgsuffix)
|
||||
{
|
||||
push @{$self->{suffixlib}}, $lib;
|
||||
}
|
||||
push @{$self->{libraries}}, $lib;
|
||||
if ($dbgsuffix)
|
||||
{
|
||||
push @{$self->{suffixlib}}, $lib;
|
||||
}
|
||||
}
|
||||
|
||||
sub AddIncludeDir
|
||||
{
|
||||
my ($self, $inc) = @_;
|
||||
my ($self, $inc) = @_;
|
||||
|
||||
if ($self->{includes} ne '')
|
||||
{
|
||||
$self->{includes} .= ';';
|
||||
}
|
||||
$self->{includes} .= $inc;
|
||||
if ($self->{includes} ne '')
|
||||
{
|
||||
$self->{includes} .= ';';
|
||||
}
|
||||
$self->{includes} .= $inc;
|
||||
}
|
||||
|
||||
sub AddPrefixInclude
|
||||
{
|
||||
my ($self, $inc) = @_;
|
||||
my ($self, $inc) = @_;
|
||||
|
||||
$self->{prefixincludes} = $inc . ';' . $self->{prefixincludes};
|
||||
$self->{prefixincludes} = $inc . ';' . $self->{prefixincludes};
|
||||
}
|
||||
|
||||
sub AddDefine
|
||||
{
|
||||
my ($self, $def) = @_;
|
||||
my ($self, $def) = @_;
|
||||
|
||||
$def =~ s/"/""/g;
|
||||
$self->{defines} .= $def . ';';
|
||||
$def =~ s/"/""/g;
|
||||
$self->{defines} .= $def . ';';
|
||||
}
|
||||
|
||||
sub FullExportDLL
|
||||
{
|
||||
my ($self, $libname) = @_;
|
||||
my ($self, $libname) = @_;
|
||||
|
||||
$self->{builddef} = 1;
|
||||
$self->{def} = ".\\__CFGNAME__\\$self->{name}\\$self->{name}.def";
|
||||
$self->{implib} = "__CFGNAME__\\$self->{name}\\$libname";
|
||||
$self->{builddef} = 1;
|
||||
$self->{def} = ".\\__CFGNAME__\\$self->{name}\\$self->{name}.def";
|
||||
$self->{implib} = "__CFGNAME__\\$self->{name}\\$libname";
|
||||
}
|
||||
|
||||
sub UseDef
|
||||
{
|
||||
my ($self, $def) = @_;
|
||||
my ($self, $def) = @_;
|
||||
|
||||
$self->{def} = $def;
|
||||
$self->{def} = $def;
|
||||
}
|
||||
|
||||
sub AddDir
|
||||
{
|
||||
my ($self, $reldir) = @_;
|
||||
my $MF;
|
||||
my ($self, $reldir) = @_;
|
||||
my $MF;
|
||||
|
||||
my $t = $/;
|
||||
undef $/;
|
||||
open($MF,"$reldir\\Makefile")
|
||||
|| open($MF,"$reldir\\GNUMakefile")
|
||||
|| croak "Could not open $reldir\\Makefile\n";
|
||||
my $mf = <$MF>;
|
||||
close($MF);
|
||||
my $t = $/;
|
||||
undef $/;
|
||||
open($MF,"$reldir\\Makefile")
|
||||
|| open($MF,"$reldir\\GNUMakefile")
|
||||
|| croak "Could not open $reldir\\Makefile\n";
|
||||
my $mf = <$MF>;
|
||||
close($MF);
|
||||
|
||||
$mf =~ s{\\\s*[\r\n]+}{}mg;
|
||||
if ($mf =~ m{^(?:SUB)?DIRS[^=]*=\s*(.*)$}mg)
|
||||
{
|
||||
foreach my $subdir (split /\s+/,$1)
|
||||
{
|
||||
next
|
||||
if $subdir eq "\$(top_builddir)/src/timezone"; #special case for non-standard include
|
||||
next
|
||||
if $reldir . "\\" . $subdir eq "src\\backend\\port\\darwin";
|
||||
$mf =~ s{\\\s*[\r\n]+}{}mg;
|
||||
if ($mf =~ m{^(?:SUB)?DIRS[^=]*=\s*(.*)$}mg)
|
||||
{
|
||||
foreach my $subdir (split /\s+/,$1)
|
||||
{
|
||||
next
|
||||
if $subdir eq "\$(top_builddir)/src/timezone"
|
||||
; #special case for non-standard include
|
||||
next
|
||||
if $reldir . "\\" . $subdir eq "src\\backend\\port\\darwin";
|
||||
|
||||
$self->AddDir($reldir . "\\" . $subdir);
|
||||
}
|
||||
}
|
||||
while ($mf =~ m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m)
|
||||
{
|
||||
my $s = $1;
|
||||
my $filter_re = qr{\$\(filter ([^,]+),\s+\$\(([^\)]+)\)\)};
|
||||
while ($s =~ /$filter_re/)
|
||||
{
|
||||
$self->AddDir($reldir . "\\" . $subdir);
|
||||
}
|
||||
}
|
||||
while ($mf =~ m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m)
|
||||
{
|
||||
my $s = $1;
|
||||
my $filter_re = qr{\$\(filter ([^,]+),\s+\$\(([^\)]+)\)\)};
|
||||
while ($s =~ /$filter_re/)
|
||||
{
|
||||
|
||||
# Process $(filter a b c, $(VAR)) expressions
|
||||
my $list = $1;
|
||||
my $filter = $2;
|
||||
$list =~ s/\.o/\.c/g;
|
||||
my @pieces = split /\s+/, $list;
|
||||
my $matches = "";
|
||||
foreach my $p (@pieces)
|
||||
{
|
||||
# Process $(filter a b c, $(VAR)) expressions
|
||||
my $list = $1;
|
||||
my $filter = $2;
|
||||
$list =~ s/\.o/\.c/g;
|
||||
my @pieces = split /\s+/, $list;
|
||||
my $matches = "";
|
||||
foreach my $p (@pieces)
|
||||
{
|
||||
|
||||
if ($filter eq "LIBOBJS")
|
||||
{
|
||||
if (grep(/$p/, @main::pgportfiles) == 1)
|
||||
{
|
||||
$p =~ s/\.c/\.o/;
|
||||
$matches .= $p . " ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
confess "Unknown filter $filter\n";
|
||||
}
|
||||
}
|
||||
$s =~ s/$filter_re/$matches/;
|
||||
}
|
||||
foreach my $f (split /\s+/,$s)
|
||||
{
|
||||
next if $f =~ /^\s*$/;
|
||||
next if $f eq "\\";
|
||||
next if $f =~ /\/SUBSYS.o$/;
|
||||
$f =~ s/,$//; # Remove trailing comma that can show up from filter stuff
|
||||
next unless $f =~ /.*\.o$/;
|
||||
$f =~ s/\.o$/\.c/;
|
||||
if ($f =~ /^\$\(top_builddir\)\/(.*)/)
|
||||
{
|
||||
$f = $1;
|
||||
$f =~ s/\//\\/g;
|
||||
$self->{files}->{$f} = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$f =~ s/\//\\/g;
|
||||
$self->{files}->{"$reldir\\$f"} = 1;
|
||||
}
|
||||
}
|
||||
$mf =~ s{OBJS[^=]*=\s*(.*)$}{}m;
|
||||
}
|
||||
if ($filter eq "LIBOBJS")
|
||||
{
|
||||
if (grep(/$p/, @main::pgportfiles) == 1)
|
||||
{
|
||||
$p =~ s/\.c/\.o/;
|
||||
$matches .= $p . " ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
confess "Unknown filter $filter\n";
|
||||
}
|
||||
}
|
||||
$s =~ s/$filter_re/$matches/;
|
||||
}
|
||||
foreach my $f (split /\s+/,$s)
|
||||
{
|
||||
next if $f =~ /^\s*$/;
|
||||
next if $f eq "\\";
|
||||
next if $f =~ /\/SUBSYS.o$/;
|
||||
$f =~ s/,$//; # Remove trailing comma that can show up from filter stuff
|
||||
next unless $f =~ /.*\.o$/;
|
||||
$f =~ s/\.o$/\.c/;
|
||||
if ($f =~ /^\$\(top_builddir\)\/(.*)/)
|
||||
{
|
||||
$f = $1;
|
||||
$f =~ s/\//\\/g;
|
||||
$self->{files}->{$f} = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$f =~ s/\//\\/g;
|
||||
$self->{files}->{"$reldir\\$f"} = 1;
|
||||
}
|
||||
}
|
||||
$mf =~ s{OBJS[^=]*=\s*(.*)$}{}m;
|
||||
}
|
||||
|
||||
# Match rules that pull in source files from different directories, eg
|
||||
# pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
|
||||
my $replace_re = qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+$}m;
|
||||
while ($mf =~ m{$replace_re}m)
|
||||
{
|
||||
my $match = $1;
|
||||
my $top = $2;
|
||||
my $target = $3;
|
||||
$target =~ s{/}{\\}g;
|
||||
my @pieces = split /\s+/,$match;
|
||||
foreach my $fn (@pieces)
|
||||
{
|
||||
if ($top eq "(top_srcdir)")
|
||||
{
|
||||
eval { $self->ReplaceFile($fn, $target) };
|
||||
}
|
||||
elsif ($top eq "(backend_src)")
|
||||
{
|
||||
eval { $self->ReplaceFile($fn, "src\\backend\\$target") };
|
||||
}
|
||||
else
|
||||
{
|
||||
confess "Bad replacement top: $top, on line $_\n";
|
||||
}
|
||||
}
|
||||
$mf =~ s{$replace_re}{}m;
|
||||
}
|
||||
# Match rules that pull in source files from different directories, eg
|
||||
# pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
|
||||
my $replace_re = qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+$}m;
|
||||
while ($mf =~ m{$replace_re}m)
|
||||
{
|
||||
my $match = $1;
|
||||
my $top = $2;
|
||||
my $target = $3;
|
||||
$target =~ s{/}{\\}g;
|
||||
my @pieces = split /\s+/,$match;
|
||||
foreach my $fn (@pieces)
|
||||
{
|
||||
if ($top eq "(top_srcdir)")
|
||||
{
|
||||
eval { $self->ReplaceFile($fn, $target) };
|
||||
}
|
||||
elsif ($top eq "(backend_src)")
|
||||
{
|
||||
eval { $self->ReplaceFile($fn, "src\\backend\\$target") };
|
||||
}
|
||||
else
|
||||
{
|
||||
confess "Bad replacement top: $top, on line $_\n";
|
||||
}
|
||||
}
|
||||
$mf =~ s{$replace_re}{}m;
|
||||
}
|
||||
|
||||
# See if this Makefile contains a description, and should have a RC file
|
||||
if ($mf =~ /^PGFILEDESC\s*=\s*\"([^\"]+)\"/m)
|
||||
{
|
||||
my $desc = $1;
|
||||
my $ico;
|
||||
if ($mf =~ /^PGAPPICON\s*=\s*(.*)$/m) { $ico = $1; }
|
||||
$self->AddResourceFile($reldir,$desc,$ico);
|
||||
}
|
||||
$/ = $t;
|
||||
# See if this Makefile contains a description, and should have a RC file
|
||||
if ($mf =~ /^PGFILEDESC\s*=\s*\"([^\"]+)\"/m)
|
||||
{
|
||||
my $desc = $1;
|
||||
my $ico;
|
||||
if ($mf =~ /^PGAPPICON\s*=\s*(.*)$/m) { $ico = $1; }
|
||||
$self->AddResourceFile($reldir,$desc,$ico);
|
||||
}
|
||||
$/ = $t;
|
||||
}
|
||||
|
||||
sub AddResourceFile
|
||||
{
|
||||
my ($self, $dir, $desc, $ico) = @_;
|
||||
my ($self, $dir, $desc, $ico) = @_;
|
||||
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
my $d = ($year - 100) . "$yday";
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
my $d = ($year - 100) . "$yday";
|
||||
|
||||
if (Solution::IsNewer("$dir\\win32ver.rc",'src\port\win32ver.rc'))
|
||||
{
|
||||
print "Generating win32ver.rc for $dir\n";
|
||||
open(I,'src\port\win32ver.rc') || confess "Could not open win32ver.rc";
|
||||
open(O,">$dir\\win32ver.rc") || confess "Could not write win32ver.rc";
|
||||
my $icostr = $ico?"IDI_ICON ICON \"src/port/$ico.ico\"":"";
|
||||
while (<I>)
|
||||
{
|
||||
s/FILEDESC/"$desc"/gm;
|
||||
s/_ICO_/$icostr/gm;
|
||||
s/(VERSION.*),0/$1,$d/;
|
||||
if ($self->{type} eq "dll")
|
||||
{
|
||||
s/VFT_APP/VFT_DLL/gm;
|
||||
}
|
||||
print O;
|
||||
}
|
||||
}
|
||||
close(O);
|
||||
close(I);
|
||||
$self->AddFile("$dir\\win32ver.rc");
|
||||
if (Solution::IsNewer("$dir\\win32ver.rc",'src\port\win32ver.rc'))
|
||||
{
|
||||
print "Generating win32ver.rc for $dir\n";
|
||||
open(I,'src\port\win32ver.rc') || confess "Could not open win32ver.rc";
|
||||
open(O,">$dir\\win32ver.rc") || confess "Could not write win32ver.rc";
|
||||
my $icostr = $ico?"IDI_ICON ICON \"src/port/$ico.ico\"":"";
|
||||
while (<I>)
|
||||
{
|
||||
s/FILEDESC/"$desc"/gm;
|
||||
s/_ICO_/$icostr/gm;
|
||||
s/(VERSION.*),0/$1,$d/;
|
||||
if ($self->{type} eq "dll")
|
||||
{
|
||||
s/VFT_APP/VFT_DLL/gm;
|
||||
}
|
||||
print O;
|
||||
}
|
||||
}
|
||||
close(O);
|
||||
close(I);
|
||||
$self->AddFile("$dir\\win32ver.rc");
|
||||
}
|
||||
|
||||
sub DisableLinkerWarnings
|
||||
{
|
||||
my ($self, $warnings) = @_;
|
||||
my ($self, $warnings) = @_;
|
||||
|
||||
$self->{disablelinkerwarnings} .= ',' unless ($self->{disablelinkerwarnings} eq '');
|
||||
$self->{disablelinkerwarnings} .= $warnings;
|
||||
$self->{disablelinkerwarnings} .= ',' unless ($self->{disablelinkerwarnings} eq '');
|
||||
$self->{disablelinkerwarnings} .= $warnings;
|
||||
}
|
||||
|
||||
sub Save
|
||||
{
|
||||
my ($self) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
# If doing DLL and haven't specified a DEF file, do a full export of all symbols
|
||||
# in the project.
|
||||
if ($self->{type} eq "dll" && !$self->{def})
|
||||
{
|
||||
$self->FullExportDLL($self->{name} . ".lib");
|
||||
}
|
||||
# If doing DLL and haven't specified a DEF file, do a full export of all symbols
|
||||
# in the project.
|
||||
if ($self->{type} eq "dll" && !$self->{def})
|
||||
{
|
||||
$self->FullExportDLL($self->{name} . ".lib");
|
||||
}
|
||||
|
||||
# Warning 4197 is about double exporting, disable this per
|
||||
# http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99193
|
||||
$self->DisableLinkerWarnings('4197') if ($self->{platform} eq 'x64');
|
||||
# Warning 4197 is about double exporting, disable this per
|
||||
# http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99193
|
||||
$self->DisableLinkerWarnings('4197') if ($self->{platform} eq 'x64');
|
||||
|
||||
# Dump the project
|
||||
open(F, ">$self->{name}$self->{filenameExtension}")
|
||||
|| croak("Could not write to $self->{name}$self->{filenameExtension}\n");
|
||||
$self->WriteHeader(*F);
|
||||
$self->WriteFiles(*F);
|
||||
$self->Footer(*F);
|
||||
close(F);
|
||||
# Dump the project
|
||||
open(F, ">$self->{name}$self->{filenameExtension}")
|
||||
|| croak("Could not write to $self->{name}$self->{filenameExtension}\n");
|
||||
$self->WriteHeader(*F);
|
||||
$self->WriteFiles(*F);
|
||||
$self->Footer(*F);
|
||||
close(F);
|
||||
}
|
||||
|
||||
sub GetAdditionalLinkerDependencies
|
||||
{
|
||||
my ($self, $cfgname, $seperator) = @_;
|
||||
my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd";
|
||||
my $libs = '';
|
||||
foreach my $lib (@{$self->{libraries}})
|
||||
{
|
||||
my $xlib = $lib;
|
||||
foreach my $slib (@{$self->{suffixlib}})
|
||||
{
|
||||
if ($slib eq $lib)
|
||||
{
|
||||
$xlib =~ s/\.lib$/$libcfg.lib/;
|
||||
last;
|
||||
}
|
||||
}
|
||||
$libs .= $xlib . $seperator;
|
||||
}
|
||||
$libs =~ s/.$//;
|
||||
$libs =~ s/__CFGNAME__/$cfgname/g;
|
||||
return $libs;
|
||||
my ($self, $cfgname, $seperator) = @_;
|
||||
my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd";
|
||||
my $libs = '';
|
||||
foreach my $lib (@{$self->{libraries}})
|
||||
{
|
||||
my $xlib = $lib;
|
||||
foreach my $slib (@{$self->{suffixlib}})
|
||||
{
|
||||
if ($slib eq $lib)
|
||||
{
|
||||
$xlib =~ s/\.lib$/$libcfg.lib/;
|
||||
last;
|
||||
}
|
||||
}
|
||||
$libs .= $xlib . $seperator;
|
||||
}
|
||||
$libs =~ s/.$//;
|
||||
$libs =~ s/__CFGNAME__/$cfgname/g;
|
||||
return $libs;
|
||||
}
|
||||
|
||||
# Utility function that loads a complete file
|
||||
sub read_file
|
||||
{
|
||||
my $filename = shift;
|
||||
my $F;
|
||||
my $t = $/;
|
||||
my $filename = shift;
|
||||
my $F;
|
||||
my $t = $/;
|
||||
|
||||
undef $/;
|
||||
open($F, $filename) || croak "Could not open file $filename\n";
|
||||
my $txt = <$F>;
|
||||
close($F);
|
||||
$/ = $t;
|
||||
undef $/;
|
||||
open($F, $filename) || croak "Could not open file $filename\n";
|
||||
my $txt = <$F>;
|
||||
close($F);
|
||||
$/ = $t;
|
||||
|
||||
return $txt;
|
||||
return $txt;
|
||||
}
|
||||
|
||||
1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,124 +13,124 @@ use base qw(Project);
|
||||
|
||||
sub _new
|
||||
{
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{filenameExtension} = '.vcproj';
|
||||
$self->{filenameExtension} = '.vcproj';
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub WriteHeader
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
my ($self, $f) = @_;
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject ProjectType="Visual C++" Version="$self->{vcver}" Name="$self->{name}" ProjectGUID="$self->{guid}">
|
||||
<Platforms><Platform Name="$self->{platform}"/></Platforms>
|
||||
<Configurations>
|
||||
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;
|
||||
$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;
|
||||
</Configurations>
|
||||
EOF
|
||||
$self->WriteReferences($f);
|
||||
$self->WriteReferences($f);
|
||||
}
|
||||
|
||||
sub WriteFiles
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
print $f <<EOF;
|
||||
my ($self, $f) = @_;
|
||||
print $f <<EOF;
|
||||
<Files>
|
||||
EOF
|
||||
my @dirstack = ();
|
||||
my %uniquefiles;
|
||||
foreach my $fileNameWithPath (sort keys %{ $self->{files} })
|
||||
{
|
||||
confess "Bad format filename '$fileNameWithPath'\n"
|
||||
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
|
||||
my $dir = $1;
|
||||
my $file = $2;
|
||||
my @dirstack = ();
|
||||
my %uniquefiles;
|
||||
foreach my $fileNameWithPath (sort keys %{$self->{files}})
|
||||
{
|
||||
confess "Bad format filename '$fileNameWithPath'\n"
|
||||
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
|
||||
my $dir = $1;
|
||||
my $file = $2;
|
||||
|
||||
# Walk backwards down the directory stack and close any dirs we're done with
|
||||
while ($#dirstack >= 0)
|
||||
{
|
||||
if (join('\\',@dirstack) eq substr($dir, 0, length(join('\\',@dirstack))))
|
||||
{
|
||||
last if (length($dir) == length(join('\\',@dirstack)));
|
||||
last if (substr($dir, length(join('\\',@dirstack)),1) eq '\\');
|
||||
}
|
||||
print $f ' ' x $#dirstack . " </Filter>\n";
|
||||
pop @dirstack;
|
||||
}
|
||||
# Walk backwards down the directory stack and close any dirs we're done with
|
||||
while ($#dirstack >= 0)
|
||||
{
|
||||
if (join('\\',@dirstack) eq substr($dir, 0, length(join('\\',@dirstack))))
|
||||
{
|
||||
last if (length($dir) == length(join('\\',@dirstack)));
|
||||
last if (substr($dir, length(join('\\',@dirstack)),1) eq '\\');
|
||||
}
|
||||
print $f ' ' x $#dirstack . " </Filter>\n";
|
||||
pop @dirstack;
|
||||
}
|
||||
|
||||
# Now walk forwards and create whatever directories are needed
|
||||
while (join('\\',@dirstack) ne $dir)
|
||||
{
|
||||
my $left = substr($dir, length(join('\\',@dirstack)));
|
||||
$left =~ s/^\\//;
|
||||
my @pieces = split /\\/, $left;
|
||||
push @dirstack, $pieces[0];
|
||||
print $f ' ' x $#dirstack . " <Filter Name=\"$pieces[0]\" Filter=\"\">\n";
|
||||
}
|
||||
# Now walk forwards and create whatever directories are needed
|
||||
while (join('\\',@dirstack) ne $dir)
|
||||
{
|
||||
my $left = substr($dir, length(join('\\',@dirstack)));
|
||||
$left =~ s/^\\//;
|
||||
my @pieces = split /\\/, $left;
|
||||
push @dirstack, $pieces[0];
|
||||
print $f ' ' x $#dirstack . " <Filter Name=\"$pieces[0]\" Filter=\"\">\n";
|
||||
}
|
||||
|
||||
print $f ' ' x $#dirstack . " <File RelativePath=\"$fileNameWithPath\"";
|
||||
if ($fileNameWithPath =~ /\.y$/)
|
||||
{
|
||||
my $of = $fileNameWithPath;
|
||||
$of =~ s/\.y$/.c/;
|
||||
$of =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
|
||||
print $f '>'
|
||||
. $self->GenerateCustomTool('Running bison on ' . $fileNameWithPath,
|
||||
"perl src\\tools\\msvc\\pgbison.pl $fileNameWithPath", $of)
|
||||
. '</File>' . "\n";
|
||||
}
|
||||
elsif ($fileNameWithPath =~ /\.l$/)
|
||||
{
|
||||
my $of = $fileNameWithPath;
|
||||
$of =~ s/\.l$/.c/;
|
||||
print $f '>'
|
||||
. $self->GenerateCustomTool('Running flex on ' . $fileNameWithPath,
|
||||
"perl src\\tools\\msvc\\pgflex.pl $fileNameWithPath", $of)
|
||||
. '</File>' . "\n";
|
||||
}
|
||||
elsif (defined($uniquefiles{$file}))
|
||||
{
|
||||
print $f ' ' x $#dirstack . " <File RelativePath=\"$fileNameWithPath\"";
|
||||
if ($fileNameWithPath =~ /\.y$/)
|
||||
{
|
||||
my $of = $fileNameWithPath;
|
||||
$of =~ s/\.y$/.c/;
|
||||
$of =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
|
||||
print $f '>'
|
||||
. $self->GenerateCustomTool('Running bison on ' . $fileNameWithPath,
|
||||
"perl src\\tools\\msvc\\pgbison.pl $fileNameWithPath", $of)
|
||||
. '</File>' . "\n";
|
||||
}
|
||||
elsif ($fileNameWithPath =~ /\.l$/)
|
||||
{
|
||||
my $of = $fileNameWithPath;
|
||||
$of =~ s/\.l$/.c/;
|
||||
print $f '>'
|
||||
. $self->GenerateCustomTool('Running flex on ' . $fileNameWithPath,
|
||||
"perl src\\tools\\msvc\\pgflex.pl $fileNameWithPath", $of)
|
||||
. '</File>' . "\n";
|
||||
}
|
||||
elsif (defined($uniquefiles{$file}))
|
||||
{
|
||||
|
||||
# File already exists, so fake a new name
|
||||
my $obj = $dir;
|
||||
$obj =~ s/\\/_/g;
|
||||
print $f
|
||||
# File already exists, so fake a new name
|
||||
my $obj = $dir;
|
||||
$obj =~ s/\\/_/g;
|
||||
print $f
|
||||
"><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
|
||||
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
|
||||
. "_$file.obj\" /></FileConfiguration></File>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniquefiles{$file} = 1;
|
||||
print $f " />\n";
|
||||
}
|
||||
}
|
||||
while ($#dirstack >= 0)
|
||||
{
|
||||
print $f ' ' x $#dirstack . " </Filter>\n";
|
||||
pop @dirstack;
|
||||
}
|
||||
print $f <<EOF;
|
||||
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
|
||||
. "_$file.obj\" /></FileConfiguration></File>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniquefiles{$file} = 1;
|
||||
print $f " />\n";
|
||||
}
|
||||
}
|
||||
while ($#dirstack >= 0)
|
||||
{
|
||||
print $f ' ' x $#dirstack . " </Filter>\n";
|
||||
pop @dirstack;
|
||||
}
|
||||
print $f <<EOF;
|
||||
</Files>
|
||||
EOF
|
||||
}
|
||||
|
||||
sub Footer
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
my ($self, $f) = @_;
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<Globals/>
|
||||
</VisualStudioProject>
|
||||
EOF
|
||||
@ -138,13 +138,13 @@ EOF
|
||||
|
||||
sub WriteConfiguration
|
||||
{
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4);
|
||||
my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ' ');
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4);
|
||||
my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ' ');
|
||||
|
||||
my $targetmachine = $self->{platform} eq 'Win32' ? 1 : 17;
|
||||
my $targetmachine = $self->{platform} eq 'Win32' ? 1 : 17;
|
||||
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
<Configuration Name="$cfgname|$self->{platform}" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
|
||||
ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
|
||||
<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
|
||||
@ -154,7 +154,7 @@ sub WriteConfiguration
|
||||
RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
|
||||
AdditionalOptions="/MP"
|
||||
EOF
|
||||
print $f <<EOF;
|
||||
print $f <<EOF;
|
||||
AssemblerOutput="0" AssemblerListingLocation=".\\$cfgname\\$self->{name}\\" ObjectFile=".\\$cfgname\\$self->{name}\\"
|
||||
ProgramDataBaseFileName=".\\$cfgname\\$self->{name}\\" BrowseInformation="0"
|
||||
WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="3" CompileAs="0"/>
|
||||
@ -166,59 +166,59 @@ EOF
|
||||
GenerateMapFile="FALSE" MapFileName=".\\$cfgname\\$self->{name}\\$self->{name}.map"
|
||||
SubSystem="1" TargetMachine="$targetmachine"
|
||||
EOF
|
||||
if ($self->{disablelinkerwarnings})
|
||||
{
|
||||
print $f "\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n";
|
||||
}
|
||||
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";
|
||||
}
|
||||
if ($self->{disablelinkerwarnings})
|
||||
{
|
||||
print $f "\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n";
|
||||
}
|
||||
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
|
||||
print $f "\t/>\n";
|
||||
print $f
|
||||
"\t<Tool Name=\"VCLibrarianTool\" OutputFile=\".\\$cfgname\\$self->{name}\\$self->{name}.lib\" IgnoreDefaultLibraryNames=\"libc\" />\n";
|
||||
print $f
|
||||
"\t<Tool Name=\"VCResourceCompilerTool\" AdditionalIncludeDirectories=\"src\\include\" />\n";
|
||||
if ($self->{builddef})
|
||||
{
|
||||
print $f
|
||||
print $f
|
||||
"\t<Tool Name=\"VCResourceCompilerTool\" AdditionalIncludeDirectories=\"src\\include\" />\n";
|
||||
if ($self->{builddef})
|
||||
{
|
||||
print $f
|
||||
"\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}\" />\n";
|
||||
}
|
||||
print $f <<EOF;
|
||||
}
|
||||
print $f <<EOF;
|
||||
</Configuration>
|
||||
EOF
|
||||
}
|
||||
|
||||
sub WriteReferences
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
print $f " <References>\n";
|
||||
foreach my $ref (@{$self->{references}})
|
||||
{
|
||||
print $f
|
||||
my ($self, $f) = @_;
|
||||
print $f " <References>\n";
|
||||
foreach my $ref (@{$self->{references}})
|
||||
{
|
||||
print $f
|
||||
" <ProjectReference ReferencedProjectIdentifier=\"$ref->{guid}\" Name=\"$ref->{name}\" />\n";
|
||||
}
|
||||
print $f " </References>\n";
|
||||
}
|
||||
print $f " </References>\n";
|
||||
}
|
||||
|
||||
sub GenerateCustomTool
|
||||
{
|
||||
my ($self, $desc, $tool, $output, $cfg) = @_;
|
||||
if (!defined($cfg))
|
||||
{
|
||||
return $self->GenerateCustomTool($desc, $tool, $output, 'Debug')
|
||||
.$self->GenerateCustomTool($desc, $tool, $output, 'Release');
|
||||
}
|
||||
return
|
||||
my ($self, $desc, $tool, $output, $cfg) = @_;
|
||||
if (!defined($cfg))
|
||||
{
|
||||
return $self->GenerateCustomTool($desc, $tool, $output, 'Debug')
|
||||
.$self->GenerateCustomTool($desc, $tool, $output, 'Release');
|
||||
}
|
||||
return
|
||||
"<FileConfiguration Name=\"$cfg|$self->{platform}\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>";
|
||||
}
|
||||
|
||||
@ -234,13 +234,13 @@ use base qw(VCBuildProject);
|
||||
|
||||
sub new
|
||||
{
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '8.00';
|
||||
$self->{vcver} = '8.00';
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
package VC2008Project;
|
||||
@ -255,13 +255,13 @@ use base qw(VCBuildProject);
|
||||
|
||||
sub new
|
||||
{
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
my $classname = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '9.00';
|
||||
$self->{vcver} = '9.00';
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -22,101 +22,103 @@ our (@ISA, @EXPORT);
|
||||
|
||||
sub CreateSolution
|
||||
{
|
||||
my $visualStudioVersion = shift;
|
||||
my $visualStudioVersion = shift;
|
||||
|
||||
if (!defined($visualStudioVersion))
|
||||
{
|
||||
$visualStudioVersion = DetermineVisualStudioVersion();
|
||||
}
|
||||
if (!defined($visualStudioVersion))
|
||||
{
|
||||
$visualStudioVersion = DetermineVisualStudioVersion();
|
||||
}
|
||||
|
||||
if ($visualStudioVersion eq '8.00')
|
||||
{
|
||||
return new VS2005Solution(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '9.00')
|
||||
{
|
||||
return new VS2008Solution(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '10.00')
|
||||
{
|
||||
return new VS2010Solution(@_);
|
||||
}
|
||||
else
|
||||
{
|
||||
croak "The requested Visual Studio version is not supported.";
|
||||
}
|
||||
if ($visualStudioVersion eq '8.00')
|
||||
{
|
||||
return new VS2005Solution(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '9.00')
|
||||
{
|
||||
return new VS2008Solution(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '10.00')
|
||||
{
|
||||
return new VS2010Solution(@_);
|
||||
}
|
||||
else
|
||||
{
|
||||
croak "The requested Visual Studio version is not supported.";
|
||||
}
|
||||
}
|
||||
|
||||
sub CreateProject
|
||||
{
|
||||
my $visualStudioVersion = shift;
|
||||
my $visualStudioVersion = shift;
|
||||
|
||||
if (!defined($visualStudioVersion))
|
||||
{
|
||||
$visualStudioVersion = DetermineVisualStudioVersion();
|
||||
}
|
||||
if (!defined($visualStudioVersion))
|
||||
{
|
||||
$visualStudioVersion = DetermineVisualStudioVersion();
|
||||
}
|
||||
|
||||
if ($visualStudioVersion eq '8.00')
|
||||
{
|
||||
return new VC2005Project(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '9.00')
|
||||
{
|
||||
return new VC2008Project(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '10.00')
|
||||
{
|
||||
return new VC2010Project(@_);
|
||||
}
|
||||
else
|
||||
{
|
||||
croak "The requested Visual Studio version is not supported.";
|
||||
}
|
||||
if ($visualStudioVersion eq '8.00')
|
||||
{
|
||||
return new VC2005Project(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '9.00')
|
||||
{
|
||||
return new VC2008Project(@_);
|
||||
}
|
||||
elsif ($visualStudioVersion eq '10.00')
|
||||
{
|
||||
return new VC2010Project(@_);
|
||||
}
|
||||
else
|
||||
{
|
||||
croak "The requested Visual Studio version is not supported.";
|
||||
}
|
||||
}
|
||||
|
||||
sub DetermineVisualStudioVersion
|
||||
{
|
||||
my $nmakeVersion = shift;
|
||||
my $nmakeVersion = shift;
|
||||
|
||||
if (!defined($nmakeVersion))
|
||||
{
|
||||
if (!defined($nmakeVersion))
|
||||
{
|
||||
|
||||
# Determine version of nmake command, to set proper version of visual studio
|
||||
# we use nmake as it has existed for a long time and still exists in visual studio 2010
|
||||
open(P,"nmake /? 2>&1 |")
|
||||
|| croak "Unable to determine Visual Studio version: The nmake command wasn't found.";
|
||||
while(<P>)
|
||||
{
|
||||
chomp;
|
||||
if (/(\d+)\.(\d+)\.\d+(\.\d+)?$/)
|
||||
{
|
||||
return _GetVisualStudioVersion($1, $2);
|
||||
}
|
||||
}
|
||||
close(P);
|
||||
}
|
||||
elsif($nmakeVersion =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/)
|
||||
{
|
||||
return _GetVisualStudioVersion($1, $2);
|
||||
}
|
||||
croak "Unable to determine Visual Studio version: The nmake version could not be determined.";
|
||||
# Determine version of nmake command, to set proper version of visual studio
|
||||
# we use nmake as it has existed for a long time and still exists in visual studio 2010
|
||||
open(P,"nmake /? 2>&1 |")
|
||||
|| croak
|
||||
"Unable to determine Visual Studio version: The nmake command wasn't found.";
|
||||
while(<P>)
|
||||
{
|
||||
chomp;
|
||||
if (/(\d+)\.(\d+)\.\d+(\.\d+)?$/)
|
||||
{
|
||||
return _GetVisualStudioVersion($1, $2);
|
||||
}
|
||||
}
|
||||
close(P);
|
||||
}
|
||||
elsif($nmakeVersion =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/)
|
||||
{
|
||||
return _GetVisualStudioVersion($1, $2);
|
||||
}
|
||||
croak
|
||||
"Unable to determine Visual Studio version: The nmake version could not be determined.";
|
||||
}
|
||||
|
||||
sub _GetVisualStudioVersion
|
||||
{
|
||||
my($major, $minor) = @_;
|
||||
if ($major > 10)
|
||||
{
|
||||
carp
|
||||
my($major, $minor) = @_;
|
||||
if ($major > 10)
|
||||
{
|
||||
carp
|
||||
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
|
||||
return '10.00';
|
||||
}
|
||||
elsif ($major < 6)
|
||||
{
|
||||
croak
|
||||
return '10.00';
|
||||
}
|
||||
elsif ($major < 6)
|
||||
{
|
||||
croak
|
||||
"Unable to determine Visual Studio version: Visual Studio versions before 6.0 aren't supported.";
|
||||
}
|
||||
return "$major.$minor";
|
||||
}
|
||||
return "$major.$minor";
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -5,7 +5,7 @@
|
||||
BEGIN
|
||||
{
|
||||
|
||||
chdir("../../..") if (-d "../msvc" && -d "../../../src");
|
||||
chdir("../../..") if (-d "../msvc" && -d "../../../src");
|
||||
|
||||
}
|
||||
|
||||
@ -19,13 +19,13 @@ use Mkvcbuild;
|
||||
# it should contain lines like:
|
||||
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
||||
|
||||
if ( -e "src/tools/msvc/buildenv.pl")
|
||||
if (-e "src/tools/msvc/buildenv.pl")
|
||||
{
|
||||
require "src/tools/msvc/buildenv.pl";
|
||||
require "src/tools/msvc/buildenv.pl";
|
||||
}
|
||||
elsif (-e "./buildenv.pl" )
|
||||
elsif (-e "./buildenv.pl")
|
||||
{
|
||||
require "./buildenv.pl";
|
||||
require "./buildenv.pl";
|
||||
}
|
||||
|
||||
# set up the project
|
||||
@ -41,26 +41,26 @@ my $bconf = $ENV{CONFIG} || "Release";
|
||||
my $buildwhat = $ARGV[1] || "";
|
||||
if ($ARGV[0] eq 'DEBUG')
|
||||
{
|
||||
$bconf = "Debug";
|
||||
$bconf = "Debug";
|
||||
}
|
||||
elsif ($ARGV[0] ne "RELEASE")
|
||||
{
|
||||
$buildwhat = $ARGV[0] || "";
|
||||
$buildwhat = $ARGV[0] || "";
|
||||
}
|
||||
|
||||
# ... and do it
|
||||
|
||||
if ($buildwhat and $vcver eq '10.00')
|
||||
{
|
||||
system("msbuild $buildwhat.vcxproj /verbosity:detailed /p:Configuration=$bconf");
|
||||
system("msbuild $buildwhat.vcxproj /verbosity:detailed /p:Configuration=$bconf");
|
||||
}
|
||||
elsif ($buildwhat)
|
||||
{
|
||||
system("vcbuild $buildwhat.vcproj $bconf");
|
||||
system("vcbuild $buildwhat.vcproj $bconf");
|
||||
}
|
||||
else
|
||||
{
|
||||
system("msbuild pgsql.sln /verbosity:detailed /p:Configuration=$bconf");
|
||||
system("msbuild pgsql.sln /verbosity:detailed /p:Configuration=$bconf");
|
||||
}
|
||||
|
||||
# report status
|
||||
|
@ -26,7 +26,7 @@ die "bad DOCROOT '$docroot'" unless ($docroot && -d $docroot);
|
||||
my @notfound;
|
||||
foreach my $dir ('docbook', $openjade, $dsssl)
|
||||
{
|
||||
push(@notfound,$dir) unless -d "$docroot/$dir";
|
||||
push(@notfound,$dir) unless -d "$docroot/$dir";
|
||||
}
|
||||
missing() if @notfound;
|
||||
|
||||
@ -94,28 +94,28 @@ exit;
|
||||
sub renamefiles
|
||||
{
|
||||
|
||||
# Rename ISO entity files
|
||||
my $savedir = getcwd();
|
||||
chdir "$docroot/docbook";
|
||||
foreach my $f (glob('ISO*'))
|
||||
{
|
||||
next if $f =~ /\.gml$/i;
|
||||
my $nf = $f;
|
||||
$nf =~ s/ISO(.*)/ISO-$1.gml/;
|
||||
move $f, $nf;
|
||||
}
|
||||
chdir $savedir;
|
||||
# Rename ISO entity files
|
||||
my $savedir = getcwd();
|
||||
chdir "$docroot/docbook";
|
||||
foreach my $f (glob('ISO*'))
|
||||
{
|
||||
next if $f =~ /\.gml$/i;
|
||||
my $nf = $f;
|
||||
$nf =~ s/ISO(.*)/ISO-$1.gml/;
|
||||
move $f, $nf;
|
||||
}
|
||||
chdir $savedir;
|
||||
|
||||
}
|
||||
|
||||
sub missing
|
||||
{
|
||||
print STDERR "could not find $docroot/$_\n" foreach (@notfound);
|
||||
exit 1;
|
||||
print STDERR "could not find $docroot/$_\n" foreach (@notfound);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub noversion
|
||||
{
|
||||
print STDERR "Could not find version.sgml. ","Please run mkvcbuild.pl first!\n";
|
||||
exit 1;
|
||||
print STDERR "Could not find version.sgml. ","Please run mkvcbuild.pl first!\n";
|
||||
exit 1;
|
||||
}
|
||||
|
@ -3,25 +3,25 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
our $config = {
|
||||
asserts=>0, # --enable-cassert
|
||||
# integer_datetimes=>1, # --enable-integer-datetimes - on is now default
|
||||
# float4byval=>1, # --disable-float4-byval, on by default
|
||||
# float8byval=>0, # --disable-float8-byval, off by default
|
||||
# blocksize => 8, # --with-blocksize, 8kB by default
|
||||
# wal_blocksize => 8, # --with-wal-blocksize, 8kB by default
|
||||
# wal_segsize => 16, # --with-wal-segsize, 16MB by default
|
||||
ldap=>1, # --with-ldap
|
||||
nls=>undef, # --enable-nls=<path>
|
||||
tcl=>undef, # --with-tls=<path>
|
||||
perl=>undef, # --with-perl
|
||||
python=>undef, # --with-python=<path>
|
||||
krb5=>undef, # --with-krb5=<path>
|
||||
openssl=>undef, # --with-ssl=<path>
|
||||
uuid=>undef, # --with-ossp-uuid
|
||||
xml=>undef, # --with-libxml=<path>
|
||||
xslt=>undef, # --with-libxslt=<path>
|
||||
iconv=>undef, # (not in configure, path to iconv)
|
||||
zlib=>undef # --with-zlib=<path>
|
||||
asserts=>0, # --enable-cassert
|
||||
# integer_datetimes=>1, # --enable-integer-datetimes - on is now default
|
||||
# float4byval=>1, # --disable-float4-byval, on by default
|
||||
# float8byval=>0, # --disable-float8-byval, off by default
|
||||
# blocksize => 8, # --with-blocksize, 8kB by default
|
||||
# wal_blocksize => 8, # --with-wal-blocksize, 8kB by default
|
||||
# wal_segsize => 16, # --with-wal-segsize, 16MB by default
|
||||
ldap=>1, # --with-ldap
|
||||
nls=>undef, # --enable-nls=<path>
|
||||
tcl=>undef, # --with-tls=<path>
|
||||
perl=>undef, # --with-perl
|
||||
python=>undef, # --with-python=<path>
|
||||
krb5=>undef, # --with-krb5=<path>
|
||||
openssl=>undef, # --with-ssl=<path>
|
||||
uuid=>undef, # --with-ossp-uuid
|
||||
xml=>undef, # --with-libxml=<path>
|
||||
xslt=>undef, # --with-libxslt=<path>
|
||||
iconv=>undef, # (not in configure, path to iconv)
|
||||
zlib=>undef # --with-zlib=<path>
|
||||
};
|
||||
|
||||
1;
|
||||
|
@ -13,40 +13,40 @@ my $platform = $ARGV[1];
|
||||
|
||||
if (-f "$ARGV[0]/$defname.def")
|
||||
{
|
||||
print "Not re-generating $defname.DEF, file already exists.\n";
|
||||
exit(0);
|
||||
print "Not re-generating $defname.DEF, file already exists.\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
print "Generating $defname.DEF from directory $ARGV[0], platform $platform\n";
|
||||
|
||||
while (<$ARGV[0]/*.obj>)
|
||||
{
|
||||
my $symfile = $_;
|
||||
$symfile=~ s/\.obj$/.sym/i;
|
||||
print ".";
|
||||
system("dumpbin /symbols /out:symbols.out $_ >NUL") && die "Could not call dumpbin";
|
||||
open(F, "<symbols.out") || die "Could not open symbols.out for $_\n";
|
||||
while (<F>)
|
||||
{
|
||||
s/\(\)//g;
|
||||
my @pieces = split;
|
||||
next unless $pieces[0] =~ /^[A-F0-9]{3,}$/;
|
||||
next unless $pieces[6];
|
||||
next if ($pieces[2] eq "UNDEF");
|
||||
next unless ($pieces[4] eq "External");
|
||||
next if $pieces[6] =~ /^@/;
|
||||
next if $pieces[6] =~ /^\(/;
|
||||
next if $pieces[6] =~ /^__real/;
|
||||
next if $pieces[6] =~ /^__imp/;
|
||||
next if $pieces[6] =~ /NULL_THUNK_DATA$/;
|
||||
next if $pieces[6] =~ /^__IMPORT_DESCRIPTOR/;
|
||||
next if $pieces[6] =~ /^__NULL_IMPORT/;
|
||||
next if $pieces[6] =~ /^\?\?_C/;
|
||||
my $symfile = $_;
|
||||
$symfile=~ s/\.obj$/.sym/i;
|
||||
print ".";
|
||||
system("dumpbin /symbols /out:symbols.out $_ >NUL") && die "Could not call dumpbin";
|
||||
open(F, "<symbols.out") || die "Could not open symbols.out for $_\n";
|
||||
while (<F>)
|
||||
{
|
||||
s/\(\)//g;
|
||||
my @pieces = split;
|
||||
next unless $pieces[0] =~ /^[A-F0-9]{3,}$/;
|
||||
next unless $pieces[6];
|
||||
next if ($pieces[2] eq "UNDEF");
|
||||
next unless ($pieces[4] eq "External");
|
||||
next if $pieces[6] =~ /^@/;
|
||||
next if $pieces[6] =~ /^\(/;
|
||||
next if $pieces[6] =~ /^__real/;
|
||||
next if $pieces[6] =~ /^__imp/;
|
||||
next if $pieces[6] =~ /NULL_THUNK_DATA$/;
|
||||
next if $pieces[6] =~ /^__IMPORT_DESCRIPTOR/;
|
||||
next if $pieces[6] =~ /^__NULL_IMPORT/;
|
||||
next if $pieces[6] =~ /^\?\?_C/;
|
||||
|
||||
push @def, $pieces[6];
|
||||
}
|
||||
close(F);
|
||||
rename("symbols.out",$symfile);
|
||||
push @def, $pieces[6];
|
||||
}
|
||||
close(F);
|
||||
rename("symbols.out",$symfile);
|
||||
}
|
||||
print "\n";
|
||||
|
||||
@ -56,13 +56,13 @@ my $i = 0;
|
||||
my $last = "";
|
||||
foreach my $f (sort @def)
|
||||
{
|
||||
next if ($f eq $last);
|
||||
$last = $f;
|
||||
$f =~ s/^_// unless ($platform eq "x64"); # win64 has new format of exports
|
||||
$i++;
|
||||
next if ($f eq $last);
|
||||
$last = $f;
|
||||
$f =~ s/^_// unless ($platform eq "x64"); # win64 has new format of exports
|
||||
$i++;
|
||||
|
||||
# print DEF " $f \@ $i\n"; # ordinaled exports?
|
||||
print DEF " $f\n";
|
||||
# print DEF " $f \@ $i\n"; # ordinaled exports?
|
||||
print DEF " $f\n";
|
||||
}
|
||||
close(DEF);
|
||||
print "Generated $i symbols\n";
|
||||
|
@ -13,6 +13,6 @@ Install($target);
|
||||
|
||||
sub Usage
|
||||
{
|
||||
print "Usage: install.pl <targetdir>\n";
|
||||
exit(1);
|
||||
print "Usage: install.pl <targetdir>\n";
|
||||
exit(1);
|
||||
}
|
||||
|
@ -14,21 +14,21 @@ $bisonver=(split(/\s+/,$bisonver))[3]; # grab version number
|
||||
|
||||
unless ($bisonver eq '1.875' || $bisonver ge '2.2')
|
||||
{
|
||||
print "WARNING! Bison install not found, or unsupported Bison version.\n";
|
||||
print "echo Attempting to build without.\n";
|
||||
exit 0;
|
||||
print "WARNING! Bison install not found, or unsupported Bison version.\n";
|
||||
print "echo Attempting to build without.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $input = shift;
|
||||
if ($input !~ /\.y$/)
|
||||
{
|
||||
print "Input must be a .y file\n";
|
||||
exit 1;
|
||||
print "Input must be a .y file\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif (!-e $input)
|
||||
{
|
||||
print "Input file $input not found\n";
|
||||
exit 1;
|
||||
print "Input file $input not found\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
(my $output = $input) =~ s/\.y$/.c/;
|
||||
|
@ -13,26 +13,26 @@ use File::Basename;
|
||||
require 'src/tools/msvc/buildenv.pl' if -e 'src/tools/msvc/buildenv.pl';
|
||||
|
||||
my ($flexver) = `flex -V`; # grab first line
|
||||
$flexver=(split(/\s+/,$flexver))[1];
|
||||
$flexver =~ s/[^0-9.]//g;
|
||||
$flexver=(split(/\s+/,$flexver))[1];
|
||||
$flexver =~ s/[^0-9.]//g;
|
||||
my @verparts = split(/\./,$flexver);
|
||||
unless ($verparts[0] == 2 && $verparts[1] == 5 && $verparts[2] >= 31)
|
||||
{
|
||||
print "WARNING! Flex install not found, or unsupported Flex version.\n";
|
||||
print "echo Attempting to build without.\n";
|
||||
exit 0;
|
||||
print "WARNING! Flex install not found, or unsupported Flex version.\n";
|
||||
print "echo Attempting to build without.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $input = shift;
|
||||
if ($input !~ /\.l$/)
|
||||
{
|
||||
print "Input must be a .l file\n";
|
||||
exit 1;
|
||||
print "Input must be a .l file\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif (!-e $input)
|
||||
{
|
||||
print "Input file $input not found\n";
|
||||
exit 1;
|
||||
print "Input file $input not found\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
(my $output = $input) =~ s/\.l$/.c/;
|
||||
@ -50,25 +50,25 @@ system("flex $flexflags -o$output $input");
|
||||
if ($? == 0)
|
||||
{
|
||||
|
||||
# For non-reentrant scanners we need to fix up the yywrap macro definition
|
||||
# to keep the MS compiler happy.
|
||||
# For reentrant scanners (like the core scanner) we do not
|
||||
# need to (and must not) change the yywrap definition.
|
||||
my $lfile;
|
||||
open($lfile,$input) || die "opening $input for reading: $!";
|
||||
my $lcode = <$lfile>;
|
||||
close($lfile);
|
||||
if ($lcode !~ /\%option\sreentrant/)
|
||||
{
|
||||
my $cfile;
|
||||
open($cfile,$output) || die "opening $output for reading: $!";
|
||||
my $ccode = <$cfile>;
|
||||
close($cfile);
|
||||
$ccode =~ s/yywrap\(n\)/yywrap()/;
|
||||
open($cfile,">$output") || die "opening $output for reading: $!";
|
||||
print $cfile $ccode;
|
||||
close($cfile);
|
||||
}
|
||||
# For non-reentrant scanners we need to fix up the yywrap macro definition
|
||||
# to keep the MS compiler happy.
|
||||
# For reentrant scanners (like the core scanner) we do not
|
||||
# need to (and must not) change the yywrap definition.
|
||||
my $lfile;
|
||||
open($lfile,$input) || die "opening $input for reading: $!";
|
||||
my $lcode = <$lfile>;
|
||||
close($lfile);
|
||||
if ($lcode !~ /\%option\sreentrant/)
|
||||
{
|
||||
my $cfile;
|
||||
open($cfile,$output) || die "opening $output for reading: $!";
|
||||
my $ccode = <$cfile>;
|
||||
close($cfile);
|
||||
$ccode =~ s/yywrap\(n\)/yywrap()/;
|
||||
open($cfile,">$output") || die "opening $output for reading: $!";
|
||||
print $cfile $ccode;
|
||||
close($cfile);
|
||||
}
|
||||
if ($flexflags =~ /\s-b\s/)
|
||||
{
|
||||
my $lexback = "lex.backup";
|
||||
@ -84,11 +84,11 @@ if ($? == 0)
|
||||
unlink $lexback;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
exit 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
exit $? >> 8;
|
||||
exit $? >> 8;
|
||||
}
|
||||
|
||||
|
@ -20,19 +20,19 @@ require 'src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
|
||||
# it should contian lines like:
|
||||
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
||||
|
||||
if ( -e "src/tools/msvc/buildenv.pl")
|
||||
if (-e "src/tools/msvc/buildenv.pl")
|
||||
{
|
||||
require "src/tools/msvc/buildenv.pl";
|
||||
require "src/tools/msvc/buildenv.pl";
|
||||
}
|
||||
|
||||
my $what = shift || "";
|
||||
if ($what =~ /^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck)$/i)
|
||||
{
|
||||
$what = uc $what;
|
||||
$what = uc $what;
|
||||
}
|
||||
else
|
||||
{
|
||||
usage();
|
||||
usage();
|
||||
}
|
||||
|
||||
# use a capital C here because config.pl has $config
|
||||
@ -48,8 +48,8 @@ $ENV{PATH} = "../../../$Config/libpq;../../$Config/libpq;$ENV{PATH}";
|
||||
my $schedule = shift;
|
||||
unless ($schedule)
|
||||
{
|
||||
$schedule = "serial";
|
||||
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
|
||||
$schedule = "serial";
|
||||
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
|
||||
}
|
||||
|
||||
my $topdir = getcwd();
|
||||
@ -67,12 +67,12 @@ $temp_config = "--temp-config=\"$ENV{TEMP_CONFIG}\""
|
||||
chdir "src/test/regress";
|
||||
|
||||
my %command = (
|
||||
CHECK => \&check,
|
||||
PLCHECK => \&plcheck,
|
||||
INSTALLCHECK => \&installcheck,
|
||||
ECPGCHECK => \&ecpgcheck,
|
||||
CONTRIBCHECK => \&contribcheck,
|
||||
ISOLATIONCHECK => \&isolationcheck,
|
||||
CHECK => \&check,
|
||||
PLCHECK => \&plcheck,
|
||||
INSTALLCHECK => \&installcheck,
|
||||
ECPGCHECK => \&ecpgcheck,
|
||||
CONTRIBCHECK => \&contribcheck,
|
||||
ISOLATIONCHECK => \&isolationcheck,
|
||||
);
|
||||
|
||||
my $proc = $command{$what};
|
||||
@ -87,229 +87,229 @@ exit 0;
|
||||
|
||||
sub installcheck
|
||||
{
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
|
||||
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII","--no-locale"
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
system(@args);
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
|
||||
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII","--no-locale"
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
system(@args);
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
}
|
||||
|
||||
sub check
|
||||
{
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
|
||||
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII","--no-locale",
|
||||
"--temp-install=./tmp_check","--top-builddir=\"$topdir\""
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
push(@args,$temp_config) if $temp_config;
|
||||
system(@args);
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
|
||||
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII","--no-locale",
|
||||
"--temp-install=./tmp_check","--top-builddir=\"$topdir\""
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
push(@args,$temp_config) if $temp_config;
|
||||
system(@args);
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
}
|
||||
|
||||
sub ecpgcheck
|
||||
{
|
||||
chdir $startdir;
|
||||
system("msbuild ecpg_regression.proj /p:config=$Config");
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
chdir "$topdir/src/interfaces/ecpg/test";
|
||||
$schedule="ecpg";
|
||||
my @args = (
|
||||
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
|
||||
"--psqldir=../../../$Config/psql",
|
||||
"--dbname=regress1,connectdb",
|
||||
"--create-role=connectuser,connectdb",
|
||||
"--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII",
|
||||
"--no-locale",
|
||||
"--temp-install=./tmp_chk",
|
||||
"--top-builddir=\"$topdir\""
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
system(@args);
|
||||
$status = $? >>8;
|
||||
exit $status if $status;
|
||||
chdir $startdir;
|
||||
system("msbuild ecpg_regression.proj /p:config=$Config");
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
chdir "$topdir/src/interfaces/ecpg/test";
|
||||
$schedule="ecpg";
|
||||
my @args = (
|
||||
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
|
||||
"--psqldir=../../../$Config/psql",
|
||||
"--dbname=regress1,connectdb",
|
||||
"--create-role=connectuser,connectdb",
|
||||
"--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII",
|
||||
"--no-locale",
|
||||
"--temp-install=./tmp_chk",
|
||||
"--top-builddir=\"$topdir\""
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
system(@args);
|
||||
$status = $? >>8;
|
||||
exit $status if $status;
|
||||
}
|
||||
|
||||
sub isolationcheck
|
||||
{
|
||||
chdir "../isolation";
|
||||
copy("../../../$Config/isolationtester/isolationtester.exe",".");
|
||||
my @args = (
|
||||
"../../../$Config/pg_isolation_regress/pg_isolation_regress",
|
||||
"--psqldir=../../../$Config/psql",
|
||||
"--inputdir=.","--schedule=./isolation_schedule"
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
system(@args);
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
chdir "../isolation";
|
||||
copy("../../../$Config/isolationtester/isolationtester.exe",".");
|
||||
my @args = (
|
||||
"../../../$Config/pg_isolation_regress/pg_isolation_regress",
|
||||
"--psqldir=../../../$Config/psql",
|
||||
"--inputdir=.","--schedule=./isolation_schedule"
|
||||
);
|
||||
push(@args,$maxconn) if $maxconn;
|
||||
system(@args);
|
||||
my $status = $? >>8;
|
||||
exit $status if $status;
|
||||
}
|
||||
|
||||
sub plcheck
|
||||
{
|
||||
chdir "../../pl";
|
||||
chdir "../../pl";
|
||||
|
||||
foreach my $pl (glob("*"))
|
||||
{
|
||||
next unless -d "$pl/sql" && -d "$pl/expected";
|
||||
my $lang = $pl eq 'tcl' ? 'pltcl' : $pl;
|
||||
next unless -d "../../$Config/$lang";
|
||||
$lang = 'plpythonu' if $lang eq 'plpython';
|
||||
my @lang_args = ("--load-extension=$lang");
|
||||
chdir $pl;
|
||||
my @tests = fetchTests();
|
||||
if ($lang eq 'plperl')
|
||||
{
|
||||
foreach my $pl (glob("*"))
|
||||
{
|
||||
next unless -d "$pl/sql" && -d "$pl/expected";
|
||||
my $lang = $pl eq 'tcl' ? 'pltcl' : $pl;
|
||||
next unless -d "../../$Config/$lang";
|
||||
$lang = 'plpythonu' if $lang eq 'plpython';
|
||||
my @lang_args = ("--load-extension=$lang");
|
||||
chdir $pl;
|
||||
my @tests = fetchTests();
|
||||
if ($lang eq 'plperl')
|
||||
{
|
||||
|
||||
# run both trusted and untrusted perl tests
|
||||
push(@lang_args, "--load-extension=plperlu");
|
||||
# run both trusted and untrusted perl tests
|
||||
push(@lang_args, "--load-extension=plperlu");
|
||||
|
||||
# assume we're using this perl to built postgres
|
||||
# test if we can run two interpreters in one backend, and if so
|
||||
# run the trusted/untrusted interaction tests
|
||||
use Config;
|
||||
if ($Config{usemultiplicity} eq 'define')
|
||||
{
|
||||
push(@tests,'plperl_plperlu');
|
||||
}
|
||||
}
|
||||
print "============================================================\n";
|
||||
print "Checking $lang\n";
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress",
|
||||
"--psqldir=../../../$Config/psql",
|
||||
"--dbname=pl_regression",@lang_args,@tests
|
||||
);
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
chdir "..";
|
||||
}
|
||||
# assume we're using this perl to built postgres
|
||||
# test if we can run two interpreters in one backend, and if so
|
||||
# run the trusted/untrusted interaction tests
|
||||
use Config;
|
||||
if ($Config{usemultiplicity} eq 'define')
|
||||
{
|
||||
push(@tests,'plperl_plperlu');
|
||||
}
|
||||
}
|
||||
print "============================================================\n";
|
||||
print "Checking $lang\n";
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress",
|
||||
"--psqldir=../../../$Config/psql",
|
||||
"--dbname=pl_regression",@lang_args,@tests
|
||||
);
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
chdir "..";
|
||||
}
|
||||
|
||||
chdir "../../..";
|
||||
chdir "../../..";
|
||||
}
|
||||
|
||||
sub contribcheck
|
||||
{
|
||||
chdir "../../../contrib";
|
||||
my $mstat = 0;
|
||||
foreach my $module (glob("*"))
|
||||
{
|
||||
next if ($module eq 'sepgsql');
|
||||
next if ($module eq 'xml2' && !$config->{xml});
|
||||
next
|
||||
unless -d "$module/sql"
|
||||
&&-d "$module/expected"
|
||||
&&(-f "$module/GNUmakefile" || -f "$module/Makefile");
|
||||
chdir $module;
|
||||
print "============================================================\n";
|
||||
print "Checking $module\n";
|
||||
my @tests = fetchTests();
|
||||
my @opts = fetchRegressOpts();
|
||||
my @args = (
|
||||
"../../$Config/pg_regress/pg_regress",
|
||||
"--psqldir=../../$Config/psql",
|
||||
"--dbname=contrib_regression",@opts,@tests
|
||||
);
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
$mstat ||= $status;
|
||||
chdir "..";
|
||||
}
|
||||
exit $mstat if $mstat;
|
||||
chdir "../../../contrib";
|
||||
my $mstat = 0;
|
||||
foreach my $module (glob("*"))
|
||||
{
|
||||
next if ($module eq 'sepgsql');
|
||||
next if ($module eq 'xml2' && !$config->{xml});
|
||||
next
|
||||
unless -d "$module/sql"
|
||||
&&-d "$module/expected"
|
||||
&&(-f "$module/GNUmakefile" || -f "$module/Makefile");
|
||||
chdir $module;
|
||||
print "============================================================\n";
|
||||
print "Checking $module\n";
|
||||
my @tests = fetchTests();
|
||||
my @opts = fetchRegressOpts();
|
||||
my @args = (
|
||||
"../../$Config/pg_regress/pg_regress",
|
||||
"--psqldir=../../$Config/psql",
|
||||
"--dbname=contrib_regression",@opts,@tests
|
||||
);
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
$mstat ||= $status;
|
||||
chdir "..";
|
||||
}
|
||||
exit $mstat if $mstat;
|
||||
}
|
||||
|
||||
sub fetchRegressOpts
|
||||
{
|
||||
my $handle;
|
||||
open($handle,"<GNUmakefile")
|
||||
|| open($handle,"<Makefile")
|
||||
|| die "Could not open Makefile";
|
||||
local($/) = undef;
|
||||
my $m = <$handle>;
|
||||
close($handle);
|
||||
my @opts;
|
||||
if ($m =~ /^\s*REGRESS_OPTS\s*=(.*)/m)
|
||||
{
|
||||
my $handle;
|
||||
open($handle,"<GNUmakefile")
|
||||
|| open($handle,"<Makefile")
|
||||
|| die "Could not open Makefile";
|
||||
local($/) = undef;
|
||||
my $m = <$handle>;
|
||||
close($handle);
|
||||
my @opts;
|
||||
if ($m =~ /^\s*REGRESS_OPTS\s*=(.*)/m)
|
||||
{
|
||||
|
||||
# ignore options that use makefile variables - can't handle those
|
||||
# ignore anything that isn't an option staring with --
|
||||
@opts = grep { $_ !~ /\$\(/ && $_ =~ /^--/ } split(/\s+/,$1);
|
||||
}
|
||||
if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
|
||||
{
|
||||
push @opts, "--encoding=$1";
|
||||
}
|
||||
if ($m =~ /^\s*NO_LOCALE\s*=\s*\S+/m)
|
||||
{
|
||||
push @opts, "--no-locale";
|
||||
}
|
||||
return @opts;
|
||||
# ignore options that use makefile variables - can't handle those
|
||||
# ignore anything that isn't an option staring with --
|
||||
@opts = grep { $_ !~ /\$\(/ && $_ =~ /^--/ } split(/\s+/,$1);
|
||||
}
|
||||
if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
|
||||
{
|
||||
push @opts, "--encoding=$1";
|
||||
}
|
||||
if ($m =~ /^\s*NO_LOCALE\s*=\s*\S+/m)
|
||||
{
|
||||
push @opts, "--no-locale";
|
||||
}
|
||||
return @opts;
|
||||
}
|
||||
|
||||
sub fetchTests
|
||||
{
|
||||
|
||||
my $handle;
|
||||
open($handle,"<GNUmakefile")
|
||||
|| open($handle,"<Makefile")
|
||||
|| die "Could not open Makefile";
|
||||
local($/) = undef;
|
||||
my $m = <$handle>;
|
||||
close($handle);
|
||||
my $t = "";
|
||||
my $handle;
|
||||
open($handle,"<GNUmakefile")
|
||||
|| open($handle,"<Makefile")
|
||||
|| die "Could not open Makefile";
|
||||
local($/) = undef;
|
||||
my $m = <$handle>;
|
||||
close($handle);
|
||||
my $t = "";
|
||||
|
||||
$m =~ s/\\[\r\n]*//gs;
|
||||
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
|
||||
{
|
||||
$t = $1;
|
||||
$t =~ s/\s+/ /g;
|
||||
$m =~ s/\\[\r\n]*//gs;
|
||||
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
|
||||
{
|
||||
$t = $1;
|
||||
$t =~ s/\s+/ /g;
|
||||
|
||||
if ($m =~ /contrib\/pgcrypto/)
|
||||
{
|
||||
if ($m =~ /contrib\/pgcrypto/)
|
||||
{
|
||||
|
||||
# pgcrypto is special since the tests depend on the
|
||||
# configuration of the build
|
||||
# pgcrypto is special since the tests depend on the
|
||||
# configuration of the build
|
||||
|
||||
my $cftests =
|
||||
$config->{openssl}
|
||||
?GetTests("OSSL_TESTS",$m)
|
||||
: GetTests("INT_TESTS",$m);
|
||||
my $pgptests =
|
||||
$config->{zlib}
|
||||
?GetTests("ZLIB_TST",$m)
|
||||
: GetTests("ZLIB_OFF_TST",$m);
|
||||
$t =~ s/\$\(CF_TESTS\)/$cftests/;
|
||||
$t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
|
||||
}
|
||||
}
|
||||
my $cftests =
|
||||
$config->{openssl}
|
||||
?GetTests("OSSL_TESTS",$m)
|
||||
: GetTests("INT_TESTS",$m);
|
||||
my $pgptests =
|
||||
$config->{zlib}
|
||||
?GetTests("ZLIB_TST",$m)
|
||||
: GetTests("ZLIB_OFF_TST",$m);
|
||||
$t =~ s/\$\(CF_TESTS\)/$cftests/;
|
||||
$t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
|
||||
}
|
||||
}
|
||||
|
||||
return split(/\s+/,$t);
|
||||
return split(/\s+/,$t);
|
||||
}
|
||||
|
||||
sub GetTests
|
||||
{
|
||||
my $testname = shift;
|
||||
my $m = shift;
|
||||
if ($m =~ /^$testname\s*=\s*(.*)$/gm)
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
return "";
|
||||
my $testname = shift;
|
||||
my $m = shift;
|
||||
if ($m =~ /^$testname\s*=\s*(.*)$/gm)
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
sub usage
|
||||
{
|
||||
print STDERR
|
||||
"Usage: vcregress.pl ",
|
||||
"<check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]\n";
|
||||
exit(1);
|
||||
print STDERR
|
||||
"Usage: vcregress.pl ",
|
||||
"<check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]\n";
|
||||
exit(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user