Commit 854adb83 authored by Peter Eisentraut's avatar Peter Eisentraut

Replace backslashes by forward slashes in MSVC build code

This makes it possible to run some stages of these build scripts on
non-Windows systems.  That way, we can more easily test whether file
moves or makefile changes might break the MSVC build.

Peter Eisentraut and Michael Paquier
parent 410cbfd6
...@@ -127,7 +127,7 @@ EOF ...@@ -127,7 +127,7 @@ EOF
foreach my $fileNameWithPath (sort keys %{ $self->{files} }) foreach my $fileNameWithPath (sort keys %{ $self->{files} })
{ {
confess "Bad format filename '$fileNameWithPath'\n" confess "Bad format filename '$fileNameWithPath'\n"
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/); unless ($fileNameWithPath =~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!);
my $dir = $1; my $dir = $1;
my $fileName = $2; my $fileName = $2;
if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/) if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
......
...@@ -33,10 +33,12 @@ my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' }; ...@@ -33,10 +33,12 @@ my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' };
my @contrib_uselibpq = my @contrib_uselibpq =
('dblink', 'oid2name', 'postgres_fdw', 'vacuumlo'); ('dblink', 'oid2name', 'postgres_fdw', 'vacuumlo');
my @contrib_uselibpgport = ( my @contrib_uselibpgport = (
'chkpass',
'oid2name', 'oid2name',
'pg_standby', 'pg_standby',
'vacuumlo'); 'vacuumlo');
my @contrib_uselibpgcommon = ( my @contrib_uselibpgcommon = (
'chkpass',
'oid2name', 'oid2name',
'pg_standby', 'pg_standby',
'vacuumlo'); 'vacuumlo');
...@@ -44,8 +46,8 @@ my $contrib_extralibs = undef; ...@@ -44,8 +46,8 @@ my $contrib_extralibs = undef;
my $contrib_extraincludes = my $contrib_extraincludes =
{ 'tsearch2' => ['contrib/tsearch2'], 'dblink' => ['src/backend'] }; { 'tsearch2' => ['contrib/tsearch2'], 'dblink' => ['src/backend'] };
my $contrib_extrasource = { my $contrib_extrasource = {
'cube' => [ 'contrib\cube\cubescan.l', 'contrib\cube\cubeparse.y' ], 'cube' => [ 'contrib/cube/cubescan.l', 'contrib/cube/cubeparse.y' ],
'seg' => [ 'contrib\seg\segscan.l', 'contrib\seg\segparse.y' ], }; 'seg' => [ 'contrib/seg/segscan.l', 'contrib/seg/segparse.y' ], };
my @contrib_excludes = ('pgcrypto', 'commit_ts', 'intagg', 'sepgsql'); my @contrib_excludes = ('pgcrypto', 'commit_ts', 'intagg', 'sepgsql');
# Set of variables for frontend modules # Set of variables for frontend modules
...@@ -59,12 +61,12 @@ my $frontend_extralibs = { ...@@ -59,12 +61,12 @@ my $frontend_extralibs = {
'pgbench' => ['ws2_32.lib'], 'pgbench' => ['ws2_32.lib'],
'psql' => ['ws2_32.lib'] }; 'psql' => ['ws2_32.lib'] };
my $frontend_extraincludes = { my $frontend_extraincludes = {
'initdb' => ['src\timezone'], 'initdb' => ['src/timezone'],
'psql' => [ 'src\bin\pg_dump', 'src\backend' ] }; 'psql' => [ 'src/bin/pg_dump', 'src/backend' ] };
my $frontend_extrasource = { my $frontend_extrasource = {
'psql' => ['src\bin\psql\psqlscan.l'], 'psql' => ['src/bin/psql/psqlscan.l'],
'pgbench' => 'pgbench' =>
[ 'src\bin\pgbench\exprscan.l', 'src\bin\pgbench\exprparse.y' ], [ 'src/bin/pgbench/exprscan.l', 'src/bin/pgbench/exprparse.y' ],
}; };
my @frontend_excludes = my @frontend_excludes =
('pgevent', 'pg_basebackup', 'pg_rewind', 'pg_dump', 'pg_xlogdump', 'scripts'); ('pgevent', 'pg_basebackup', 'pg_rewind', 'pg_dump', 'pg_xlogdump', 'scripts');
...@@ -73,9 +75,9 @@ sub mkvcbuild ...@@ -73,9 +75,9 @@ sub mkvcbuild
{ {
our $config = shift; our $config = shift;
chdir('..\..\..') if (-d '..\msvc' && -d '..\..\..\src'); chdir('../../..') if (-d '../msvc' && -d '../../../src');
die 'Must run from root or msvc directory' die 'Must run from root or msvc directory'
unless (-d 'src\tools\msvc' && -d 'src'); unless (-d 'src/tools/msvc' && -d 'src');
my $vsVersion = DetermineVisualStudioVersion(); my $vsVersion = DetermineVisualStudioVersion();
...@@ -114,37 +116,37 @@ sub mkvcbuild ...@@ -114,37 +116,37 @@ sub mkvcbuild
$libpgport = $solution->AddProject('libpgport', 'lib', 'misc'); $libpgport = $solution->AddProject('libpgport', 'lib', 'misc');
$libpgport->AddDefine('FRONTEND'); $libpgport->AddDefine('FRONTEND');
$libpgport->AddFiles('src\port', @pgportfiles); $libpgport->AddFiles('src/port', @pgportfiles);
$libpgcommon = $solution->AddProject('libpgcommon', 'lib', 'misc'); $libpgcommon = $solution->AddProject('libpgcommon', 'lib', 'misc');
$libpgcommon->AddDefine('FRONTEND'); $libpgcommon->AddDefine('FRONTEND');
$libpgcommon->AddFiles('src\common', @pgcommonfrontendfiles); $libpgcommon->AddFiles('src/common', @pgcommonfrontendfiles);
$postgres = $solution->AddProject('postgres', 'exe', '', 'src\backend'); $postgres = $solution->AddProject('postgres', 'exe', '', 'src/backend');
$postgres->AddIncludeDir('src\backend'); $postgres->AddIncludeDir('src/backend');
$postgres->AddDir('src\backend\port\win32'); $postgres->AddDir('src/backend/port/win32');
$postgres->AddFile('src\backend\utils\fmgrtab.c'); $postgres->AddFile('src/backend/utils/fmgrtab.c');
$postgres->ReplaceFile( $postgres->ReplaceFile(
'src\backend\port\dynloader.c', 'src/backend/port/dynloader.c',
'src\backend\port\dynloader\win32.c'); 'src/backend/port/dynloader/win32.c');
$postgres->ReplaceFile('src\backend\port\pg_sema.c', $postgres->ReplaceFile('src/backend/port/pg_sema.c',
'src\backend\port\win32_sema.c'); 'src/backend/port/win32_sema.c');
$postgres->ReplaceFile('src\backend\port\pg_shmem.c', $postgres->ReplaceFile('src/backend/port/pg_shmem.c',
'src\backend\port\win32_shmem.c'); 'src/backend/port/win32_shmem.c');
$postgres->ReplaceFile('src\backend\port\pg_latch.c', $postgres->ReplaceFile('src/backend/port/pg_latch.c',
'src\backend\port\win32_latch.c'); 'src/backend/port/win32_latch.c');
$postgres->AddFiles('src\port', @pgportfiles); $postgres->AddFiles('src/port', @pgportfiles);
$postgres->AddFiles('src\common', @pgcommonbkndfiles); $postgres->AddFiles('src/common', @pgcommonbkndfiles);
$postgres->AddDir('src\timezone'); $postgres->AddDir('src/timezone');
# We need source files from src\timezone, but that directory's resource # We need source files from src/timezone, but that directory's resource
# file pertains to "zic", not to the backend. # file pertains to "zic", not to the backend.
$postgres->RemoveFile('src\timezone\win32ver.rc'); $postgres->RemoveFile('src/timezone/win32ver.rc');
$postgres->AddFiles('src\backend\parser', 'scan.l', 'gram.y'); $postgres->AddFiles('src/backend/parser', 'scan.l', 'gram.y');
$postgres->AddFiles('src\backend\bootstrap', 'bootscanner.l', $postgres->AddFiles('src/backend/bootstrap', 'bootscanner.l',
'bootparse.y'); 'bootparse.y');
$postgres->AddFiles('src\backend\utils\misc', 'guc-file.l'); $postgres->AddFiles('src/backend/utils/misc', 'guc-file.l');
$postgres->AddFiles('src\backend\replication', 'repl_scanner.l', $postgres->AddFiles('src/backend/replication', 'repl_scanner.l',
'repl_gram.y'); 'repl_gram.y');
$postgres->AddDefine('BUILDING_DLL'); $postgres->AddDefine('BUILDING_DLL');
$postgres->AddLibrary('secur32.lib'); $postgres->AddLibrary('secur32.lib');
...@@ -156,31 +158,31 @@ sub mkvcbuild ...@@ -156,31 +158,31 @@ sub mkvcbuild
# if building without OpenSSL # if building without OpenSSL
if (!$solution->{options}->{openssl}) if (!$solution->{options}->{openssl})
{ {
$postgres->RemoveFile('src\backend\libpq\be-secure-openssl.c'); $postgres->RemoveFile('src/backend/libpq/be-secure-openssl.c');
} }
my $snowball = $solution->AddProject('dict_snowball', 'dll', '', my $snowball = $solution->AddProject('dict_snowball', 'dll', '',
'src\backend\snowball'); 'src/backend/snowball');
# This Makefile uses VPATH to find most source files in a subdirectory. # This Makefile uses VPATH to find most source files in a subdirectory.
$snowball->RelocateFiles( $snowball->RelocateFiles(
'src\backend\snowball\libstemmer', 'src/backend/snowball/libstemmer',
sub { sub {
return shift !~ /(dict_snowball.c|win32ver.rc)$/; return shift !~ /(dict_snowball.c|win32ver.rc)$/;
}); });
$snowball->AddIncludeDir('src\include\snowball'); $snowball->AddIncludeDir('src/include/snowball');
$snowball->AddReference($postgres); $snowball->AddReference($postgres);
my $plpgsql = my $plpgsql =
$solution->AddProject('plpgsql', 'dll', 'PLs', 'src\pl\plpgsql\src'); $solution->AddProject('plpgsql', 'dll', 'PLs', 'src/pl/plpgsql/src');
$plpgsql->AddFiles('src\pl\plpgsql\src', 'pl_gram.y'); $plpgsql->AddFiles('src/pl/plpgsql/src', 'pl_gram.y');
$plpgsql->AddReference($postgres); $plpgsql->AddReference($postgres);
if ($solution->{options}->{perl}) if ($solution->{options}->{perl})
{ {
my $plperlsrc = "src\\pl\\plperl\\"; my $plperlsrc = "src/pl/plperl/";
my $plperl = my $plperl =
$solution->AddProject('plperl', 'dll', 'PLs', 'src\pl\plperl'); $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl');
$plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE'); $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE');
$plperl->AddDefine('PLPERL_HAVE_UID_GID'); $plperl->AddDefine('PLPERL_HAVE_UID_GID');
foreach my $xs ('SPI.xs', 'Util.xs') foreach my $xs ('SPI.xs', 'Util.xs')
...@@ -188,7 +190,7 @@ sub mkvcbuild ...@@ -188,7 +190,7 @@ sub mkvcbuild
(my $xsc = $xs) =~ s/\.xs/.c/; (my $xsc = $xs) =~ s/\.xs/.c/;
if (Solution::IsNewer("$plperlsrc$xsc", "$plperlsrc$xs")) if (Solution::IsNewer("$plperlsrc$xsc", "$plperlsrc$xs"))
{ {
my $xsubppdir = first { -e "$_\\ExtUtils\\xsubpp" } @INC; my $xsubppdir = first { -e "$_/ExtUtils/xsubpp" } @INC;
print "Building $plperlsrc$xsc...\n"; print "Building $plperlsrc$xsc...\n";
system( $solution->{options}->{perl} system( $solution->{options}->{perl}
. '/bin/perl ' . '/bin/perl '
...@@ -205,15 +207,15 @@ sub mkvcbuild ...@@ -205,15 +207,15 @@ sub mkvcbuild
} }
} }
if (Solution::IsNewer( if (Solution::IsNewer(
'src\pl\plperl\perlchunks.h', 'src/pl/plperl/perlchunks.h',
'src\pl\plperl\plc_perlboot.pl') 'src/pl/plperl/plc_perlboot.pl')
|| Solution::IsNewer( || Solution::IsNewer(
'src\pl\plperl\perlchunks.h', 'src/pl/plperl/perlchunks.h',
'src\pl\plperl\plc_trusted.pl')) 'src/pl/plperl/plc_trusted.pl'))
{ {
print 'Building src\pl\plperl\perlchunks.h ...' . "\n"; print 'Building src/pl/plperl/perlchunks.h ...' . "\n";
my $basedir = getcwd; my $basedir = getcwd;
chdir 'src\pl\plperl'; chdir 'src/pl/plperl';
system( $solution->{options}->{perl} system( $solution->{options}->{perl}
. '/bin/perl ' . '/bin/perl '
. 'text2macro.pl ' . 'text2macro.pl '
...@@ -221,29 +223,29 @@ sub mkvcbuild ...@@ -221,29 +223,29 @@ sub mkvcbuild
. 'plc_perlboot.pl plc_trusted.pl ' . 'plc_perlboot.pl plc_trusted.pl '
. '>perlchunks.h'); . '>perlchunks.h');
chdir $basedir; chdir $basedir;
if ((!(-f 'src\pl\plperl\perlchunks.h')) if ((!(-f 'src/pl/plperl/perlchunks.h'))
|| -z 'src\pl\plperl\perlchunks.h') || -z 'src/pl/plperl/perlchunks.h')
{ {
unlink('src\pl\plperl\perlchunks.h'); # if zero size unlink('src/pl/plperl/perlchunks.h'); # if zero size
die 'Failed to create perlchunks.h' . "\n"; die 'Failed to create perlchunks.h' . "\n";
} }
} }
if (Solution::IsNewer( if (Solution::IsNewer(
'src\pl\plperl\plperl_opmask.h', 'src/pl/plperl/plperl_opmask.h',
'src\pl\plperl\plperl_opmask.pl')) 'src/pl/plperl/plperl_opmask.pl'))
{ {
print 'Building src\pl\plperl\plperl_opmask.h ...' . "\n"; print 'Building src/pl/plperl/plperl_opmask.h ...' . "\n";
my $basedir = getcwd; my $basedir = getcwd;
chdir 'src\pl\plperl'; chdir 'src/pl/plperl';
system( $solution->{options}->{perl} system( $solution->{options}->{perl}
. '/bin/perl ' . '/bin/perl '
. 'plperl_opmask.pl ' . 'plperl_opmask.pl '
. 'plperl_opmask.h'); . 'plperl_opmask.h');
chdir $basedir; chdir $basedir;
if ((!(-f 'src\pl\plperl\plperl_opmask.h')) if ((!(-f 'src/pl/plperl/plperl_opmask.h'))
|| -z 'src\pl\plperl\plperl_opmask.h') || -z 'src/pl/plperl/plperl_opmask.h')
{ {
unlink('src\pl\plperl\plperl_opmask.h'); # if zero size unlink('src/pl/plperl/plperl_opmask.h'); # if zero size
die 'Failed to create plperl_opmask.h' . "\n"; die 'Failed to create plperl_opmask.h' . "\n";
} }
} }
...@@ -283,89 +285,89 @@ sub mkvcbuild ...@@ -283,89 +285,89 @@ sub mkvcbuild
my $pymajorver = substr($pyver, 0, 1); my $pymajorver = substr($pyver, 0, 1);
my $plpython = $solution->AddProject('plpython' . $pymajorver, my $plpython = $solution->AddProject('plpython' . $pymajorver,
'dll', 'PLs', 'src\pl\plpython'); 'dll', 'PLs', 'src/pl/plpython');
$plpython->AddIncludeDir($pyprefix . '\include'); $plpython->AddIncludeDir($pyprefix . '/include');
$plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib"); $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib");
$plpython->AddReference($postgres); $plpython->AddReference($postgres);
} }
if ($solution->{options}->{tcl}) if ($solution->{options}->{tcl})
{ {
my $pltcl = my $pltcl =
$solution->AddProject('pltcl', 'dll', 'PLs', 'src\pl\tcl'); $solution->AddProject('pltcl', 'dll', 'PLs', 'src/pl/tcl');
$pltcl->AddIncludeDir($solution->{options}->{tcl} . '\include'); $pltcl->AddIncludeDir($solution->{options}->{tcl} . '/include');
$pltcl->AddReference($postgres); $pltcl->AddReference($postgres);
if (-e $solution->{options}->{tcl} . '\lib\tcl85.lib') if (-e $solution->{options}->{tcl} . '/lib/tcl85.lib')
{ {
$pltcl->AddLibrary( $pltcl->AddLibrary(
$solution->{options}->{tcl} . '\lib\tcl85.lib'); $solution->{options}->{tcl} . '/lib/tcl85.lib');
} }
else else
{ {
$pltcl->AddLibrary( $pltcl->AddLibrary(
$solution->{options}->{tcl} . '\lib\tcl84.lib'); $solution->{options}->{tcl} . '/lib/tcl84.lib');
} }
} }
$libpq = $solution->AddProject('libpq', 'dll', 'interfaces', $libpq = $solution->AddProject('libpq', 'dll', 'interfaces',
'src\interfaces\libpq'); 'src/interfaces/libpq');
$libpq->AddDefine('FRONTEND'); $libpq->AddDefine('FRONTEND');
$libpq->AddDefine('UNSAFE_STAT_OK'); $libpq->AddDefine('UNSAFE_STAT_OK');
$libpq->AddIncludeDir('src\port'); $libpq->AddIncludeDir('src/port');
$libpq->AddLibrary('secur32.lib'); $libpq->AddLibrary('secur32.lib');
$libpq->AddLibrary('ws2_32.lib'); $libpq->AddLibrary('ws2_32.lib');
$libpq->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap}); $libpq->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
$libpq->UseDef('src\interfaces\libpq\libpqdll.def'); $libpq->UseDef('src/interfaces/libpq/libpqdll.def');
$libpq->ReplaceFile('src\interfaces\libpq\libpqrc.c', $libpq->ReplaceFile('src/interfaces/libpq/libpqrc.c',
'src\interfaces\libpq\libpq.rc'); 'src/interfaces/libpq/libpq.rc');
$libpq->AddReference($libpgport); $libpq->AddReference($libpgport);
# The OBJS scraper doesn't know about ifdefs, so remove fe-secure-openssl.c # The OBJS scraper doesn't know about ifdefs, so remove fe-secure-openssl.c
# if building without OpenSSL # if building without OpenSSL
if (!$solution->{options}->{openssl}) if (!$solution->{options}->{openssl})
{ {
$libpq->RemoveFile('src\interfaces\libpq\fe-secure-openssl.c'); $libpq->RemoveFile('src/interfaces/libpq/fe-secure-openssl.c');
} }
my $libpqwalreceiver = my $libpqwalreceiver =
$solution->AddProject('libpqwalreceiver', 'dll', '', $solution->AddProject('libpqwalreceiver', 'dll', '',
'src\backend\replication\libpqwalreceiver'); 'src/backend/replication/libpqwalreceiver');
$libpqwalreceiver->AddIncludeDir('src\interfaces\libpq'); $libpqwalreceiver->AddIncludeDir('src/interfaces/libpq');
$libpqwalreceiver->AddReference($postgres, $libpq); $libpqwalreceiver->AddReference($postgres, $libpq);
my $pgtypes = $solution->AddProject( my $pgtypes = $solution->AddProject(
'libpgtypes', 'dll', 'libpgtypes', 'dll',
'interfaces', 'src\interfaces\ecpg\pgtypeslib'); 'interfaces', 'src/interfaces/ecpg/pgtypeslib');
$pgtypes->AddDefine('FRONTEND'); $pgtypes->AddDefine('FRONTEND');
$pgtypes->AddReference($libpgport); $pgtypes->AddReference($libpgport);
$pgtypes->UseDef('src\interfaces\ecpg\pgtypeslib\pgtypeslib.def'); $pgtypes->UseDef('src/interfaces/ecpg/pgtypeslib/pgtypeslib.def');
$pgtypes->AddIncludeDir('src\interfaces\ecpg\include'); $pgtypes->AddIncludeDir('src/interfaces/ecpg/include');
my $libecpg = $solution->AddProject('libecpg', 'dll', 'interfaces', my $libecpg = $solution->AddProject('libecpg', 'dll', 'interfaces',
'src\interfaces\ecpg\ecpglib'); 'src/interfaces/ecpg/ecpglib');
$libecpg->AddDefine('FRONTEND'); $libecpg->AddDefine('FRONTEND');
$libecpg->AddIncludeDir('src\interfaces\ecpg\include'); $libecpg->AddIncludeDir('src/interfaces/ecpg/include');
$libecpg->AddIncludeDir('src\interfaces\libpq'); $libecpg->AddIncludeDir('src/interfaces/libpq');
$libecpg->AddIncludeDir('src\port'); $libecpg->AddIncludeDir('src/port');
$libecpg->UseDef('src\interfaces\ecpg\ecpglib\ecpglib.def'); $libecpg->UseDef('src/interfaces/ecpg/ecpglib/ecpglib.def');
$libecpg->AddLibrary('ws2_32.lib'); $libecpg->AddLibrary('ws2_32.lib');
$libecpg->AddReference($libpq, $pgtypes, $libpgport); $libecpg->AddReference($libpq, $pgtypes, $libpgport);
my $libecpgcompat = $solution->AddProject( my $libecpgcompat = $solution->AddProject(
'libecpg_compat', 'dll', 'libecpg_compat', 'dll',
'interfaces', 'src\interfaces\ecpg\compatlib'); 'interfaces', 'src/interfaces/ecpg/compatlib');
$libecpgcompat->AddDefine('FRONTEND'); $libecpgcompat->AddDefine('FRONTEND');
$libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include'); $libecpgcompat->AddIncludeDir('src/interfaces/ecpg/include');
$libecpgcompat->AddIncludeDir('src\interfaces\libpq'); $libecpgcompat->AddIncludeDir('src/interfaces/libpq');
$libecpgcompat->UseDef('src\interfaces\ecpg\compatlib\compatlib.def'); $libecpgcompat->UseDef('src/interfaces/ecpg/compatlib/compatlib.def');
$libecpgcompat->AddReference($pgtypes, $libecpg, $libpgport); $libecpgcompat->AddReference($pgtypes, $libecpg, $libpgport);
my $ecpg = $solution->AddProject('ecpg', 'exe', 'interfaces', my $ecpg = $solution->AddProject('ecpg', 'exe', 'interfaces',
'src\interfaces\ecpg\preproc'); 'src/interfaces/ecpg/preproc');
$ecpg->AddIncludeDir('src\interfaces\ecpg\include'); $ecpg->AddIncludeDir('src/interfaces/ecpg/include');
$ecpg->AddIncludeDir('src\interfaces\libpq'); $ecpg->AddIncludeDir('src/interfaces/libpq');
$ecpg->AddPrefixInclude('src\interfaces\ecpg\preproc'); $ecpg->AddPrefixInclude('src/interfaces/ecpg/preproc');
$ecpg->AddFiles('src\interfaces\ecpg\preproc', 'pgc.l', 'preproc.y'); $ecpg->AddFiles('src/interfaces/ecpg/preproc', 'pgc.l', 'preproc.y');
$ecpg->AddDefine('MAJOR_VERSION=4'); $ecpg->AddDefine('MAJOR_VERSION=4');
$ecpg->AddDefine('MINOR_VERSION=11'); $ecpg->AddDefine('MINOR_VERSION=11');
$ecpg->AddDefine('PATCHLEVEL=0'); $ecpg->AddDefine('PATCHLEVEL=0');
...@@ -374,39 +376,39 @@ sub mkvcbuild ...@@ -374,39 +376,39 @@ sub mkvcbuild
my $pgregress_ecpg = my $pgregress_ecpg =
$solution->AddProject('pg_regress_ecpg', 'exe', 'misc'); $solution->AddProject('pg_regress_ecpg', 'exe', 'misc');
$pgregress_ecpg->AddFile('src\interfaces\ecpg\test\pg_regress_ecpg.c'); $pgregress_ecpg->AddFile('src/interfaces/ecpg/test/pg_regress_ecpg.c');
$pgregress_ecpg->AddFile('src\test\regress\pg_regress.c'); $pgregress_ecpg->AddFile('src/test/regress/pg_regress.c');
$pgregress_ecpg->AddIncludeDir('src\port'); $pgregress_ecpg->AddIncludeDir('src/port');
$pgregress_ecpg->AddIncludeDir('src\test\regress'); $pgregress_ecpg->AddIncludeDir('src/test/regress');
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"'); $pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$pgregress_ecpg->AddLibrary('ws2_32.lib'); $pgregress_ecpg->AddLibrary('ws2_32.lib');
$pgregress_ecpg->AddDirResourceFile('src\interfaces\ecpg\test'); $pgregress_ecpg->AddDirResourceFile('src/interfaces/ecpg/test');
$pgregress_ecpg->AddReference($libpgcommon, $libpgport); $pgregress_ecpg->AddReference($libpgcommon, $libpgport);
my $isolation_tester = my $isolation_tester =
$solution->AddProject('isolationtester', 'exe', 'misc'); $solution->AddProject('isolationtester', 'exe', 'misc');
$isolation_tester->AddFile('src\test\isolation\isolationtester.c'); $isolation_tester->AddFile('src/test/isolation/isolationtester.c');
$isolation_tester->AddFile('src\test\isolation\specparse.y'); $isolation_tester->AddFile('src/test/isolation/specparse.y');
$isolation_tester->AddFile('src\test\isolation\specscanner.l'); $isolation_tester->AddFile('src/test/isolation/specscanner.l');
$isolation_tester->AddFile('src\test\isolation\specparse.c'); $isolation_tester->AddFile('src/test/isolation/specparse.c');
$isolation_tester->AddIncludeDir('src\test\isolation'); $isolation_tester->AddIncludeDir('src/test/isolation');
$isolation_tester->AddIncludeDir('src\port'); $isolation_tester->AddIncludeDir('src/port');
$isolation_tester->AddIncludeDir('src\test\regress'); $isolation_tester->AddIncludeDir('src/test/regress');
$isolation_tester->AddIncludeDir('src\interfaces\libpq'); $isolation_tester->AddIncludeDir('src/interfaces/libpq');
$isolation_tester->AddDefine('HOST_TUPLE="i686-pc-win32vc"'); $isolation_tester->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$isolation_tester->AddLibrary('ws2_32.lib'); $isolation_tester->AddLibrary('ws2_32.lib');
$isolation_tester->AddDirResourceFile('src\test\isolation'); $isolation_tester->AddDirResourceFile('src/test/isolation');
$isolation_tester->AddReference($libpq, $libpgcommon, $libpgport); $isolation_tester->AddReference($libpq, $libpgcommon, $libpgport);
my $pgregress_isolation = my $pgregress_isolation =
$solution->AddProject('pg_isolation_regress', 'exe', 'misc'); $solution->AddProject('pg_isolation_regress', 'exe', 'misc');
$pgregress_isolation->AddFile('src\test\isolation\isolation_main.c'); $pgregress_isolation->AddFile('src/test/isolation/isolation_main.c');
$pgregress_isolation->AddFile('src\test\regress\pg_regress.c'); $pgregress_isolation->AddFile('src/test/regress/pg_regress.c');
$pgregress_isolation->AddIncludeDir('src\port'); $pgregress_isolation->AddIncludeDir('src/port');
$pgregress_isolation->AddIncludeDir('src\test\regress'); $pgregress_isolation->AddIncludeDir('src/test/regress');
$pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"'); $pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$pgregress_isolation->AddLibrary('ws2_32.lib'); $pgregress_isolation->AddLibrary('ws2_32.lib');
$pgregress_isolation->AddDirResourceFile('src\test\isolation'); $pgregress_isolation->AddDirResourceFile('src/test/isolation');
$pgregress_isolation->AddReference($libpgcommon, $libpgport); $pgregress_isolation->AddReference($libpgcommon, $libpgport);
# src/bin # src/bin
...@@ -421,40 +423,40 @@ sub mkvcbuild ...@@ -421,40 +423,40 @@ sub mkvcbuild
} }
my $pgbasebackup = AddSimpleFrontend('pg_basebackup', 1); my $pgbasebackup = AddSimpleFrontend('pg_basebackup', 1);
$pgbasebackup->AddFile('src\bin\pg_basebackup\pg_basebackup.c'); $pgbasebackup->AddFile('src/bin/pg_basebackup/pg_basebackup.c');
$pgbasebackup->AddLibrary('ws2_32.lib'); $pgbasebackup->AddLibrary('ws2_32.lib');
my $pgreceivexlog = AddSimpleFrontend('pg_basebackup', 1); my $pgreceivexlog = AddSimpleFrontend('pg_basebackup', 1);
$pgreceivexlog->{name} = 'pg_receivexlog'; $pgreceivexlog->{name} = 'pg_receivexlog';
$pgreceivexlog->AddFile('src\bin\pg_basebackup\pg_receivexlog.c'); $pgreceivexlog->AddFile('src/bin/pg_basebackup/pg_receivexlog.c');
$pgreceivexlog->AddLibrary('ws2_32.lib'); $pgreceivexlog->AddLibrary('ws2_32.lib');
my $pgrecvlogical = AddSimpleFrontend('pg_basebackup', 1); my $pgrecvlogical = AddSimpleFrontend('pg_basebackup', 1);
$pgrecvlogical->{name} = 'pg_recvlogical'; $pgrecvlogical->{name} = 'pg_recvlogical';
$pgrecvlogical->AddFile('src\bin\pg_basebackup\pg_recvlogical.c'); $pgrecvlogical->AddFile('src/bin/pg_basebackup/pg_recvlogical.c');
$pgrecvlogical->AddLibrary('ws2_32.lib'); $pgrecvlogical->AddLibrary('ws2_32.lib');
my $pgrewind = AddSimpleFrontend('pg_rewind', 1); my $pgrewind = AddSimpleFrontend('pg_rewind', 1);
$pgrewind->{name} = 'pg_rewind'; $pgrewind->{name} = 'pg_rewind';
$pgrewind->AddFile('src\backend\access\transam\xlogreader.c'); $pgrewind->AddFile('src/backend/access/transam/xlogreader.c');
$pgrewind->AddLibrary('ws2_32.lib'); $pgrewind->AddLibrary('ws2_32.lib');
$pgrewind->AddDefine('FRONTEND'); $pgrewind->AddDefine('FRONTEND');
my $pgevent = $solution->AddProject('pgevent', 'dll', 'bin'); my $pgevent = $solution->AddProject('pgevent', 'dll', 'bin');
$pgevent->AddFiles('src\bin\pgevent', 'pgevent.c', 'pgmsgevent.rc'); $pgevent->AddFiles('src/bin/pgevent', 'pgevent.c', 'pgmsgevent.rc');
$pgevent->AddResourceFile('src\bin\pgevent', 'Eventlog message formatter', $pgevent->AddResourceFile('src/bin/pgevent', 'Eventlog message formatter',
'win32'); 'win32');
$pgevent->RemoveFile('src\bin\pgevent\win32ver.rc'); $pgevent->RemoveFile('src/bin/pgevent/win32ver.rc');
$pgevent->UseDef('src\bin\pgevent\pgevent.def'); $pgevent->UseDef('src/bin/pgevent/pgevent.def');
$pgevent->DisableLinkerWarnings('4104'); $pgevent->DisableLinkerWarnings('4104');
my $pgdump = AddSimpleFrontend('pg_dump', 1); my $pgdump = AddSimpleFrontend('pg_dump', 1);
$pgdump->AddIncludeDir('src\backend'); $pgdump->AddIncludeDir('src/backend');
$pgdump->AddFile('src\bin\pg_dump\pg_dump.c'); $pgdump->AddFile('src/bin/pg_dump/pg_dump.c');
$pgdump->AddFile('src\bin\pg_dump\common.c'); $pgdump->AddFile('src/bin/pg_dump/common.c');
$pgdump->AddFile('src\bin\pg_dump\pg_dump_sort.c'); $pgdump->AddFile('src/bin/pg_dump/pg_dump_sort.c');
$pgdump->AddFile('src\bin\pg_dump\keywords.c'); $pgdump->AddFile('src/bin/pg_dump/keywords.c');
$pgdump->AddFile('src\backend\parser\kwlookup.c'); $pgdump->AddFile('src/backend/parser/kwlookup.c');
$pgdump->AddLibrary('ws2_32.lib'); $pgdump->AddLibrary('ws2_32.lib');
my $pgdumpall = AddSimpleFrontend('pg_dump', 1); my $pgdumpall = AddSimpleFrontend('pg_dump', 1);
...@@ -463,41 +465,41 @@ sub mkvcbuild ...@@ -463,41 +465,41 @@ sub mkvcbuild
# pg_dump and pg_restore. # pg_dump and pg_restore.
# So remove their sources from the object, keeping the other setup that # So remove their sources from the object, keeping the other setup that
# AddSimpleFrontend() has done. # AddSimpleFrontend() has done.
my @nodumpall = grep { m/src\\bin\\pg_dump\\.*\.c$/ } my @nodumpall = grep { m!src/bin/pg_dump/.*\.c$! }
keys %{ $pgdumpall->{files} }; keys %{ $pgdumpall->{files} };
delete @{ $pgdumpall->{files} }{@nodumpall}; delete @{ $pgdumpall->{files} }{@nodumpall};
$pgdumpall->{name} = 'pg_dumpall'; $pgdumpall->{name} = 'pg_dumpall';
$pgdumpall->AddIncludeDir('src\backend'); $pgdumpall->AddIncludeDir('src/backend');
$pgdumpall->AddFile('src\bin\pg_dump\pg_dumpall.c'); $pgdumpall->AddFile('src/bin/pg_dump/pg_dumpall.c');
$pgdumpall->AddFile('src\bin\pg_dump\dumputils.c'); $pgdumpall->AddFile('src/bin/pg_dump/dumputils.c');
$pgdumpall->AddFile('src\bin\pg_dump\keywords.c'); $pgdumpall->AddFile('src/bin/pg_dump/keywords.c');
$pgdumpall->AddFile('src\backend\parser\kwlookup.c'); $pgdumpall->AddFile('src/backend/parser/kwlookup.c');
$pgdumpall->AddLibrary('ws2_32.lib'); $pgdumpall->AddLibrary('ws2_32.lib');
my $pgrestore = AddSimpleFrontend('pg_dump', 1); my $pgrestore = AddSimpleFrontend('pg_dump', 1);
$pgrestore->{name} = 'pg_restore'; $pgrestore->{name} = 'pg_restore';
$pgrestore->AddIncludeDir('src\backend'); $pgrestore->AddIncludeDir('src/backend');
$pgrestore->AddFile('src\bin\pg_dump\pg_restore.c'); $pgrestore->AddFile('src/bin/pg_dump/pg_restore.c');
$pgrestore->AddFile('src\bin\pg_dump\keywords.c'); $pgrestore->AddFile('src/bin/pg_dump/keywords.c');
$pgrestore->AddFile('src\backend\parser\kwlookup.c'); $pgrestore->AddFile('src/backend/parser/kwlookup.c');
$pgrestore->AddLibrary('ws2_32.lib'); $pgrestore->AddLibrary('ws2_32.lib');
my $zic = $solution->AddProject('zic', 'exe', 'utils'); my $zic = $solution->AddProject('zic', 'exe', 'utils');
$zic->AddFiles('src\timezone', 'zic.c', 'ialloc.c', 'scheck.c', $zic->AddFiles('src/timezone', 'zic.c', 'ialloc.c', 'scheck.c',
'localtime.c'); 'localtime.c');
$zic->AddDirResourceFile('src\timezone'); $zic->AddDirResourceFile('src/timezone');
$zic->AddReference($libpgcommon, $libpgport); $zic->AddReference($libpgcommon, $libpgport);
if ($solution->{options}->{xml}) if ($solution->{options}->{xml})
{ {
$contrib_extraincludes->{'pgxml'} = [ $contrib_extraincludes->{'pgxml'} = [
$solution->{options}->{xml} . '\include', $solution->{options}->{xml} . '/include',
$solution->{options}->{xslt} . '\include', $solution->{options}->{xslt} . '/include',
$solution->{options}->{iconv} . '\include' ]; $solution->{options}->{iconv} . '/include' ];
$contrib_extralibs->{'pgxml'} = [ $contrib_extralibs->{'pgxml'} = [
$solution->{options}->{xml} . '\lib\libxml2.lib', $solution->{options}->{xml} . '/lib/libxml2.lib',
$solution->{options}->{xslt} . '\lib\libxslt.lib' ]; $solution->{options}->{xslt} . '/lib/libxslt.lib' ];
} }
else else
{ {
...@@ -512,9 +514,9 @@ sub mkvcbuild ...@@ -512,9 +514,9 @@ sub mkvcbuild
if ($solution->{options}->{uuid}) if ($solution->{options}->{uuid})
{ {
$contrib_extraincludes->{'uuid-ossp'} = $contrib_extraincludes->{'uuid-ossp'} =
[ $solution->{options}->{uuid} . '\include' ]; [ $solution->{options}->{uuid} . '/include' ];
$contrib_extralibs->{'uuid-ossp'} = $contrib_extralibs->{'uuid-ossp'} =
[ $solution->{options}->{uuid} . '\lib\uuid.lib' ]; [ $solution->{options}->{uuid} . '/lib/uuid.lib' ];
} }
else else
{ {
...@@ -524,9 +526,9 @@ sub mkvcbuild ...@@ -524,9 +526,9 @@ sub mkvcbuild
# AddProject() does not recognize the constructs used to populate OBJS in # AddProject() does not recognize the constructs used to populate OBJS in
# the pgcrypto Makefile, so it will discover no files. # the pgcrypto Makefile, so it will discover no files.
my $pgcrypto = my $pgcrypto =
$solution->AddProject('pgcrypto', 'dll', 'crypto', 'contrib\\pgcrypto'); $solution->AddProject('pgcrypto', 'dll', 'crypto', 'contrib/pgcrypto');
$pgcrypto->AddFiles( $pgcrypto->AddFiles(
'contrib\pgcrypto', 'pgcrypto.c', 'contrib/pgcrypto', 'pgcrypto.c',
'px.c', 'px-hmac.c', 'px.c', 'px-hmac.c',
'px-crypt.c', 'crypt-gensalt.c', 'px-crypt.c', 'crypt-gensalt.c',
'crypt-blowfish.c', 'crypt-des.c', 'crypt-blowfish.c', 'crypt-des.c',
...@@ -540,13 +542,13 @@ sub mkvcbuild ...@@ -540,13 +542,13 @@ sub mkvcbuild
'pgp-pgsql.c'); 'pgp-pgsql.c');
if ($solution->{options}->{openssl}) if ($solution->{options}->{openssl})
{ {
$pgcrypto->AddFiles('contrib\pgcrypto', 'openssl.c', $pgcrypto->AddFiles('contrib/pgcrypto', 'openssl.c',
'pgp-mpi-openssl.c'); 'pgp-mpi-openssl.c');
} }
else else
{ {
$pgcrypto->AddFiles( $pgcrypto->AddFiles(
'contrib\pgcrypto', 'md5.c', 'contrib/pgcrypto', 'md5.c',
'sha1.c', 'sha2.c', 'sha1.c', 'sha2.c',
'internal.c', 'internal-sha2.c', 'internal.c', 'internal-sha2.c',
'blf.c', 'rijndael.c', 'blf.c', 'rijndael.c',
...@@ -572,22 +574,22 @@ sub mkvcbuild ...@@ -572,22 +574,22 @@ sub mkvcbuild
} }
$mf = $mf =
Project::read_file('src\backend\utils\mb\conversion_procs\Makefile'); Project::read_file('src/backend/utils/mb/conversion_procs/Makefile');
$mf =~ s{\\\r?\n}{}g; $mf =~ s{\\\r?\n}{}g;
$mf =~ m{SUBDIRS\s*=\s*(.*)$}m $mf =~ m{SUBDIRS\s*=\s*(.*)$}m
|| die 'Could not match in conversion makefile' . "\n"; || die 'Could not match in conversion makefile' . "\n";
foreach my $sub (split /\s+/, $1) foreach my $sub (split /\s+/, $1)
{ {
my $dir = 'src\backend\utils\mb\conversion_procs\\' . $sub; my $dir = 'src/backend/utils/mb/conversion_procs/' . $sub;
my $p = $solution->AddProject($sub, 'dll', 'conversion procs', $dir); my $p = $solution->AddProject($sub, 'dll', 'conversion procs', $dir);
$p->AddFile("$dir\\$sub.c"); # implicit source file $p->AddFile("$dir/$sub.c"); # implicit source file
$p->AddReference($postgres); $p->AddReference($postgres);
} }
$mf = Project::read_file('src\bin\scripts\Makefile'); $mf = Project::read_file('src/bin/scripts/Makefile');
$mf =~ s{\\\r?\n}{}g; $mf =~ s{\\\r?\n}{}g;
$mf =~ m{PROGRAMS\s*=\s*(.*)$}m $mf =~ m{PROGRAMS\s*=\s*(.*)$}m
|| die 'Could not match in bin\scripts\Makefile' . "\n"; || die 'Could not match in bin/scripts/Makefile' . "\n";
foreach my $prg (split /\s+/, $1) foreach my $prg (split /\s+/, $1)
{ {
my $proj = $solution->AddProject($prg, 'exe', 'bin'); my $proj = $solution->AddProject($prg, 'exe', 'bin');
...@@ -599,57 +601,57 @@ sub mkvcbuild ...@@ -599,57 +601,57 @@ sub mkvcbuild
$f =~ s/\.o$/\.c/; $f =~ s/\.o$/\.c/;
if ($f eq 'keywords.c') if ($f eq 'keywords.c')
{ {
$proj->AddFile('src\bin\pg_dump\keywords.c'); $proj->AddFile('src/bin/pg_dump/keywords.c');
} }
elsif ($f eq 'kwlookup.c') elsif ($f eq 'kwlookup.c')
{ {
$proj->AddFile('src\backend\parser\kwlookup.c'); $proj->AddFile('src/backend/parser/kwlookup.c');
} }
elsif ($f eq 'dumputils.c') elsif ($f eq 'dumputils.c')
{ {
$proj->AddFile('src\bin\pg_dump\dumputils.c'); $proj->AddFile('src/bin/pg_dump/dumputils.c');
} }
elsif ($f =~ /print\.c$/) elsif ($f =~ /print\.c$/)
{ # Also catches mbprint.c { # Also catches mbprint.c
$proj->AddFile('src\bin\psql\\' . $f); $proj->AddFile('src/bin/psql/' . $f);
} }
elsif ($f =~ /\.c$/) elsif ($f =~ /\.c$/)
{ {
$proj->AddFile('src\bin\scripts\\' . $f); $proj->AddFile('src/bin/scripts/' . $f);
} }
} }
$proj->AddIncludeDir('src\interfaces\libpq'); $proj->AddIncludeDir('src/interfaces/libpq');
$proj->AddIncludeDir('src\bin\pg_dump'); $proj->AddIncludeDir('src/bin/pg_dump');
$proj->AddIncludeDir('src\bin\psql'); $proj->AddIncludeDir('src/bin/psql');
$proj->AddReference($libpq, $libpgcommon, $libpgport); $proj->AddReference($libpq, $libpgcommon, $libpgport);
$proj->AddDirResourceFile('src\bin\scripts'); $proj->AddDirResourceFile('src/bin/scripts');
$proj->AddLibrary('ws2_32.lib'); $proj->AddLibrary('ws2_32.lib');
} }
# Regression DLL and EXE # Regression DLL and EXE
my $regress = $solution->AddProject('regress', 'dll', 'misc'); my $regress = $solution->AddProject('regress', 'dll', 'misc');
$regress->AddFile('src\test\regress\regress.c'); $regress->AddFile('src/test/regress/regress.c');
$regress->AddDirResourceFile('src\test\regress'); $regress->AddDirResourceFile('src/test/regress');
$regress->AddReference($postgres); $regress->AddReference($postgres);
my $pgregress = $solution->AddProject('pg_regress', 'exe', 'misc'); my $pgregress = $solution->AddProject('pg_regress', 'exe', 'misc');
$pgregress->AddFile('src\test\regress\pg_regress.c'); $pgregress->AddFile('src/test/regress/pg_regress.c');
$pgregress->AddFile('src\test\regress\pg_regress_main.c'); $pgregress->AddFile('src/test/regress/pg_regress_main.c');
$pgregress->AddIncludeDir('src\port'); $pgregress->AddIncludeDir('src/port');
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"'); $pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$pgregress->AddLibrary('ws2_32.lib'); $pgregress->AddLibrary('ws2_32.lib');
$pgregress->AddDirResourceFile('src\test\regress'); $pgregress->AddDirResourceFile('src/test/regress');
$pgregress->AddReference($libpgcommon, $libpgport); $pgregress->AddReference($libpgcommon, $libpgport);
# fix up pg_xlogdump once it's been set up # fix up pg_xlogdump once it's been set up
# files symlinked on Unix are copied on windows # files symlinked on Unix are copied on windows
my $pg_xlogdump = AddSimpleFrontend('pg_xlogdump'); my $pg_xlogdump = AddSimpleFrontend('pg_xlogdump');
$pg_xlogdump->AddDefine('FRONTEND'); $pg_xlogdump->AddDefine('FRONTEND');
foreach my $xf (glob('src\\backend\\access\\rmgrdesc\\*desc.c')) foreach my $xf (glob('src/backend/access/rmgrdesc/*desc.c'))
{ {
$pg_xlogdump->AddFile($xf) $pg_xlogdump->AddFile($xf)
} }
$pg_xlogdump->AddFile('src\backend\access\transam\xlogreader.c'); $pg_xlogdump->AddFile('src/backend/access/transam/xlogreader.c');
$solution->Save(); $solution->Save();
return $solution->{vcver}; return $solution->{vcver};
...@@ -666,11 +668,11 @@ sub AddSimpleFrontend ...@@ -666,11 +668,11 @@ sub AddSimpleFrontend
my $uselibpq = shift; my $uselibpq = shift;
my $p = $solution->AddProject($n, 'exe', 'bin'); my $p = $solution->AddProject($n, 'exe', 'bin');
$p->AddDir('src\bin\\' . $n); $p->AddDir('src/bin/' . $n);
$p->AddReference($libpgcommon, $libpgport); $p->AddReference($libpgcommon, $libpgport);
if ($uselibpq) if ($uselibpq)
{ {
$p->AddIncludeDir('src\interfaces\libpq'); $p->AddIncludeDir('src/interfaces/libpq');
$p->AddReference($libpq); $p->AddReference($libpq);
} }
...@@ -702,7 +704,7 @@ sub AddContrib ...@@ -702,7 +704,7 @@ sub AddContrib
my $proj = my $proj =
$solution->AddProject($mod, 'dll', 'contrib', "$subdir/$n"); $solution->AddProject($mod, 'dll', 'contrib', "$subdir/$n");
my $filename = $mod . '.c'; my $filename = $mod . '.c';
$proj->AddFile($subdir . '\\' . $n . '\\' . $mod . '.c'); $proj->AddFile("$subdir/$n/$filename");
$proj->AddReference($postgres); $proj->AddReference($postgres);
AdjustContribProj($proj); AdjustContribProj($proj);
} }
......
...@@ -52,20 +52,19 @@ sub AddFiles ...@@ -52,20 +52,19 @@ sub AddFiles
while (my $f = shift) while (my $f = shift)
{ {
$self->{files}->{ $dir . "\\" . $f } = 1; $self->{files}->{ $dir . "/" . $f } = 1;
} }
} }
sub ReplaceFile sub ReplaceFile
{ {
my ($self, $filename, $newname) = @_; my ($self, $filename, $newname) = @_;
my $re = "\\\\$filename\$"; my $re = "\\/$filename\$";
foreach my $file (keys %{ $self->{files} }) foreach my $file (keys %{ $self->{files} })
{ {
# Match complete filename # Match complete filename
if ($filename =~ /\\/) if ($filename =~ m!/!)
{ {
if ($file eq $filename) if ($file eq $filename)
{ {
...@@ -77,7 +76,7 @@ sub ReplaceFile ...@@ -77,7 +76,7 @@ sub ReplaceFile
elsif ($file =~ m/($re)/) elsif ($file =~ m/($re)/)
{ {
delete $self->{files}{$file}; delete $self->{files}{$file};
$self->{files}{"$newname\\$filename"} = 1; $self->{files}{"$newname/$filename"} = 1;
return; return;
} }
} }
...@@ -105,7 +104,7 @@ sub RelocateFiles ...@@ -105,7 +104,7 @@ sub RelocateFiles
if ($r) if ($r)
{ {
$self->RemoveFile($f); $self->RemoveFile($f);
$self->AddFile($targetdir . '\\' . basename($f)); $self->AddFile($targetdir . '/' . basename($f));
} }
} }
} }
...@@ -118,7 +117,7 @@ sub AddReference ...@@ -118,7 +117,7 @@ sub AddReference
{ {
push @{ $self->{references} }, $ref; push @{ $self->{references} }, $ref;
$self->AddLibrary( $self->AddLibrary(
"__CFGNAME__\\" . $ref->{name} . "\\" . $ref->{name} . ".lib"); "__CFGNAME__/" . $ref->{name} . "/" . $ref->{name} . ".lib");
} }
} }
...@@ -169,8 +168,8 @@ sub FullExportDLL ...@@ -169,8 +168,8 @@ sub FullExportDLL
my ($self, $libname) = @_; my ($self, $libname) = @_;
$self->{builddef} = 1; $self->{builddef} = 1;
$self->{def} = ".\\__CFGNAME__\\$self->{name}\\$self->{name}.def"; $self->{def} = "./__CFGNAME__/$self->{name}/$self->{name}.def";
$self->{implib} = "__CFGNAME__\\$self->{name}\\$libname"; $self->{implib} = "__CFGNAME__/$self->{name}/$libname";
} }
sub UseDef sub UseDef
...@@ -194,9 +193,9 @@ sub AddDir ...@@ -194,9 +193,9 @@ sub AddDir
if $subdir eq "\$(top_builddir)/src/timezone" if $subdir eq "\$(top_builddir)/src/timezone"
; #special case for non-standard include ; #special case for non-standard include
next next
if $reldir . "\\" . $subdir eq "src\\backend\\port\\darwin"; if $reldir . "/" . $subdir eq "src/backend/port/darwin";
$self->AddDir($reldir . "\\" . $subdir); $self->AddDir($reldir . "/" . $subdir);
} }
} }
while ($mf =~ m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m) while ($mf =~ m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m)
...@@ -243,13 +242,11 @@ sub AddDir ...@@ -243,13 +242,11 @@ sub AddDir
if ($f =~ /^\$\(top_builddir\)\/(.*)/) if ($f =~ /^\$\(top_builddir\)\/(.*)/)
{ {
$f = $1; $f = $1;
$f =~ s/\//\\/g;
$self->{files}->{$f} = 1; $self->{files}->{$f} = 1;
} }
else else
{ {
$f =~ s/\//\\/g; $self->{files}->{"$reldir/$f"} = 1;
$self->{files}->{"$reldir\\$f"} = 1;
} }
} }
$mf =~ s{OBJS[^=]*=\s*(.*)$}{}m; $mf =~ s{OBJS[^=]*=\s*(.*)$}{}m;
...@@ -264,7 +261,6 @@ sub AddDir ...@@ -264,7 +261,6 @@ sub AddDir
my $match = $1; my $match = $1;
my $top = $2; my $top = $2;
my $target = $3; my $target = $3;
$target =~ s{/}{\\}g;
my @pieces = split /\s+/, $match; my @pieces = split /\s+/, $match;
foreach my $fn (@pieces) foreach my $fn (@pieces)
{ {
...@@ -274,7 +270,7 @@ sub AddDir ...@@ -274,7 +270,7 @@ sub AddDir
} }
elsif ($top eq "(backend_src)") elsif ($top eq "(backend_src)")
{ {
eval { $self->ReplaceFile($fn, "src\\backend\\$target") }; eval { $self->ReplaceFile($fn, "src/backend/$target") };
} }
else else
{ {
...@@ -310,12 +306,12 @@ sub AddResourceFile ...@@ -310,12 +306,12 @@ sub AddResourceFile
localtime(time); localtime(time);
my $d = sprintf("%02d%03d", ($year - 100), $yday); my $d = sprintf("%02d%03d", ($year - 100), $yday);
if (Solution::IsNewer("$dir\\win32ver.rc", 'src\port\win32ver.rc')) if (Solution::IsNewer("$dir/win32ver.rc", 'src/port/win32ver.rc'))
{ {
print "Generating win32ver.rc for $dir\n"; print "Generating win32ver.rc for $dir\n";
open(I, 'src\port\win32ver.rc') open(I, 'src/port/win32ver.rc')
|| confess "Could not open win32ver.rc"; || confess "Could not open win32ver.rc";
open(O, ">$dir\\win32ver.rc") open(O, ">$dir/win32ver.rc")
|| confess "Could not write win32ver.rc"; || confess "Could not write win32ver.rc";
my $icostr = $ico ? "IDI_ICON ICON \"src/port/$ico.ico\"" : ""; my $icostr = $ico ? "IDI_ICON ICON \"src/port/$ico.ico\"" : "";
while (<I>) while (<I>)
...@@ -332,7 +328,7 @@ sub AddResourceFile ...@@ -332,7 +328,7 @@ sub AddResourceFile
} }
close(O); close(O);
close(I); close(I);
$self->AddFile("$dir\\win32ver.rc"); $self->AddFile("$dir/win32ver.rc");
} }
sub DisableLinkerWarnings sub DisableLinkerWarnings
...@@ -415,9 +411,9 @@ sub read_makefile ...@@ -415,9 +411,9 @@ sub read_makefile
my $t = $/; my $t = $/;
undef $/; undef $/;
open($F, "$reldir\\GNUmakefile") open($F, "$reldir/GNUmakefile")
|| open($F, "$reldir\\Makefile") || open($F, "$reldir/Makefile")
|| croak "Could not open $reldir\\Makefile\n"; || confess "Could not open $reldir/Makefile\n";
my $txt = <$F>; my $txt = <$F>;
close($F); close($F);
$/ = $t; $/ = $t;
......
...@@ -87,15 +87,15 @@ sub DeterminePlatform ...@@ -87,15 +87,15 @@ sub DeterminePlatform
sub IsNewer sub IsNewer
{ {
my ($newfile, $oldfile) = @_; my ($newfile, $oldfile) = @_;
if ( $oldfile ne 'src\tools\msvc\config.pl' if ( $oldfile ne 'src/tools/msvc/config.pl'
&& $oldfile ne 'src\tools\msvc\config_default.pl') && $oldfile ne 'src/tools/msvc/config_default.pl')
{ {
return 1 return 1
if (-f 'src\tools\msvc\config.pl') if (-f 'src/tools/msvc/config.pl')
&& IsNewer($newfile, 'src\tools\msvc\config.pl'); && IsNewer($newfile, 'src/tools/msvc/config.pl');
return 1 return 1
if (-f 'src\tools\msvc\config_default.pl') if (-f 'src/tools/msvc/config_default.pl')
&& IsNewer($newfile, 'src\tools\msvc\config_default.pl'); && IsNewer($newfile, 'src/tools/msvc/config_default.pl');
} }
return 1 if (!(-e $newfile)); return 1 if (!(-e $newfile));
my @nstat = stat($newfile); my @nstat = stat($newfile);
...@@ -144,20 +144,20 @@ sub GenerateFiles ...@@ -144,20 +144,20 @@ sub GenerateFiles
if ($self->{strver} eq '' || $self->{numver} eq ''); if ($self->{strver} eq '' || $self->{numver} eq '');
if (IsNewer( if (IsNewer(
"src\\include\\pg_config_os.h", "src\\include\\port\\win32.h")) "src/include/pg_config_os.h", "src/include/port/win32.h"))
{ {
print "Copying pg_config_os.h...\n"; print "Copying pg_config_os.h...\n";
copyFile("src\\include\\port\\win32.h", copyFile("src/include/port/win32.h",
"src\\include\\pg_config_os.h"); "src/include/pg_config_os.h");
} }
if (IsNewer( if (IsNewer(
"src\\include\\pg_config.h", "src\\include\\pg_config.h.win32")) "src/include/pg_config.h", "src/include/pg_config.h.win32"))
{ {
print "Generating pg_config.h...\n"; print "Generating pg_config.h...\n";
open(I, "src\\include\\pg_config.h.win32") open(I, "src/include/pg_config.h.win32")
|| confess "Could not open pg_config.h.win32\n"; || confess "Could not open pg_config.h.win32\n";
open(O, ">src\\include\\pg_config.h") open(O, ">src/include/pg_config.h")
|| confess "Could not write to pg_config.h\n"; || confess "Could not write to pg_config.h\n";
my $extraver = $self->{options}->{extraver}; my $extraver = $self->{options}->{extraver};
$extraver = '' unless defined $extraver; $extraver = '' unless defined $extraver;
...@@ -245,111 +245,111 @@ sub GenerateFiles ...@@ -245,111 +245,111 @@ sub GenerateFiles
} }
if (IsNewer( if (IsNewer(
"src\\include\\pg_config_ext.h", "src/include/pg_config_ext.h",
"src\\include\\pg_config_ext.h.win32")) "src/include/pg_config_ext.h.win32"))
{ {
print "Copying pg_config_ext.h...\n"; print "Copying pg_config_ext.h...\n";
copyFile( copyFile(
"src\\include\\pg_config_ext.h.win32", "src/include/pg_config_ext.h.win32",
"src\\include\\pg_config_ext.h"); "src/include/pg_config_ext.h");
} }
$self->GenerateDefFile( $self->GenerateDefFile(
"src\\interfaces\\libpq\\libpqdll.def", "src/interfaces/libpq/libpqdll.def",
"src\\interfaces\\libpq\\exports.txt", "src/interfaces/libpq/exports.txt",
"LIBPQ"); "LIBPQ");
$self->GenerateDefFile( $self->GenerateDefFile(
"src\\interfaces\\ecpg\\ecpglib\\ecpglib.def", "src/interfaces/ecpg/ecpglib/ecpglib.def",
"src\\interfaces\\ecpg\\ecpglib\\exports.txt", "src/interfaces/ecpg/ecpglib/exports.txt",
"LIBECPG"); "LIBECPG");
$self->GenerateDefFile( $self->GenerateDefFile(
"src\\interfaces\\ecpg\\compatlib\\compatlib.def", "src/interfaces/ecpg/compatlib/compatlib.def",
"src\\interfaces\\ecpg\\compatlib\\exports.txt", "src/interfaces/ecpg/compatlib/exports.txt",
"LIBECPG_COMPAT"); "LIBECPG_COMPAT");
$self->GenerateDefFile( $self->GenerateDefFile(
"src\\interfaces\\ecpg\\pgtypeslib\\pgtypeslib.def", "src/interfaces/ecpg/pgtypeslib/pgtypeslib.def",
"src\\interfaces\\ecpg\\pgtypeslib\\exports.txt", "src/interfaces/ecpg/pgtypeslib/exports.txt",
"LIBPGTYPES"); "LIBPGTYPES");
if (IsNewer( if (IsNewer(
'src\backend\utils\fmgrtab.c', 'src\include\catalog\pg_proc.h')) 'src/backend/utils/fmgrtab.c', 'src/include/catalog/pg_proc.h'))
{ {
print "Generating fmgrtab.c and fmgroids.h...\n"; print "Generating fmgrtab.c and fmgroids.h...\n";
chdir('src\backend\utils'); chdir('src/backend/utils');
system( system(
"perl -I ../catalog Gen_fmgrtab.pl ../../../src/include/catalog/pg_proc.h"); "perl -I ../catalog Gen_fmgrtab.pl ../../../src/include/catalog/pg_proc.h");
chdir('..\..\..'); chdir('../../..');
} }
if (IsNewer( if (IsNewer(
'src\include\utils\fmgroids.h', 'src/include/utils/fmgroids.h',
'src\backend\utils\fmgroids.h')) 'src/backend/utils/fmgroids.h'))
{ {
copyFile('src\backend\utils\fmgroids.h', copyFile('src/backend/utils/fmgroids.h',
'src\include\utils\fmgroids.h'); 'src/include/utils/fmgroids.h');
} }
if (IsNewer('src\include\utils\probes.h', 'src\backend\utils\probes.d')) if (IsNewer('src/include/utils/probes.h', 'src/backend/utils/probes.d'))
{ {
print "Generating probes.h...\n"; print "Generating probes.h...\n";
system( system(
'psed -f src\backend\utils\Gen_dummy_probes.sed src\backend\utils\probes.d > src\include\utils\probes.h' 'psed -f src/backend/utils/Gen_dummy_probes.sed src/backend/utils/probes.d > src/include/utils/probes.h'
); );
} }
if ($self->{options}->{python} if ($self->{options}->{python}
&& IsNewer( && IsNewer(
'src\pl\plpython\spiexceptions.h', 'src/pl/plpython/spiexceptions.h',
'src\include\backend\errcodes.txt')) 'src/include/backend/errcodes.txt'))
{ {
print "Generating spiexceptions.h...\n"; print "Generating spiexceptions.h...\n";
system( system(
'perl src\pl\plpython\generate-spiexceptions.pl src\backend\utils\errcodes.txt > src\pl\plpython\spiexceptions.h' 'perl src/pl/plpython/generate-spiexceptions.pl src/backend/utils/errcodes.txt > src/pl/plpython/spiexceptions.h'
); );
} }
if (IsNewer( if (IsNewer(
'src\include\utils\errcodes.h', 'src/include/utils/errcodes.h',
'src\backend\utils\errcodes.txt')) 'src/backend/utils/errcodes.txt'))
{ {
print "Generating errcodes.h...\n"; print "Generating errcodes.h...\n";
system( system(
'perl src\backend\utils\generate-errcodes.pl src\backend\utils\errcodes.txt > src\backend\utils\errcodes.h' 'perl src/backend/utils/generate-errcodes.pl src/backend/utils/errcodes.txt > src/backend/utils/errcodes.h'
); );
copyFile('src\backend\utils\errcodes.h', copyFile('src/backend/utils/errcodes.h',
'src\include\utils\errcodes.h'); 'src/include/utils/errcodes.h');
} }
if (IsNewer( if (IsNewer(
'src\pl\plpgsql\src\plerrcodes.h', 'src/pl/plpgsql/src/plerrcodes.h',
'src\backend\utils\errcodes.txt')) 'src/backend/utils/errcodes.txt'))
{ {
print "Generating plerrcodes.h...\n"; print "Generating plerrcodes.h...\n";
system( system(
'perl src\pl\plpgsql\src\generate-plerrcodes.pl src\backend\utils\errcodes.txt > src\pl\plpgsql\src\plerrcodes.h' 'perl src/pl/plpgsql/src/generate-plerrcodes.pl src/backend/utils/errcodes.txt > src/pl/plpgsql/src/plerrcodes.h'
); );
} }
if (IsNewer( if (IsNewer(
'src\backend\utils\sort\qsort_tuple.c', 'src/backend/utils/sort/qsort_tuple.c',
'src\backend\utils\sort\gen_qsort_tuple.pl')) 'src/backend/utils/sort/gen_qsort_tuple.pl'))
{ {
print "Generating qsort_tuple.c...\n"; print "Generating qsort_tuple.c...\n";
system( system(
'perl src\backend\utils\sort\gen_qsort_tuple.pl > src\backend\utils\sort\qsort_tuple.c' 'perl src/backend/utils/sort/gen_qsort_tuple.pl > src/backend/utils/sort/qsort_tuple.c'
); );
} }
if (IsNewer( if (IsNewer(
'src\interfaces\libpq\libpq.rc', 'src/interfaces/libpq/libpq.rc',
'src\interfaces\libpq\libpq.rc.in')) 'src/interfaces/libpq/libpq.rc.in'))
{ {
print "Generating libpq.rc...\n"; print "Generating libpq.rc...\n";
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime(time); localtime(time);
my $d = ($year - 100) . "$yday"; my $d = ($year - 100) . "$yday";
open(I, '<', 'src\interfaces\libpq\libpq.rc.in') open(I, '<', 'src/interfaces/libpq/libpq.rc.in')
|| confess "Could not open libpq.rc.in"; || confess "Could not open libpq.rc.in";
open(O, '>', 'src\interfaces\libpq\libpq.rc') open(O, '>', 'src/interfaces/libpq/libpq.rc')
|| confess "Could not open libpq.rc"; || confess "Could not open libpq.rc";
while (<I>) while (<I>)
{ {
...@@ -360,30 +360,30 @@ sub GenerateFiles ...@@ -360,30 +360,30 @@ sub GenerateFiles
close(O); close(O);
} }
if (IsNewer('src\bin\psql\sql_help.h', 'src\bin\psql\create_help.pl')) if (IsNewer('src/bin/psql/sql_help.h', 'src/bin/psql/create_help.pl'))
{ {
print "Generating sql_help.h...\n"; print "Generating sql_help.h...\n";
chdir('src\bin\psql'); chdir('src/bin/psql');
system("perl create_help.pl ../../../doc/src/sgml/ref sql_help"); system("perl create_help.pl ../../../doc/src/sgml/ref sql_help");
chdir('..\..\..'); chdir('../../..');
} }
if (IsNewer( if (IsNewer(
'src\interfaces\ecpg\preproc\preproc.y', 'src/interfaces/ecpg/preproc/preproc.y',
'src\backend\parser\gram.y')) 'src/backend/parser/gram.y'))
{ {
print "Generating preproc.y...\n"; print "Generating preproc.y...\n";
chdir('src\interfaces\ecpg\preproc'); chdir('src/interfaces/ecpg/preproc');
system('perl parse.pl < ..\..\..\backend\parser\gram.y > preproc.y'); system('perl parse.pl < ../../../backend/parser/gram.y > preproc.y');
chdir('..\..\..\..'); chdir('../../../..');
} }
if (IsNewer( if (IsNewer(
'src\interfaces\ecpg\include\ecpg_config.h', 'src/interfaces/ecpg/include/ecpg_config.h',
'src\interfaces\ecpg\include\ecpg_config.h.in')) 'src/interfaces/ecpg/include/ecpg_config.h.in'))
{ {
print "Generating ecpg_config.h...\n"; print "Generating ecpg_config.h...\n";
open(O, '>', 'src\interfaces\ecpg\include\ecpg_config.h') open(O, '>', 'src/interfaces/ecpg/include/ecpg_config.h')
|| confess "Could not open ecpg_config.h"; || confess "Could not open ecpg_config.h";
print O <<EOF; print O <<EOF;
#if (_MSC_VER > 1200) #if (_MSC_VER > 1200)
...@@ -396,10 +396,10 @@ EOF ...@@ -396,10 +396,10 @@ EOF
close(O); close(O);
} }
unless (-f "src\\port\\pg_config_paths.h") unless (-f "src/port/pg_config_paths.h")
{ {
print "Generating pg_config_paths.h...\n"; print "Generating pg_config_paths.h...\n";
open(O, '>', 'src\port\pg_config_paths.h') open(O, '>', 'src/port/pg_config_paths.h')
|| confess "Could not open pg_config_paths.h"; || confess "Could not open pg_config_paths.h";
print O <<EOF; print O <<EOF;
#define PGBINDIR "/bin" #define PGBINDIR "/bin"
...@@ -418,7 +418,7 @@ EOF ...@@ -418,7 +418,7 @@ EOF
close(O); close(O);
} }
my $mf = Project::read_file('src\backend\catalog\Makefile'); my $mf = Project::read_file('src/backend/catalog/Makefile');
$mf =~ s{\\\r?\n}{}g; $mf =~ s{\\\r?\n}{}g;
$mf =~ /^POSTGRES_BKI_SRCS\s*:?=[^,]+,(.*)\)$/gm $mf =~ /^POSTGRES_BKI_SRCS\s*:?=[^,]+,(.*)\)$/gm
|| croak "Could not find POSTGRES_BKI_SRCS in Makefile\n"; || croak "Could not find POSTGRES_BKI_SRCS in Makefile\n";
...@@ -431,15 +431,15 @@ EOF ...@@ -431,15 +431,15 @@ EOF
"src/include/catalog/$bki")) "src/include/catalog/$bki"))
{ {
print "Generating postgres.bki and schemapg.h...\n"; print "Generating postgres.bki and schemapg.h...\n";
chdir('src\backend\catalog'); chdir('src/backend/catalog');
my $bki_srcs = join(' ../../../src/include/catalog/', @allbki); my $bki_srcs = join(' ../../../src/include/catalog/', @allbki);
system( system(
"perl genbki.pl -I../../../src/include/catalog --set-version=$self->{majorver} $bki_srcs" "perl genbki.pl -I../../../src/include/catalog --set-version=$self->{majorver} $bki_srcs"
); );
chdir('..\..\..'); chdir('../../..');
copyFile( copyFile(
'src\backend\catalog\schemapg.h', 'src/backend/catalog/schemapg.h',
'src\include\catalog\schemapg.h'); 'src/include/catalog/schemapg.h');
last; last;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment