;
- close(P);
- if ($line !~ /^Microsoft\s*\(R\) Visual C\+\+ [^-]+ - \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';
--- 54,68 ----
die "Bad wal_segsize $options->{wal_segsize}"
unless grep {$_ == $options->{wal_segsize}} (1,2,4,8,16,32,64);
! $self->DeterminePlatform();
return $self;
}
! sub DeterminePlatform
{
my $self = shift;
# Determine if we are in 32 or 64-bit mode. Do this by seeing if CL has
# 64-bit only parameters.
$self->{platform} = 'Win32';
*************** sub AddProject
*** 428,434 ****
{
my ($self, $name, $type, $folder, $initialdir) = @_;
! my $proj = new Project($name, $type, $self);
push @{$self->{projects}->{$folder}}, $proj;
$proj->AddDir($initialdir) if ($initialdir);
if ($self->{options}->{zlib})
--- 416,422 ----
{
my ($self, $name, $type, $folder, $initialdir) = @_;
! my $proj = VSObjectFactory::CreateProject($self->{vcver}, $name, $type, $self);
push @{$self->{projects}->{$folder}}, $proj;
$proj->AddDir($initialdir) if ($initialdir);
if ($self->{options}->{zlib})
*************** sub Save
*** 488,495 ****
open(SLN,">pgsql.sln") || croak "Could not write to pgsql.sln\n";
print SLN < )
+ {
+ 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
+ "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
+ "Unable to determine Visual Studio version: Visual Studio versions before 6.0 aren't supported.";
+ }
+ return "$major.$minor";
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/build.pl postgresql_dev/src/tools/msvc/build.pl
*** postgresql/src/tools/msvc/build.pl Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/build.pl Tue Jun 7 05:10:39 2011
*************** our $config;
*** 33,39 ****
require "config_default.pl";
require "config.pl" if (-f "src/tools/msvc/config.pl");
! Mkvcbuild::mkvcbuild($config);
# check what sort of build we are doing
--- 33,39 ----
require "config_default.pl";
require "config.pl" if (-f "src/tools/msvc/config.pl");
! my $vcver = Mkvcbuild::mkvcbuild($config);
# check what sort of build we are doing
*************** elsif ($ARGV[0] ne "RELEASE")
*** 50,56 ****
# ... and do it
! if ($buildwhat)
{
system("vcbuild $buildwhat.vcproj $bconf");
}
--- 50,60 ----
# ... and do it
! if ($buildwhat and $vcver eq '10.00')
! {
! system("msbuild $buildwhat.vcxproj /verbosity:detailed /p:Configuration=$bconf");
! }
! elsif ($buildwhat)
{
system("vcbuild $buildwhat.vcproj $bconf");
}
diff -Napcdr -x .git postgresql/src/tools/msvc/builddoc.pl postgresql_dev/src/tools/msvc/builddoc.pl
*** postgresql/src/tools/msvc/builddoc.pl Tue Jun 7 05:07:51 2011
--- postgresql_dev/src/tools/msvc/builddoc.pl Tue Jun 7 05:10:39 2011
*************** $cmd =
*** 69,76 ****
."| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
print "Running collateindex...\n";
! $cmd ="perl \"$docroot/$dsssl/bin/collateindex.pl\" -f -g -i bookindex "
! ."-o bookindex.sgml HTML.index";
system($cmd);
die "collateindex" if $?;
mkdir "html";
--- 69,76 ----
."| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
print "Running collateindex...\n";
! $cmd =
! "perl \"$docroot/$dsssl/bin/collateindex.pl\" -f -g -i bookindex "."-o bookindex.sgml HTML.index";
system($cmd);
die "collateindex" if $?;
mkdir "html";
diff -Napcdr -x .git postgresql/src/tools/msvc/clean.bat postgresql_dev/src/tools/msvc/clean.bat
*** postgresql/src/tools/msvc/clean.bat Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/clean.bat Tue Jun 7 05:08:23 2011
*************** if exist ..\msvc if exist ..\..\..\src c
*** 10,17 ****
--- 10,21 ----
if exist debug rd /s /q debug
if exist release rd /s /q release
for %%f in (*.vcproj) do del %%f
+ for %%f in (*.vcxproj) do del %%f
+ for %%f in (*.vcxproj.user) do del %%f
if exist pgsql.sln del /q pgsql.sln
if exist pgsql.sln.cache del /q pgsql.sln.cache
+ if exist pgsql.sdf del /q pgsql.sdf
+ if exist pgsql.suo del /q /a:H pgsql.suo
del /s /q src\bin\win32ver.rc 2> NUL
del /s /q src\interfaces\win32ver.rc 2> NUL
if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
diff -Napcdr -x .git postgresql/src/tools/msvc/pgbison.bat postgresql_dev/src/tools/msvc/pgbison.bat
*** postgresql/src/tools/msvc/pgbison.bat Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/pgbison.bat Thu Jan 1 00:00:00 1970
***************
*** 1,51 ****
- @echo off
- REM src/tools/msvc/pgbison.bat
-
- IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
- perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
- CALL bldenv.bat
- del bldenv.bat
- :nobuildenv
-
- SET BV=
- for /F "tokens=4 usebackq" %%f in (`bison -V`) do if "!BV!"=="" SET BV=%%f
- if "%BV%"=="" goto novarexp
- if %BV% EQU 1.875 goto bisonok
- if %BV% GEQ 2.2 goto bisonok
- goto nobison
- :bisonok
-
- if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\backend\parser\gram.h
- if "%1" == "src\backend\bootstrap\bootparse.y" call :generate %1 src\backend\bootstrap\bootparse.c
- if "%1" == "src\backend\replication\repl_gram.y" call :generate %1 src\backend\replication\repl_gram.c
- if "%1" == "src\pl\plpgsql\src\gram.y" call :generate %1 src\pl\plpgsql\src\pl_gram.c src\pl\plpgsql\src\pl_gram.h
- if "%1" == "src\test\isolation\specparse.y" call :generate %1 src\test\isolation\specparse.c
- if "%1" == "src\interfaces\ecpg\preproc\preproc.y" call :generate %1 src\interfaces\ecpg\preproc\preproc.c src\interfaces\ecpg\preproc\preproc.h
- if "%1" == "contrib\cube\cubeparse.y" call :generate %1 contrib\cube\cubeparse.c
- if "%1" == "contrib\seg\segparse.y" call :generate %1 contrib\seg\segparse.c
-
- echo Unknown bison input: %1
- exit 1
-
- :generate
- SET fn=%1
- SET cf=%2
- bison.exe -d %fn% -o %cf%
- if errorlevel 1 exit 1
- SET hf=%cf:~0,-2%.h
- if not "%hf%"=="%3" (
- copy /y %hf% %3
- if errorlevel 1 exit 1
- del %hf%
- )
- exit 0
-
-
- :novarexp
- echo pgbison must be called with cmd /V:ON /C pgbison to work!
- exit 1
-
- :nobison
- echo WARNING! Bison install not found, or unsupported Bison version.
- echo Attempting to build without.
- exit 0
--- 0 ----
diff -Napcdr -x .git postgresql/src/tools/msvc/pgbison.pl postgresql_dev/src/tools/msvc/pgbison.pl
*** postgresql/src/tools/msvc/pgbison.pl Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/pgbison.pl Tue Jun 7 05:10:39 2011
***************
*** 0 ****
--- 1,92 ----
+ #!/usr/bin/perl
+
+ use strict;
+ use warnings;
+
+ require 'src/tools/msvc/buildenv.pl' if (-e 'src/tools/msvc/buildenv.pl');
+
+ checkBison();
+ my $inputFile = $ARGV[0];
+
+ unless (defined($inputFile))
+ {
+ die "Bison input file is missing.\n";
+ }
+ elsif ($inputFile eq 'src\backend\parser\gram.y')
+ {
+ generate($inputFile, 'src\backend\parser\gram.c', 'src\backend\parser\gram.h');
+ }
+ elsif ($inputFile eq 'src\backend\bootstrap\bootparse.y')
+ {
+ generate($inputFile, 'src\backend\bootstrap\bootparse.c');
+ }
+ elsif ($inputFile eq 'src\backend\replication\repl_gram.y')
+ {
+ generate($inputFile, 'src\backend\replication\repl_gram.c');
+ }
+ elsif ($inputFile eq 'src\pl\plpgsql\src\gram.y')
+ {
+ generate($inputFile, 'src\pl\plpgsql\src\pl_gram.c', 'src\pl\plpgsql\src\pl_gram.h');
+ }
+ elsif ($inputFile eq 'src\test\isolation\specparse.y')
+ {
+ generate($inputFile, 'src\test\isolation\specparse.c');
+ }
+ elsif ($inputFile eq 'src\interfaces\ecpg\preproc\preproc.y')
+ {
+ generate(
+ $inputFile,
+ 'src\interfaces\ecpg\preproc\preproc.c',
+ 'src\interfaces\ecpg\preproc\preproc.h'
+ );
+ }
+ elsif ($inputFile eq 'contrib\cube\cubeparse.y')
+ {
+ generate($inputFile, 'contrib\cube\cubeparse.c');
+ }
+ elsif ($inputFile eq 'contrib\seg\segparse.y')
+ {
+ generate($inputFile, 'contrib\seg\segparse.c');
+ }
+ else
+ {
+ die "Unknown bison input: $inputFile\n";
+ }
+
+ sub generate
+ {
+ my($input, $output1, $output2) = @_;
+ system("bison -d \"$input\" -o \"$output1\"") == 0
+ || die "ERROR! bison -d \"$input\" -o \"$output1\" failed: $?\n";
+
+ (my $headerFile = $output1) =~ s/\.c$/.h/;
+
+ if (defined($output2) && $headerFile ne $output2)
+ {
+ system("copy /y \"$headerFile\" \"$output2\"") == 0
+ || die "ERROR! copy /y \"$headerFile\" \"$output2\" failed: $?\n";
+ unlink($headerFile);
+ }
+ }
+
+ sub checkBison
+ {
+ open(P,'bison -V 2>&1 |')
+ || die "WARNING! Bison install not found. Attempting to build without.\n";
+ while( )
+ {
+ chomp;
+ if (/(\d+)\.(\d+)(\.\d+)?$/)
+ {
+ my $bisonVersion = "$1.$2";
+ unless ($bisonVersion == 1.875 || $bisonVersion >= 2.2)
+ {
+ die "WARNING! Unsupported Bison version. Attempting to build without.\n";
+ }
+ return;
+ }
+ }
+ close(P);
+ die
+ "WARNING! Bison install not found or unable to determine Bison version. Attempting to build without.\n";
+ }
diff -Napcdr -x .git postgresql/src/tools/msvc/pgflex.bat postgresql_dev/src/tools/msvc/pgflex.bat
*** postgresql/src/tools/msvc/pgflex.bat Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/pgflex.bat Thu Jan 1 00:00:00 1970
***************
*** 1,45 ****
- @echo off
- REM src/tools/msvc/pgflex.bat
-
- REM silence flex bleatings about file path style
- SET CYGWIN=nodosfilewarning
-
- IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
- perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
- CALL bldenv.bat
- del bldenv.bat
- :nobuildenv
-
- flex -V > NUL
- if errorlevel 1 goto noflex
-
- if "%1" == "src\backend\parser\scan.l" call :generate %1 src\backend\parser\scan.c -CF
- if "%1" == "src\backend\bootstrap\bootscanner.l" call :generate %1 src\backend\bootstrap\bootscanner.c
- if "%1" == "src\backend\utils\misc\guc-file.l" call :generate %1 src\backend\utils\misc\guc-file.c
- if "%1" == "src\backend\replication\repl_scanner.l" call :generate %1 src\backend\replication\repl_scanner.c
- if "%1" == "src\test\isolation\specscanner.l" call :generate %1 src\test\isolation\specscanner.c
- if "%1" == "src\interfaces\ecpg\preproc\pgc.l" call :generate %1 src\interfaces\ecpg\preproc\pgc.c
- if "%1" == "src\bin\psql\psqlscan.l" call :generate %1 src\bin\psql\psqlscan.c
- if "%1" == "contrib\cube\cubescan.l" call :generate %1 contrib\cube\cubescan.c
- if "%1" == "contrib\seg\segscan.l" call :generate %1 contrib\seg\segscan.c
-
- echo Unknown flex input: %1
- exit 1
-
- REM For non-reentrant scanners we need to fix up the yywrap macro definition
- REM to keep the MS compiler happy.
- REM For reentrant scanners (like the core scanner) we do not
- REM need to (and must not) change the yywrap definition.
- :generate
- flex %3 -o%2 %1
- if errorlevel 1 exit %errorlevel%
- perl -n -e "exit 1 if /^\%%option\s+reentrant/;" %1
- if errorlevel 1 exit 0
- perl -pi.bak -e "s/yywrap\(n\)/yywrap()/;" %2
- if errorlevel 1 exit %errorlevel%
- del %2.bak
- exit 0
-
- :noflex
- echo WARNING! flex install not found, attempting to build without
- exit 0
--- 0 ----
diff -Napcdr -x .git postgresql/src/tools/msvc/pgflex.pl postgresql_dev/src/tools/msvc/pgflex.pl
*** postgresql/src/tools/msvc/pgflex.pl Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/pgflex.pl Tue Jun 7 05:10:39 2011
***************
*** 0 ****
--- 1,137 ----
+ #!/usr/bin/perl
+
+ use strict;
+ use warnings;
+
+ require 'src/tools/msvc/buildenv.pl' if (-e 'src/tools/msvc/buildenv.pl');
+
+ checkFlex();
+ my $inputFile = $ARGV[0];
+
+ unless (defined($inputFile))
+ {
+ die "Flex input file is missing.\n";
+ }
+ elsif ($inputFile eq 'src\backend\parser\scan.l')
+ {
+ generate($inputFile, 'src\backend\parser\scan.c', '-CF ');
+ }
+ elsif ($inputFile eq 'src\backend\bootstrap\bootscanner.l')
+ {
+ generate($inputFile, 'src\backend\bootstrap\bootscanner.c');
+ }
+ elsif ($inputFile eq 'src\backend\utils\misc\guc-file.l')
+ {
+ generate($inputFile, 'src\backend\utils\misc\guc-file.c');
+ }
+ elsif ($inputFile eq 'src\backend\replication\repl_scanner.l')
+ {
+ generate($inputFile, 'src\backend\replication\repl_scanner.c');
+ }
+ elsif ($inputFile eq 'src\test\isolation\specscanner.l')
+ {
+ generate($inputFile, 'src\test\isolation\specscanner.c');
+ }
+ elsif ($inputFile eq 'src\interfaces\ecpg\preproc\pgc.l')
+ {
+ generate($inputFile, 'src\interfaces\ecpg\preproc\pgc.c');
+ }
+ elsif ($inputFile eq 'src\bin\psql\psqlscan.l')
+ {
+ generate($inputFile, 'src\bin\psql\psqlscan.c');
+ }
+ elsif ($inputFile eq 'contrib\cube\cubescan.l')
+ {
+ generate($inputFile, 'contrib\cube\cubescan.c');
+ }
+ elsif ($inputFile eq 'contrib\seg\segscan.l')
+ {
+ generate($inputFile, 'contrib\seg\segscan.c');
+ }
+ else
+ {
+ die "Unknown flex input: $inputFile\n";
+ }
+
+ sub generate
+ {
+ my($input, $output, $flags) = @_;
+
+ $flags = '' unless defined($flags);
+
+ my $errorlevel = system("flex $flags-o\"$output\" \"$input\"");
+ if ($errorlevel == 1)
+ {
+ exit $errorlevel;
+ }
+
+ # 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.
+ if (is_reentrant($input))
+ {
+ exit 0;
+ }
+ fix_yywrap($output);
+ exit 0;
+ }
+
+ sub is_reentrant
+ {
+ my $input = shift;
+ open(INFILE, "<$input");
+ while ( )
+ {
+ chomp;
+ if (/(\d+)\.(\d+)\.(\d+)$/)
+ {
+ my $flexVersion = "$1.$2";
+ if ($flexVersion < 2.5 || ($flexVersion == 2.5 && $3 < 31))
+ {
+ die "WARNING! Unsupported Flex version. Attempting to build without.\n";
+ }
+ return;
+ }
+ }
+ close(P);
+ die
+ "WARNING! Flex install not found or unable to determine Flex version. Attempting to build without.\n";
+ }