mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Perltidy run over the MSVC build system files, to clean up code formatting
and indentation styles.
This commit is contained in:
@ -3,7 +3,7 @@ package Solution;
|
||||
#
|
||||
# Package that encapsulates a Visual C++ solution file generation
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.56 2010/03/03 03:29:37 adunstan Exp $
|
||||
# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.57 2010/04/09 13:05:58 mha Exp $
|
||||
#
|
||||
use Carp;
|
||||
use strict;
|
||||
@ -22,11 +22,12 @@ sub new
|
||||
platform => undef,
|
||||
};
|
||||
bless $self;
|
||||
# integer_datetimes is now the default
|
||||
$options->{integer_datetimes} = 1
|
||||
unless exists $options->{integer_datetimes};
|
||||
|
||||
# integer_datetimes is now the default
|
||||
$options->{integer_datetimes} = 1
|
||||
unless exists $options->{integer_datetimes};
|
||||
$options->{float4byval} = 1
|
||||
unless exists $options->{float4byval};
|
||||
unless exists $options->{float4byval};
|
||||
if ($options->{xml})
|
||||
{
|
||||
if (!($options->{xslt} && $options->{iconv}))
|
||||
@ -34,23 +35,23 @@ sub new
|
||||
die "XML requires both XSLT and ICONV\n";
|
||||
}
|
||||
}
|
||||
$options->{blocksize} = 8
|
||||
unless $options->{blocksize}; # undef or 0 means default
|
||||
die "Bad blocksize $options->{blocksize}"
|
||||
unless grep {$_ == $options->{blocksize}} (1,2,4,8,16,32);
|
||||
$options->{segsize} = 1
|
||||
unless $options->{segsize}; # undef or 0 means default
|
||||
# only allow segsize 1 for now, as we can't do large files yet in windows
|
||||
die "Bad segsize $options->{segsize}"
|
||||
unless $options->{segsize} == 1;
|
||||
$options->{wal_blocksize} = 8
|
||||
unless $options->{wal_blocksize}; # undef or 0 means default
|
||||
die "Bad wal_blocksize $options->{wal_blocksize}"
|
||||
unless grep {$_ == $options->{wal_blocksize}} (1,2,4,8,16,32,64);
|
||||
$options->{wal_segsize} = 16
|
||||
unless $options->{wal_segsize}; # undef or 0 means default
|
||||
die "Bad wal_segsize $options->{wal_segsize}"
|
||||
unless grep {$_ == $options->{wal_segsize}} (1,2,4,8,16,32,64);
|
||||
$options->{blocksize} = 8
|
||||
unless $options->{blocksize}; # undef or 0 means default
|
||||
die "Bad blocksize $options->{blocksize}"
|
||||
unless grep {$_ == $options->{blocksize}} (1,2,4,8,16,32);
|
||||
$options->{segsize} = 1
|
||||
unless $options->{segsize}; # undef or 0 means default
|
||||
# only allow segsize 1 for now, as we can't do large files yet in windows
|
||||
die "Bad segsize $options->{segsize}"
|
||||
unless $options->{segsize} == 1;
|
||||
$options->{wal_blocksize} = 8
|
||||
unless $options->{wal_blocksize}; # undef or 0 means default
|
||||
die "Bad wal_blocksize $options->{wal_blocksize}"
|
||||
unless grep {$_ == $options->{wal_blocksize}} (1,2,4,8,16,32,64);
|
||||
$options->{wal_segsize} = 16
|
||||
unless $options->{wal_segsize}; # undef or 0 means default
|
||||
die "Bad wal_segsize $options->{wal_segsize}"
|
||||
unless grep {$_ == $options->{wal_segsize}} (1,2,4,8,16,32,64);
|
||||
|
||||
$self->DetermineToolVersions();
|
||||
|
||||
@ -61,33 +62,35 @@ sub DetermineToolVersions
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
# Determine version of vcbuild command, to set proper verison of visual studio
|
||||
# Determine version of vcbuild command, to set proper verison of visual studio
|
||||
open(P,"vcbuild /? |") || die "vcbuild command not found";
|
||||
my $line = <P>;
|
||||
close(P);
|
||||
if ($line !~ /^Microsoft\s*\(R\) Visual C\+\+ Project Builder - \D+(\d+)\.00\.\d+/) {
|
||||
die "Unable to determine vcbuild version from first line of output!";
|
||||
if ($line !~ /^Microsoft\s*\(R\) Visual C\+\+ Project Builder - \D+(\d+)\.00\.\d+/)
|
||||
{
|
||||
die "Unable to determine vcbuild version from first line of output!";
|
||||
}
|
||||
if ($1 == 8) { $self->{vcver} = '8.00' }
|
||||
elsif ($1 == 9) { $self->{vcver} = '9.00' }
|
||||
else { die "Unsupported version of Visual Studio: $1" }
|
||||
print "Detected Visual Studio version $self->{vcver}\n";
|
||||
|
||||
# Determine if we are in 32 or 64-bit mode. Do this by seeing if CL has
|
||||
# 64-bit only parameters.
|
||||
$self->{platform} = 'Win32';
|
||||
open(P,"cl /? 2>NUL|") || die "cl command not found";
|
||||
while (<P>) {
|
||||
if (/^\/favor:</) {
|
||||
$self->{platform} = 'x64';
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(P);
|
||||
print "Detected hardware platform: $self->{platform}\n";
|
||||
# Determine if we are in 32 or 64-bit mode. Do this by seeing if CL has
|
||||
# 64-bit only parameters.
|
||||
$self->{platform} = 'Win32';
|
||||
open(P,"cl /? 2>NUL|") || die "cl command not found";
|
||||
while (<P>)
|
||||
{
|
||||
if (/^\/favor:</)
|
||||
{
|
||||
$self->{platform} = 'x64';
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(P);
|
||||
print "Detected hardware platform: $self->{platform}\n";
|
||||
}
|
||||
|
||||
|
||||
# Return 1 if $oldfile is newer than $newfile, or if $newfile doesn't exist.
|
||||
# Special case - if config.pl has changed, always return 1
|
||||
sub IsNewer
|
||||
@ -95,8 +98,11 @@ sub IsNewer
|
||||
my ($newfile, $oldfile) = @_;
|
||||
if ($oldfile ne 'src\tools\msvc\config.pl' && $oldfile ne 'src\tools\msvc\config_default.pl')
|
||||
{
|
||||
return 1 if (-f 'src\tools\msvc\config.pl') && IsNewer($newfile, 'src\tools\msvc\config.pl');
|
||||
return 1 if (-f 'src\tools\msvc\config_default.pl') && IsNewer($newfile, 'src\tools\msvc\config_default.pl');
|
||||
return 1
|
||||
if (-f 'src\tools\msvc\config.pl') && IsNewer($newfile, 'src\tools\msvc\config.pl');
|
||||
return 1
|
||||
if (-f 'src\tools\msvc\config_default.pl')
|
||||
&& IsNewer($newfile, 'src\tools\msvc\config_default.pl');
|
||||
}
|
||||
return 1 if (!(-e $newfile));
|
||||
my @nstat = stat($newfile);
|
||||
@ -161,7 +167,7 @@ sub GenerateFiles
|
||||
s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER) ", $bits-bit"};
|
||||
print O;
|
||||
}
|
||||
print O "#define PG_MAJORVERSION \"$self->{majorver}\"\n";
|
||||
print O "#define PG_MAJORVERSION \"$self->{majorver}\"\n";
|
||||
print O "#define LOCALEDIR \"/share/locale\"\n" if ($self->{options}->{nls});
|
||||
print O "/* defines added by config steps */\n";
|
||||
print O "#ifndef IGNORE_CONFIGURED_SETTINGS\n";
|
||||
@ -170,18 +176,15 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
|
||||
print O "#define USE_LDAP 1\n" if ($self->{options}->{ldap});
|
||||
print O "#define HAVE_LIBZ 1\n" if ($self->{options}->{zlib});
|
||||
print O "#define USE_SSL 1\n" if ($self->{options}->{openssl});
|
||||
print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
|
||||
print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
|
||||
|
||||
print O "#define BLCKSZ ",1024 * $self->{options}->{blocksize},"\n";
|
||||
print O "#define RELSEG_SIZE ",
|
||||
(1024 / $self->{options}->{blocksize}) *
|
||||
$self->{options}->{segsize} * 1024, "\n";
|
||||
print O "#define XLOG_BLCKSZ ",
|
||||
1024 * $self->{options}->{wal_blocksize},"\n";
|
||||
print O "#define XLOG_SEG_SIZE (",
|
||||
$self->{options}->{wal_segsize}," * 1024 * 1024)\n";
|
||||
|
||||
if ($self->{options}->{float4byval})
|
||||
print O "#define BLCKSZ ",1024 * $self->{options}->{blocksize},"\n";
|
||||
print O "#define RELSEG_SIZE ",
|
||||
(1024 / $self->{options}->{blocksize}) *$self->{options}->{segsize} * 1024, "\n";
|
||||
print O "#define XLOG_BLCKSZ ",1024 * $self->{options}->{wal_blocksize},"\n";
|
||||
print O "#define XLOG_SEG_SIZE (",$self->{options}->{wal_segsize}," * 1024 * 1024)\n";
|
||||
|
||||
if ($self->{options}->{float4byval})
|
||||
{
|
||||
print O "#define USE_FLOAT4_BYVAL 1\n";
|
||||
print O "#define FLOAT4PASSBYVAL true\n";
|
||||
@ -235,10 +238,23 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
|
||||
close(I);
|
||||
}
|
||||
|
||||
$self->GenerateDefFile("src\\interfaces\\libpq\\libpqdll.def","src\\interfaces\\libpq\\exports.txt","LIBPQ");
|
||||
$self->GenerateDefFile("src\\interfaces\\ecpg\\ecpglib\\ecpglib.def","src\\interfaces\\ecpg\\ecpglib\\exports.txt","LIBECPG");
|
||||
$self->GenerateDefFile("src\\interfaces\\ecpg\\compatlib\\compatlib.def","src\\interfaces\\ecpg\\compatlib\\exports.txt","LIBECPG_COMPAT");
|
||||
$self->GenerateDefFile("src\\interfaces\\ecpg\\pgtypeslib\\pgtypeslib.def","src\\interfaces\\ecpg\\pgtypeslib\\exports.txt","LIBPGTYPES");
|
||||
$self->GenerateDefFile("src\\interfaces\\libpq\\libpqdll.def",
|
||||
"src\\interfaces\\libpq\\exports.txt","LIBPQ");
|
||||
$self->GenerateDefFile(
|
||||
"src\\interfaces\\ecpg\\ecpglib\\ecpglib.def",
|
||||
"src\\interfaces\\ecpg\\ecpglib\\exports.txt",
|
||||
"LIBECPG"
|
||||
);
|
||||
$self->GenerateDefFile(
|
||||
"src\\interfaces\\ecpg\\compatlib\\compatlib.def",
|
||||
"src\\interfaces\\ecpg\\compatlib\\exports.txt",
|
||||
"LIBECPG_COMPAT"
|
||||
);
|
||||
$self->GenerateDefFile(
|
||||
"src\\interfaces\\ecpg\\pgtypeslib\\pgtypeslib.def",
|
||||
"src\\interfaces\\ecpg\\pgtypeslib\\exports.txt",
|
||||
"LIBPGTYPES"
|
||||
);
|
||||
|
||||
if (IsNewer('src\backend\utils\fmgrtab.c','src\include\catalog\pg_proc.h'))
|
||||
{
|
||||
@ -251,9 +267,11 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
|
||||
|
||||
if (IsNewer('src\include\utils\probes.h','src\backend\utils\probes.d'))
|
||||
{
|
||||
print "Generating probes.h...\n";
|
||||
system('psed -f src\backend\utils\Gen_dummy_probes.sed src\backend\utils\probes.d > src\include\utils\probes.h');
|
||||
}
|
||||
print "Generating probes.h...\n";
|
||||
system(
|
||||
'psed -f src\backend\utils\Gen_dummy_probes.sed src\backend\utils\probes.d > src\include\utils\probes.h'
|
||||
);
|
||||
}
|
||||
|
||||
if (IsNewer('src\interfaces\libpq\libpq.rc','src\interfaces\libpq\libpq.rc.in'))
|
||||
{
|
||||
@ -279,12 +297,7 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
|
||||
chdir('..\..\..');
|
||||
}
|
||||
|
||||
if (
|
||||
IsNewer(
|
||||
'src\interfaces\ecpg\preproc\preproc.y',
|
||||
'src\backend\parser\gram.y'
|
||||
)
|
||||
)
|
||||
if (IsNewer('src\interfaces\ecpg\preproc\preproc.y','src\backend\parser\gram.y'))
|
||||
{
|
||||
print "Generating preproc.y...\n";
|
||||
chdir('src\interfaces\ecpg\preproc');
|
||||
@ -307,8 +320,8 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
|
||||
#define HAVE_LONG_LONG_INT_64
|
||||
#define ENABLE_THREAD_SAFETY 1
|
||||
EOF
|
||||
print O "#define USE_INTEGER_DATETIMES 1\n" if ($self->{options}->{integer_datetimes});
|
||||
print O "#endif\n";
|
||||
print O "#define USE_INTEGER_DATETIMES 1\n" if ($self->{options}->{integer_datetimes});
|
||||
print O "#endif\n";
|
||||
close(O);
|
||||
}
|
||||
|
||||
@ -346,7 +359,9 @@ EOF
|
||||
print "Generating postgres.bki and schemapg.h...\n";
|
||||
chdir('src\backend\catalog');
|
||||
my $bki_srcs = join(' ../../../src/include/catalog/', @allbki);
|
||||
system("perl genbki.pl -I../../../src/include/catalog --set-version=$self->{majorver} $bki_srcs");
|
||||
system(
|
||||
"perl genbki.pl -I../../../src/include/catalog --set-version=$self->{majorver} $bki_srcs"
|
||||
);
|
||||
chdir('..\..\..');
|
||||
copyFile('src\backend\catalog\schemapg.h', 'src\include\catalog\schemapg.h');
|
||||
last;
|
||||
@ -417,7 +432,7 @@ sub AddProject
|
||||
{
|
||||
$proj->AddIncludeDir($self->{options}->{iconv} . '\include');
|
||||
$proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib');
|
||||
}
|
||||
}
|
||||
if ($self->{options}->{xml})
|
||||
{
|
||||
$proj->AddIncludeDir($self->{options}->{xml} . '\include');
|
||||
|
Reference in New Issue
Block a user