2007-03-17 14:50:42 +01:00
|
|
|
package Mkvcbuild;
|
2007-03-23 10:53:33 +01:00
|
|
|
|
2007-03-17 15:01:01 +01:00
|
|
|
#
|
|
|
|
# Package that generates build files for msvc build
|
|
|
|
#
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/tools/msvc/Mkvcbuild.pm
|
2007-03-17 15:01:01 +01:00
|
|
|
#
|
2007-03-17 14:50:42 +01:00
|
|
|
use Carp;
|
|
|
|
use Win32;
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Project;
|
|
|
|
use Solution;
|
2010-01-09 15:45:47 +01:00
|
|
|
use Cwd;
|
|
|
|
use File::Copy;
|
2011-11-26 21:22:32 +01:00
|
|
|
use Config;
|
2012-01-03 14:44:26 +01:00
|
|
|
use VSObjectFactory;
|
2011-11-26 21:22:32 +01:00
|
|
|
use List::Util qw(first);
|
2007-03-17 14:50:42 +01:00
|
|
|
|
|
|
|
use Exporter;
|
|
|
|
our (@ISA, @EXPORT_OK);
|
2012-07-05 03:47:49 +02:00
|
|
|
@ISA = qw(Exporter);
|
2007-03-17 14:50:42 +01:00
|
|
|
@EXPORT_OK = qw(Mkvcbuild);
|
|
|
|
|
|
|
|
my $solution;
|
|
|
|
my $libpgport;
|
|
|
|
my $postgres;
|
|
|
|
my $libpq;
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' };
|
|
|
|
my @contrib_uselibpq =
|
|
|
|
('dblink', 'oid2name', 'pgbench', 'pg_upgrade', 'vacuumlo');
|
|
|
|
my @contrib_uselibpgport = (
|
|
|
|
'oid2name', 'pgbench',
|
|
|
|
'pg_standby', 'pg_archivecleanup',
|
|
|
|
'pg_test_fsync', 'pg_test_timing',
|
|
|
|
'pg_upgrade', 'vacuumlo');
|
|
|
|
my $contrib_extralibs = { 'pgbench' => ['wsock32.lib'] };
|
|
|
|
my $contrib_extraincludes =
|
|
|
|
{ 'tsearch2' => ['contrib/tsearch2'], 'dblink' => ['src/backend'] };
|
2007-03-17 14:50:42 +01:00
|
|
|
my $contrib_extrasource = {
|
2012-07-05 03:47:49 +02:00
|
|
|
'cube' => [ 'cubescan.l', 'cubeparse.y' ],
|
|
|
|
'seg' => [ 'segscan.l', 'segparse.y' ] };
|
|
|
|
my @contrib_excludes = ('pgcrypto', 'intagg', 'sepgsql');
|
2007-03-17 14:50:42 +01:00
|
|
|
|
|
|
|
sub mkvcbuild
|
|
|
|
{
|
2012-06-10 21:20:04 +02:00
|
|
|
our $config = shift;
|
|
|
|
|
|
|
|
chdir('..\..\..') if (-d '..\msvc' && -d '..\..\..\src');
|
2012-07-05 03:47:49 +02:00
|
|
|
die 'Must run from root or msvc directory'
|
|
|
|
unless (-d 'src\tools\msvc' && -d 'src');
|
2012-06-10 21:20:04 +02:00
|
|
|
|
|
|
|
my $vsVersion = DetermineVisualStudioVersion();
|
|
|
|
|
|
|
|
$solution = CreateSolution($vsVersion, $config);
|
|
|
|
|
|
|
|
our @pgportfiles = qw(
|
|
|
|
chklocale.c crypt.c fls.c fseeko.c getrusage.c inet_aton.c random.c
|
|
|
|
srandom.c getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c
|
|
|
|
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c exec.c noblock.c path.c
|
2013-01-05 15:40:19 +01:00
|
|
|
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c qsort.c qsort_arg.c quotes.c
|
2013-01-01 18:29:48 +01:00
|
|
|
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c win32env.c
|
2012-06-10 21:20:04 +02:00
|
|
|
win32error.c win32setlocale.c);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
$libpgport = $solution->AddProject('libpgport', 'lib', 'misc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$libpgport->AddDefine('FRONTEND');
|
2012-07-05 03:47:49 +02:00
|
|
|
$libpgport->AddFiles('src\port', @pgportfiles);
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
$postgres = $solution->AddProject('postgres', 'exe', '', 'src\backend');
|
2012-06-10 21:20:04 +02:00
|
|
|
$postgres->AddIncludeDir('src\backend');
|
|
|
|
$postgres->AddDir('src\backend\port\win32');
|
|
|
|
$postgres->AddFile('src\backend\utils\fmgrtab.c');
|
2012-07-05 03:47:49 +02:00
|
|
|
$postgres->ReplaceFile(
|
|
|
|
'src\backend\port\dynloader.c',
|
|
|
|
'src\backend\port\dynloader\win32.c');
|
|
|
|
$postgres->ReplaceFile('src\backend\port\pg_sema.c',
|
|
|
|
'src\backend\port\win32_sema.c');
|
|
|
|
$postgres->ReplaceFile('src\backend\port\pg_shmem.c',
|
|
|
|
'src\backend\port\win32_shmem.c');
|
|
|
|
$postgres->ReplaceFile('src\backend\port\pg_latch.c',
|
|
|
|
'src\backend\port\win32_latch.c');
|
|
|
|
$postgres->AddFiles('src\port', @pgportfiles);
|
2012-06-10 21:20:04 +02:00
|
|
|
$postgres->AddDir('src\timezone');
|
2012-07-05 03:47:49 +02:00
|
|
|
$postgres->AddFiles('src\backend\parser', 'scan.l', 'gram.y');
|
|
|
|
$postgres->AddFiles('src\backend\bootstrap', 'bootscanner.l',
|
|
|
|
'bootparse.y');
|
|
|
|
$postgres->AddFiles('src\backend\utils\misc', 'guc-file.l');
|
|
|
|
$postgres->AddFiles('src\backend\replication', 'repl_scanner.l',
|
|
|
|
'repl_gram.y');
|
2012-06-10 21:20:04 +02:00
|
|
|
$postgres->AddDefine('BUILDING_DLL');
|
|
|
|
$postgres->AddLibrary('wsock32.lib');
|
|
|
|
$postgres->AddLibrary('ws2_32.lib');
|
|
|
|
$postgres->AddLibrary('secur32.lib');
|
|
|
|
$postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
|
|
|
|
$postgres->FullExportDLL('postgres.lib');
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $snowball = $solution->AddProject('dict_snowball', 'dll', '',
|
|
|
|
'src\backend\snowball');
|
2012-06-10 21:20:04 +02:00
|
|
|
$snowball->RelocateFiles(
|
|
|
|
'src\backend\snowball\libstemmer',
|
|
|
|
sub {
|
|
|
|
return shift !~ /dict_snowball.c$/;
|
2012-07-05 03:47:49 +02:00
|
|
|
});
|
2012-06-10 21:20:04 +02:00
|
|
|
$snowball->AddIncludeDir('src\include\snowball');
|
|
|
|
$snowball->AddReference($postgres);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $plpgsql =
|
|
|
|
$solution->AddProject('plpgsql', 'dll', 'PLs', 'src\pl\plpgsql\src');
|
2012-10-05 04:40:33 +02:00
|
|
|
$plpgsql->AddFiles('src\pl\plpgsql\src', 'pl_gram.y');
|
2012-06-10 21:20:04 +02:00
|
|
|
$plpgsql->AddReference($postgres);
|
|
|
|
|
|
|
|
if ($solution->{options}->{perl})
|
|
|
|
{
|
|
|
|
my $plperlsrc = "src\\pl\\plperl\\";
|
2012-07-05 03:47:49 +02:00
|
|
|
my $plperl =
|
|
|
|
$solution->AddProject('plperl', 'dll', 'PLs', 'src\pl\plperl');
|
2012-06-10 21:20:04 +02:00
|
|
|
$plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE');
|
|
|
|
$plperl->AddDefine('PLPERL_HAVE_UID_GID');
|
|
|
|
foreach my $xs ('SPI.xs', 'Util.xs')
|
|
|
|
{
|
|
|
|
(my $xsc = $xs) =~ s/\.xs/.c/;
|
2012-07-05 03:47:49 +02:00
|
|
|
if (Solution::IsNewer("$plperlsrc$xsc", "$plperlsrc$xs"))
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
my $xsubppdir = first { -e "$_\\ExtUtils\\xsubpp" } @INC;
|
|
|
|
print "Building $plperlsrc$xsc...\n";
|
2012-07-05 03:47:49 +02:00
|
|
|
system( $solution->{options}->{perl}
|
2012-06-10 21:20:04 +02:00
|
|
|
. '/bin/perl '
|
|
|
|
. "$xsubppdir/ExtUtils/xsubpp -typemap "
|
|
|
|
. $solution->{options}->{perl}
|
|
|
|
. '/lib/ExtUtils/typemap '
|
|
|
|
. "$plperlsrc$xs "
|
|
|
|
. ">$plperlsrc$xsc");
|
|
|
|
if ((!(-f "$plperlsrc$xsc")) || -z "$plperlsrc$xsc")
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
unlink("$plperlsrc$xsc"); # if zero size
|
2012-06-10 21:20:04 +02:00
|
|
|
die "Failed to create $xsc.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-05 03:47:49 +02:00
|
|
|
if (Solution::IsNewer(
|
|
|
|
'src\pl\plperl\perlchunks.h',
|
2012-06-10 21:20:04 +02:00
|
|
|
'src\pl\plperl\plc_perlboot.pl')
|
2012-07-05 03:47:49 +02:00
|
|
|
|| Solution::IsNewer(
|
|
|
|
'src\pl\plperl\perlchunks.h',
|
|
|
|
'src\pl\plperl\plc_trusted.pl'))
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
print 'Building src\pl\plperl\perlchunks.h ...' . "\n";
|
|
|
|
my $basedir = getcwd;
|
|
|
|
chdir 'src\pl\plperl';
|
2012-07-05 03:47:49 +02:00
|
|
|
system( $solution->{options}->{perl}
|
2012-06-10 21:20:04 +02:00
|
|
|
. '/bin/perl '
|
|
|
|
. 'text2macro.pl '
|
|
|
|
. '--strip="^(\#.*|\s*)$$" '
|
|
|
|
. 'plc_perlboot.pl plc_trusted.pl '
|
2012-07-05 03:47:49 +02:00
|
|
|
. '>perlchunks.h');
|
2012-06-10 21:20:04 +02:00
|
|
|
chdir $basedir;
|
2012-07-05 03:47:49 +02:00
|
|
|
if ((!(-f 'src\pl\plperl\perlchunks.h'))
|
|
|
|
|| -z 'src\pl\plperl\perlchunks.h')
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
unlink('src\pl\plperl\perlchunks.h'); # if zero size
|
2012-06-10 21:20:04 +02:00
|
|
|
die 'Failed to create perlchunks.h' . "\n";
|
|
|
|
}
|
|
|
|
}
|
2012-07-05 03:47:49 +02:00
|
|
|
if (Solution::IsNewer(
|
2012-06-10 21:20:04 +02:00
|
|
|
'src\pl\plperl\plperl_opmask.h',
|
2012-07-05 03:47:49 +02:00
|
|
|
'src\pl\plperl\plperl_opmask.pl'))
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
print 'Building src\pl\plperl\plperl_opmask.h ...' . "\n";
|
|
|
|
my $basedir = getcwd;
|
|
|
|
chdir 'src\pl\plperl';
|
2012-07-05 03:47:49 +02:00
|
|
|
system( $solution->{options}->{perl}
|
2012-06-10 21:20:04 +02:00
|
|
|
. '/bin/perl '
|
|
|
|
. 'plperl_opmask.pl '
|
2012-07-05 03:47:49 +02:00
|
|
|
. 'plperl_opmask.h');
|
2012-06-10 21:20:04 +02:00
|
|
|
chdir $basedir;
|
|
|
|
if ((!(-f 'src\pl\plperl\plperl_opmask.h'))
|
|
|
|
|| -z 'src\pl\plperl\plperl_opmask.h')
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
unlink('src\pl\plperl\plperl_opmask.h'); # if zero size
|
2012-06-10 21:20:04 +02:00
|
|
|
die 'Failed to create plperl_opmask.h' . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$plperl->AddReference($postgres);
|
|
|
|
my @perl_libs =
|
2012-07-05 03:47:49 +02:00
|
|
|
grep { /perl\d+.lib$/ }
|
|
|
|
glob($solution->{options}->{perl} . '\lib\CORE\perl*.lib');
|
2012-06-10 21:20:04 +02:00
|
|
|
if (@perl_libs == 1)
|
|
|
|
{
|
|
|
|
$plperl->AddLibrary($perl_libs[0]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
die "could not identify perl library version";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($solution->{options}->{python})
|
|
|
|
{
|
|
|
|
|
|
|
|
# Attempt to get python version and location.
|
|
|
|
# Assume python.exe in specified dir.
|
|
|
|
open(P,
|
|
|
|
$solution->{options}->{python}
|
|
|
|
. "\\python -c \"import sys;print(sys.prefix);print(str(sys.version_info[0])+str(sys.version_info[1]))\" |"
|
|
|
|
) || die "Could not query for python version!\n";
|
|
|
|
my $pyprefix = <P>;
|
|
|
|
chomp($pyprefix);
|
|
|
|
my $pyver = <P>;
|
|
|
|
chomp($pyver);
|
|
|
|
close(P);
|
|
|
|
|
|
|
|
# Sometimes (always?) if python is not present, the execution
|
|
|
|
# appears to work, but gives no data...
|
|
|
|
die "Failed to query python for version information\n"
|
|
|
|
if (!(defined($pyprefix) && defined($pyver)));
|
|
|
|
|
|
|
|
my $pymajorver = substr($pyver, 0, 1);
|
2012-07-05 03:47:49 +02:00
|
|
|
my $plpython = $solution->AddProject('plpython' . $pymajorver,
|
|
|
|
'dll', 'PLs', 'src\pl\plpython');
|
2012-06-10 21:20:04 +02:00
|
|
|
$plpython->AddIncludeDir($pyprefix . '\include');
|
|
|
|
$plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
|
|
|
|
$plpython->AddReference($postgres);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($solution->{options}->{tcl})
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pltcl =
|
|
|
|
$solution->AddProject('pltcl', 'dll', 'PLs', 'src\pl\tcl');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pltcl->AddIncludeDir($solution->{options}->{tcl} . '\include');
|
|
|
|
$pltcl->AddReference($postgres);
|
|
|
|
if (-e $solution->{options}->{tcl} . '\lib\tcl85.lib')
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
$pltcl->AddLibrary(
|
|
|
|
$solution->{options}->{tcl} . '\lib\tcl85.lib');
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
$pltcl->AddLibrary(
|
|
|
|
$solution->{options}->{tcl} . '\lib\tcl84.lib');
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
$libpq = $solution->AddProject('libpq', 'dll', 'interfaces',
|
|
|
|
'src\interfaces\libpq');
|
2012-06-10 21:20:04 +02:00
|
|
|
$libpq->AddDefine('FRONTEND');
|
|
|
|
$libpq->AddDefine('UNSAFE_STAT_OK');
|
|
|
|
$libpq->AddIncludeDir('src\port');
|
|
|
|
$libpq->AddLibrary('wsock32.lib');
|
|
|
|
$libpq->AddLibrary('secur32.lib');
|
|
|
|
$libpq->AddLibrary('ws2_32.lib');
|
|
|
|
$libpq->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
|
|
|
|
$libpq->UseDef('src\interfaces\libpq\libpqdll.def');
|
2012-07-05 03:47:49 +02:00
|
|
|
$libpq->ReplaceFile('src\interfaces\libpq\libpqrc.c',
|
|
|
|
'src\interfaces\libpq\libpq.rc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$libpq->AddReference($libpgport);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $libpqwalreceiver =
|
|
|
|
$solution->AddProject('libpqwalreceiver', 'dll', '',
|
2012-06-10 21:20:04 +02:00
|
|
|
'src\backend\replication\libpqwalreceiver');
|
|
|
|
$libpqwalreceiver->AddIncludeDir('src\interfaces\libpq');
|
2012-07-05 03:47:49 +02:00
|
|
|
$libpqwalreceiver->AddReference($postgres, $libpq);
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pgtypes = $solution->AddProject(
|
|
|
|
'libpgtypes', 'dll',
|
|
|
|
'interfaces', 'src\interfaces\ecpg\pgtypeslib');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgtypes->AddDefine('FRONTEND');
|
|
|
|
$pgtypes->AddReference($libpgport);
|
|
|
|
$pgtypes->UseDef('src\interfaces\ecpg\pgtypeslib\pgtypeslib.def');
|
|
|
|
$pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $libecpg = $solution->AddProject('libecpg', 'dll', 'interfaces',
|
|
|
|
'src\interfaces\ecpg\ecpglib');
|
2012-06-10 21:20:04 +02:00
|
|
|
$libecpg->AddDefine('FRONTEND');
|
|
|
|
$libecpg->AddIncludeDir('src\interfaces\ecpg\include');
|
|
|
|
$libecpg->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$libecpg->AddIncludeDir('src\port');
|
|
|
|
$libecpg->UseDef('src\interfaces\ecpg\ecpglib\ecpglib.def');
|
|
|
|
$libecpg->AddLibrary('wsock32.lib');
|
2012-07-05 03:47:49 +02:00
|
|
|
$libecpg->AddReference($libpq, $pgtypes, $libpgport);
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $libecpgcompat = $solution->AddProject(
|
|
|
|
'libecpg_compat', 'dll',
|
|
|
|
'interfaces', 'src\interfaces\ecpg\compatlib');
|
2012-06-10 21:20:04 +02:00
|
|
|
$libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
|
|
|
|
$libecpgcompat->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$libecpgcompat->UseDef('src\interfaces\ecpg\compatlib\compatlib.def');
|
2012-07-05 03:47:49 +02:00
|
|
|
$libecpgcompat->AddReference($pgtypes, $libecpg, $libpgport);
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $ecpg = $solution->AddProject('ecpg', 'exe', 'interfaces',
|
|
|
|
'src\interfaces\ecpg\preproc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$ecpg->AddIncludeDir('src\interfaces\ecpg\include');
|
|
|
|
$ecpg->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$ecpg->AddPrefixInclude('src\interfaces\ecpg\preproc');
|
2012-07-05 03:47:49 +02:00
|
|
|
$ecpg->AddFiles('src\interfaces\ecpg\preproc', 'pgc.l', 'preproc.y');
|
2012-06-10 21:20:04 +02:00
|
|
|
$ecpg->AddDefine('MAJOR_VERSION=4');
|
2012-06-14 04:06:26 +02:00
|
|
|
$ecpg->AddDefine('MINOR_VERSION=9');
|
|
|
|
$ecpg->AddDefine('PATCHLEVEL=0');
|
2012-06-10 21:20:04 +02:00
|
|
|
$ecpg->AddDefine('ECPG_COMPILE');
|
|
|
|
$ecpg->AddReference($libpgport);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pgregress_ecpg =
|
|
|
|
$solution->AddProject('pg_regress_ecpg', 'exe', 'misc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgregress_ecpg->AddFile('src\interfaces\ecpg\test\pg_regress_ecpg.c');
|
|
|
|
$pgregress_ecpg->AddFile('src\test\regress\pg_regress.c');
|
|
|
|
$pgregress_ecpg->AddIncludeDir('src\port');
|
|
|
|
$pgregress_ecpg->AddIncludeDir('src\test\regress');
|
|
|
|
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
|
|
|
|
$pgregress_ecpg->AddDefine('FRONTEND');
|
|
|
|
$pgregress_ecpg->AddReference($libpgport);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $isolation_tester =
|
|
|
|
$solution->AddProject('isolationtester', 'exe', 'misc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$isolation_tester->AddFile('src\test\isolation\isolationtester.c');
|
|
|
|
$isolation_tester->AddFile('src\test\isolation\specparse.y');
|
|
|
|
$isolation_tester->AddFile('src\test\isolation\specscanner.l');
|
|
|
|
$isolation_tester->AddFile('src\test\isolation\specparse.c');
|
|
|
|
$isolation_tester->AddIncludeDir('src\test\isolation');
|
|
|
|
$isolation_tester->AddIncludeDir('src\port');
|
|
|
|
$isolation_tester->AddIncludeDir('src\test\regress');
|
|
|
|
$isolation_tester->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$isolation_tester->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
|
|
|
|
$isolation_tester->AddDefine('FRONTEND');
|
|
|
|
$isolation_tester->AddLibrary('wsock32.lib');
|
|
|
|
$isolation_tester->AddReference($libpq, $libpgport);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pgregress_isolation =
|
|
|
|
$solution->AddProject('pg_isolation_regress', 'exe', 'misc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgregress_isolation->AddFile('src\test\isolation\isolation_main.c');
|
|
|
|
$pgregress_isolation->AddFile('src\test\regress\pg_regress.c');
|
|
|
|
$pgregress_isolation->AddIncludeDir('src\port');
|
|
|
|
$pgregress_isolation->AddIncludeDir('src\test\regress');
|
|
|
|
$pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
|
|
|
|
$pgregress_isolation->AddDefine('FRONTEND');
|
|
|
|
$pgregress_isolation->AddReference($libpgport);
|
|
|
|
|
|
|
|
# src/bin
|
|
|
|
my $initdb = AddSimpleFrontend('initdb');
|
|
|
|
$initdb->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$initdb->AddIncludeDir('src\timezone');
|
|
|
|
$initdb->AddDefine('FRONTEND');
|
|
|
|
$initdb->AddLibrary('wsock32.lib');
|
|
|
|
$initdb->AddLibrary('ws2_32.lib');
|
|
|
|
|
|
|
|
my $pgbasebackup = AddSimpleFrontend('pg_basebackup', 1);
|
|
|
|
$pgbasebackup->AddFile('src\bin\pg_basebackup\pg_basebackup.c');
|
|
|
|
$pgbasebackup->AddLibrary('ws2_32.lib');
|
|
|
|
|
|
|
|
my $pgreceivexlog = AddSimpleFrontend('pg_basebackup', 1);
|
|
|
|
$pgreceivexlog->{name} = 'pg_receivexlog';
|
|
|
|
$pgreceivexlog->AddFile('src\bin\pg_basebackup\pg_receivexlog.c');
|
|
|
|
$pgreceivexlog->AddLibrary('ws2_32.lib');
|
|
|
|
|
|
|
|
my $pgconfig = AddSimpleFrontend('pg_config');
|
|
|
|
|
|
|
|
my $pgcontrol = AddSimpleFrontend('pg_controldata');
|
|
|
|
|
|
|
|
my $pgctl = AddSimpleFrontend('pg_ctl', 1);
|
|
|
|
|
|
|
|
my $pgreset = AddSimpleFrontend('pg_resetxlog');
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pgevent = $solution->AddProject('pgevent', 'dll', 'bin');
|
|
|
|
$pgevent->AddFiles('src\bin\pgevent', 'pgevent.c', 'pgmsgevent.rc');
|
|
|
|
$pgevent->AddResourceFile('src\bin\pgevent',
|
|
|
|
'Eventlog message formatter');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgevent->RemoveFile('src\bin\pgevent\win32ver.rc');
|
|
|
|
$pgevent->UseDef('src\bin\pgevent\pgevent.def');
|
|
|
|
$pgevent->DisableLinkerWarnings('4104');
|
|
|
|
|
|
|
|
my $psql = AddSimpleFrontend('psql', 1);
|
|
|
|
$psql->AddIncludeDir('src\bin\pg_dump');
|
|
|
|
$psql->AddIncludeDir('src\backend');
|
|
|
|
$psql->AddFile('src\bin\psql\psqlscan.l');
|
|
|
|
|
|
|
|
my $pgdump = AddSimpleFrontend('pg_dump', 1);
|
|
|
|
$pgdump->AddIncludeDir('src\backend');
|
|
|
|
$pgdump->AddFile('src\bin\pg_dump\pg_dump.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\keywords.c');
|
|
|
|
$pgdump->AddFile('src\backend\parser\kwlookup.c');
|
|
|
|
|
|
|
|
my $pgdumpall = AddSimpleFrontend('pg_dump', 1);
|
|
|
|
|
|
|
|
# pg_dumpall doesn't use the files in the Makefile's $(OBJS), unlike
|
|
|
|
# pg_dump and pg_restore.
|
|
|
|
# So remove their sources from the object, keeping the other setup that
|
|
|
|
# AddSimpleFrontend() has done.
|
2012-07-05 03:47:49 +02:00
|
|
|
my @nodumpall = grep { m/src\\bin\\pg_dump\\.*\.c$/ }
|
|
|
|
keys %{ $pgdumpall->{files} };
|
|
|
|
delete @{ $pgdumpall->{files} }{@nodumpall};
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgdumpall->{name} = 'pg_dumpall';
|
|
|
|
$pgdumpall->AddIncludeDir('src\backend');
|
|
|
|
$pgdumpall->AddFile('src\bin\pg_dump\pg_dumpall.c');
|
|
|
|
$pgdumpall->AddFile('src\bin\pg_dump\dumputils.c');
|
|
|
|
$pgdumpall->AddFile('src\bin\pg_dump\dumpmem.c');
|
|
|
|
$pgdumpall->AddFile('src\bin\pg_dump\keywords.c');
|
|
|
|
$pgdumpall->AddFile('src\backend\parser\kwlookup.c');
|
|
|
|
|
|
|
|
my $pgrestore = AddSimpleFrontend('pg_dump', 1);
|
|
|
|
$pgrestore->{name} = 'pg_restore';
|
|
|
|
$pgrestore->AddIncludeDir('src\backend');
|
|
|
|
$pgrestore->AddFile('src\bin\pg_dump\pg_restore.c');
|
|
|
|
$pgrestore->AddFile('src\bin\pg_dump\keywords.c');
|
|
|
|
$pgrestore->AddFile('src\backend\parser\kwlookup.c');
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $zic = $solution->AddProject('zic', 'exe', 'utils');
|
|
|
|
$zic->AddFiles('src\timezone', 'zic.c', 'ialloc.c', 'scheck.c',
|
|
|
|
'localtime.c');
|
2012-06-10 21:20:04 +02:00
|
|
|
$zic->AddReference($libpgport);
|
|
|
|
|
|
|
|
if ($solution->{options}->{xml})
|
|
|
|
{
|
|
|
|
$contrib_extraincludes->{'pgxml'} = [
|
|
|
|
$solution->{options}->{xml} . '\include',
|
|
|
|
$solution->{options}->{xslt} . '\include',
|
2012-07-05 03:47:49 +02:00
|
|
|
$solution->{options}->{iconv} . '\include' ];
|
2012-06-10 21:20:04 +02:00
|
|
|
|
|
|
|
$contrib_extralibs->{'pgxml'} = [
|
|
|
|
$solution->{options}->{xml} . '\lib\libxml2.lib',
|
2012-07-05 03:47:49 +02:00
|
|
|
$solution->{options}->{xslt} . '\lib\libxslt.lib' ];
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
push @contrib_excludes, 'xml2';
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$solution->{options}->{openssl})
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
push @contrib_excludes, 'sslinfo';
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($solution->{options}->{uuid})
|
|
|
|
{
|
|
|
|
$contrib_extraincludes->{'uuid-ossp'} =
|
|
|
|
[ $solution->{options}->{uuid} . '\include' ];
|
|
|
|
$contrib_extralibs->{'uuid-ossp'} =
|
|
|
|
[ $solution->{options}->{uuid} . '\lib\uuid.lib' ];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
push @contrib_excludes, 'uuid-ossp';
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Pgcrypto makefile too complex to parse....
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pgcrypto = $solution->AddProject('pgcrypto', 'dll', 'crypto');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgcrypto->AddFiles(
|
2012-07-05 03:47:49 +02:00
|
|
|
'contrib\pgcrypto', 'pgcrypto.c',
|
|
|
|
'px.c', 'px-hmac.c',
|
|
|
|
'px-crypt.c', 'crypt-gensalt.c',
|
|
|
|
'crypt-blowfish.c', 'crypt-des.c',
|
|
|
|
'crypt-md5.c', 'mbuf.c',
|
|
|
|
'pgp.c', 'pgp-armor.c',
|
|
|
|
'pgp-cfb.c', 'pgp-compress.c',
|
|
|
|
'pgp-decrypt.c', 'pgp-encrypt.c',
|
|
|
|
'pgp-info.c', 'pgp-mpi.c',
|
|
|
|
'pgp-pubdec.c', 'pgp-pubenc.c',
|
|
|
|
'pgp-pubkey.c', 'pgp-s2k.c',
|
|
|
|
'pgp-pgsql.c');
|
2012-06-10 21:20:04 +02:00
|
|
|
if ($solution->{options}->{openssl})
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
$pgcrypto->AddFiles('contrib\pgcrypto', 'openssl.c',
|
|
|
|
'pgp-mpi-openssl.c');
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$pgcrypto->AddFiles(
|
2012-07-05 03:47:49 +02:00
|
|
|
'contrib\pgcrypto', 'md5.c',
|
|
|
|
'sha1.c', 'sha2.c',
|
|
|
|
'internal.c', 'internal-sha2.c',
|
|
|
|
'blf.c', 'rijndael.c',
|
|
|
|
'fortuna.c', 'random.c',
|
|
|
|
'pgp-mpi-internal.c', 'imath.c');
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
$pgcrypto->AddReference($postgres);
|
|
|
|
$pgcrypto->AddLibrary('wsock32.lib');
|
|
|
|
my $mf = Project::read_file('contrib/pgcrypto/Makefile');
|
|
|
|
GenerateContribSqlFiles('pgcrypto', $mf);
|
|
|
|
|
|
|
|
my $D;
|
|
|
|
opendir($D, 'contrib') || croak "Could not opendir on contrib!\n";
|
|
|
|
while (my $d = readdir($D))
|
|
|
|
{
|
|
|
|
next if ($d =~ /^\./);
|
|
|
|
next unless (-f "contrib/$d/Makefile");
|
2012-07-05 03:47:49 +02:00
|
|
|
next if (grep { /^$d$/ } @contrib_excludes);
|
2012-06-10 21:20:04 +02:00
|
|
|
AddContrib($d);
|
|
|
|
}
|
|
|
|
closedir($D);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
$mf =
|
|
|
|
Project::read_file('src\backend\utils\mb\conversion_procs\Makefile');
|
2012-06-10 21:20:04 +02:00
|
|
|
$mf =~ s{\\s*[\r\n]+}{}mg;
|
2012-07-05 03:47:49 +02:00
|
|
|
$mf =~ m{SUBDIRS\s*=\s*(.*)$}m
|
|
|
|
|| die 'Could not match in conversion makefile' . "\n";
|
|
|
|
foreach my $sub (split /\s+/, $1)
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
my $mf = Project::read_file(
|
|
|
|
'src\backend\utils\mb\conversion_procs\\' . $sub . '\Makefile');
|
|
|
|
my $p = $solution->AddProject($sub, 'dll', 'conversion procs');
|
2012-07-05 03:47:49 +02:00
|
|
|
$p->AddFile('src\backend\utils\mb\conversion_procs\\'
|
|
|
|
. $sub . '\\'
|
|
|
|
. $sub
|
|
|
|
. '.c');
|
2012-06-10 21:20:04 +02:00
|
|
|
if ($mf =~ m{^SRCS\s*\+=\s*(.*)$}m)
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
$p->AddFile(
|
|
|
|
'src\backend\utils\mb\conversion_procs\\' . $sub . '\\' . $1);
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
$p->AddReference($postgres);
|
|
|
|
}
|
|
|
|
|
|
|
|
$mf = Project::read_file('src\bin\scripts\Makefile');
|
|
|
|
$mf =~ s{\\s*[\r\n]+}{}mg;
|
2012-07-05 03:47:49 +02:00
|
|
|
$mf =~ m{PROGRAMS\s*=\s*(.*)$}m
|
|
|
|
|| die 'Could not match in bin\scripts\Makefile' . "\n";
|
|
|
|
foreach my $prg (split /\s+/, $1)
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $proj = $solution->AddProject($prg, 'exe', 'bin');
|
|
|
|
$mf =~ m{$prg\s*:\s*(.*)$}m
|
|
|
|
|| die 'Could not find script define for $prg' . "\n";
|
|
|
|
my @files = split /\s+/, $1;
|
2012-06-10 21:20:04 +02:00
|
|
|
foreach my $f (@files)
|
|
|
|
{
|
|
|
|
$f =~ s/\.o$/\.c/;
|
|
|
|
if ($f eq 'keywords.c')
|
|
|
|
{
|
|
|
|
$proj->AddFile('src\bin\pg_dump\keywords.c');
|
|
|
|
}
|
|
|
|
elsif ($f eq 'kwlookup.c')
|
|
|
|
{
|
|
|
|
$proj->AddFile('src\backend\parser\kwlookup.c');
|
|
|
|
}
|
|
|
|
elsif ($f eq 'dumputils.c')
|
|
|
|
{
|
|
|
|
$proj->AddFile('src\bin\pg_dump\dumputils.c');
|
|
|
|
}
|
|
|
|
elsif ($f =~ /print\.c$/)
|
2012-07-05 03:47:49 +02:00
|
|
|
{ # Also catches mbprint.c
|
2012-06-10 21:20:04 +02:00
|
|
|
$proj->AddFile('src\bin\psql\\' . $f);
|
|
|
|
}
|
|
|
|
elsif ($f =~ /\.c$/)
|
|
|
|
{
|
|
|
|
$proj->AddFile('src\bin\scripts\\' . $f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$proj->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$proj->AddIncludeDir('src\bin\pg_dump');
|
|
|
|
$proj->AddIncludeDir('src\bin\psql');
|
2012-07-05 03:47:49 +02:00
|
|
|
$proj->AddReference($libpq, $libpgport);
|
|
|
|
$proj->AddResourceFile('src\bin\scripts', 'PostgreSQL Utility');
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Regression DLL and EXE
|
2012-07-05 03:47:49 +02:00
|
|
|
my $regress = $solution->AddProject('regress', 'dll', 'misc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$regress->AddFile('src\test\regress\regress.c');
|
|
|
|
$regress->AddReference($postgres);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $pgregress = $solution->AddProject('pg_regress', 'exe', 'misc');
|
2012-06-10 21:20:04 +02:00
|
|
|
$pgregress->AddFile('src\test\regress\pg_regress.c');
|
|
|
|
$pgregress->AddFile('src\test\regress\pg_regress_main.c');
|
|
|
|
$pgregress->AddIncludeDir('src\port');
|
|
|
|
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
|
|
|
|
$pgregress->AddReference($libpgport);
|
|
|
|
|
|
|
|
$solution->Save();
|
|
|
|
return $solution->{vcver};
|
2007-03-17 14:50:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#####################
|
|
|
|
# Utility functions #
|
|
|
|
#####################
|
|
|
|
|
|
|
|
# Add a simple frontend project (exe)
|
|
|
|
sub AddSimpleFrontend
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $n = shift;
|
|
|
|
my $uselibpq = shift;
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
my $p = $solution->AddProject($n, 'exe', 'bin');
|
2012-06-10 21:20:04 +02:00
|
|
|
$p->AddDir('src\bin\\' . $n);
|
|
|
|
$p->AddReference($libpgport);
|
|
|
|
if ($uselibpq)
|
|
|
|
{
|
|
|
|
$p->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$p->AddReference($libpq);
|
|
|
|
}
|
|
|
|
return $p;
|
2007-03-17 14:50:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Add a simple contrib project
|
|
|
|
sub AddContrib
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $n = shift;
|
2012-06-10 21:20:04 +02:00
|
|
|
my $mf = Project::read_file('contrib\\' . $n . '\Makefile');
|
|
|
|
|
|
|
|
if ($mf =~ /^MODULE_big\s*=\s*(.*)$/mg)
|
|
|
|
{
|
|
|
|
my $dn = $1;
|
|
|
|
$mf =~ s{\\\s*[\r\n]+}{}mg;
|
|
|
|
my $proj = $solution->AddProject($dn, 'dll', 'contrib');
|
|
|
|
$mf =~ /^OBJS\s*=\s*(.*)$/gm
|
|
|
|
|| croak "Could not find objects in MODULE_big for $n\n";
|
|
|
|
my $objs = $1;
|
|
|
|
while ($objs =~ /\b([\w-]+\.o)\b/g)
|
|
|
|
{
|
|
|
|
my $o = $1;
|
|
|
|
$o =~ s/\.o$/.c/;
|
|
|
|
$proj->AddFile('contrib\\' . $n . '\\' . $o);
|
|
|
|
}
|
|
|
|
$proj->AddReference($postgres);
|
|
|
|
if ($mf =~ /^SUBDIRS\s*:?=\s*(.*)$/mg)
|
|
|
|
{
|
|
|
|
foreach my $d (split /\s+/, $1)
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $mf2 = Project::read_file(
|
|
|
|
'contrib\\' . $n . '\\' . $d . '\Makefile');
|
2012-06-10 21:20:04 +02:00
|
|
|
$mf2 =~ s{\\\s*[\r\n]+}{}mg;
|
|
|
|
$mf2 =~ /^SUBOBJS\s*=\s*(.*)$/gm
|
|
|
|
|| croak
|
|
|
|
"Could not find objects in MODULE_big for $n, subdir $d\n";
|
|
|
|
$objs = $1;
|
|
|
|
while ($objs =~ /\b([\w-]+\.o)\b/g)
|
|
|
|
{
|
|
|
|
my $o = $1;
|
|
|
|
$o =~ s/\.o$/.c/;
|
|
|
|
$proj->AddFile('contrib\\' . $n . '\\' . $d . '\\' . $o);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AdjustContribProj($proj);
|
|
|
|
}
|
|
|
|
elsif ($mf =~ /^MODULES\s*=\s*(.*)$/mg)
|
|
|
|
{
|
|
|
|
foreach my $mod (split /\s+/, $1)
|
|
|
|
{
|
|
|
|
my $proj = $solution->AddProject($mod, 'dll', 'contrib');
|
|
|
|
$proj->AddFile('contrib\\' . $n . '\\' . $mod . '.c');
|
|
|
|
$proj->AddReference($postgres);
|
|
|
|
AdjustContribProj($proj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($mf =~ /^PROGRAM\s*=\s*(.*)$/mg)
|
|
|
|
{
|
|
|
|
my $proj = $solution->AddProject($1, 'exe', 'contrib');
|
|
|
|
$mf =~ s{\\\s*[\r\n]+}{}mg;
|
2012-07-05 03:47:49 +02:00
|
|
|
$mf =~ /^OBJS\s*=\s*(.*)$/gm
|
|
|
|
|| croak "Could not find objects in PROGRAM for $n\n";
|
2012-06-10 21:20:04 +02:00
|
|
|
my $objs = $1;
|
|
|
|
while ($objs =~ /\b([\w-]+\.o)\b/g)
|
|
|
|
{
|
|
|
|
my $o = $1;
|
|
|
|
$o =~ s/\.o$/.c/;
|
|
|
|
$proj->AddFile('contrib\\' . $n . '\\' . $o);
|
|
|
|
}
|
|
|
|
AdjustContribProj($proj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
croak "Could not determine contrib module type for $n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Are there any output data files to build?
|
|
|
|
GenerateContribSqlFiles($n, $mf);
|
2007-03-23 10:53:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub GenerateContribSqlFiles
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $n = shift;
|
2012-06-10 21:20:04 +02:00
|
|
|
my $mf = shift;
|
|
|
|
if ($mf =~ /^DATA_built\s*=\s*(.*)$/mg)
|
|
|
|
{
|
|
|
|
my $l = $1;
|
|
|
|
|
|
|
|
# Strip out $(addsuffix) rules
|
|
|
|
if (index($l, '$(addsuffix ') >= 0)
|
|
|
|
{
|
|
|
|
my $pcount = 0;
|
|
|
|
my $i;
|
|
|
|
for ($i = index($l, '$(addsuffix ') + 12; $i < length($l); $i++)
|
|
|
|
{
|
|
|
|
$pcount++ if (substr($l, $i, 1) eq '(');
|
|
|
|
$pcount-- if (substr($l, $i, 1) eq ')');
|
2012-07-05 03:47:49 +02:00
|
|
|
last if ($pcount < 0);
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
2012-07-05 03:47:49 +02:00
|
|
|
$l =
|
|
|
|
substr($l, 0, index($l, '$(addsuffix ')) . substr($l, $i + 1);
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach my $d (split /\s+/, $l)
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
my $in = "$d.in";
|
2012-06-10 21:20:04 +02:00
|
|
|
my $out = "$d";
|
|
|
|
|
|
|
|
if (Solution::IsNewer("contrib/$n/$out", "contrib/$n/$in"))
|
|
|
|
{
|
|
|
|
print "Building $out from $in (contrib/$n)...\n";
|
|
|
|
my $cont = Project::read_file("contrib/$n/$in");
|
2012-07-05 03:47:49 +02:00
|
|
|
my $dn = $out;
|
|
|
|
$dn =~ s/\.sql$//;
|
2012-06-10 21:20:04 +02:00
|
|
|
$cont =~ s/MODULE_PATHNAME/\$libdir\/$dn/g;
|
|
|
|
my $o;
|
2012-07-05 03:47:49 +02:00
|
|
|
open($o, ">contrib/$n/$out")
|
2012-06-10 21:20:04 +02:00
|
|
|
|| croak "Could not write to contrib/$n/$d";
|
|
|
|
print $o $cont;
|
|
|
|
close($o);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-17 14:50:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub AdjustContribProj
|
|
|
|
{
|
2012-06-10 21:20:04 +02:00
|
|
|
my $proj = shift;
|
2012-07-05 03:47:49 +02:00
|
|
|
my $n = $proj->{name};
|
2012-06-10 21:20:04 +02:00
|
|
|
|
|
|
|
if ($contrib_defines->{$n})
|
|
|
|
{
|
|
|
|
foreach my $d ($contrib_defines->{$n})
|
|
|
|
{
|
|
|
|
$proj->AddDefine($d);
|
|
|
|
}
|
|
|
|
}
|
2012-07-05 03:47:49 +02:00
|
|
|
if (grep { /^$n$/ } @contrib_uselibpq)
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
$proj->AddIncludeDir('src\interfaces\libpq');
|
|
|
|
$proj->AddReference($libpq);
|
|
|
|
}
|
2012-07-05 03:47:49 +02:00
|
|
|
if (grep { /^$n$/ } @contrib_uselibpgport)
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
$proj->AddReference($libpgport);
|
|
|
|
}
|
|
|
|
if ($contrib_extralibs->{$n})
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
foreach my $l (@{ $contrib_extralibs->{$n} })
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
$proj->AddLibrary($l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($contrib_extraincludes->{$n})
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
foreach my $i (@{ $contrib_extraincludes->{$n} })
|
2012-06-10 21:20:04 +02:00
|
|
|
{
|
|
|
|
$proj->AddIncludeDir($i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($contrib_extrasource->{$n})
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
$proj->AddFiles('contrib\\' . $n, @{ $contrib_extrasource->{$n} });
|
2012-06-10 21:20:04 +02:00
|
|
|
}
|
2007-03-17 14:50:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|