Further MSVC build updates
Started by Magnus Haganderabout 19 years ago2 messages
I just set up to build with MSVC on a brand new box, and came across a
couple of more fixes:
* New versions of OpenSSL come with proper debug versions, and uses
suffixed names on the LIBs for that. Adapts library handling to deal
with that.
* Fixes error where it incorrectly enabled Kerberos based on NLS
configuration instead of Kerberos configuration
* Specifies path of perl in config, instead of using current one.
Required when using a 64-bit perl normally, but want to build pl/perl
against 32-bit one (required)
* Fix so pgevent generates win32ver.rc automatically
//Magnus
Attachments:
msvc.diffapplication/octet-stream; name=msvc.diffDownload
? src/tools/msvc/config.pl.save
Index: src/tools/msvc/Project.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Project.pm,v
retrieving revision 1.3
diff -c -r1.3 Project.pm
*** src/tools/msvc/Project.pm 22 Oct 2006 17:17:08 -0000 1.3
--- src/tools/msvc/Project.pm 24 Oct 2006 12:04:44 -0000
***************
*** 18,24 ****
guid => Win32::GuidGen(),
files => {},
references => [],
! libraries => '',
includes => '',
defines => ';',
solution => $solution,
--- 18,25 ----
guid => Win32::GuidGen(),
files => {},
references => [],
! libraries => [],
! suffixlib => [],
includes => '',
defines => ';',
solution => $solution,
***************
*** 86,97 ****
}
sub AddLibrary {
! my ($self, $lib) = @_;
! if ($self->{libraries} ne '') {
! $self->{libraries} .= ' ';
}
- $self->{libraries} .= $lib;
}
sub AddIncludeDir {
--- 87,98 ----
}
sub AddLibrary {
! my ($self, $lib, $dbgsuffix) = @_;
! push @{$self->{libraries}}, $lib;
! if ($dbgsuffix) {
! push @{$self->{suffixlib}}, $lib;
}
}
sub AddIncludeDir {
***************
*** 351,357 ****
{
my ($self, $f, $cfgname, $p) = @_;
my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4);
! my $libs = $self->{libraries};
$libs =~ s/__CFGNAME__/$cfgname/g;
print $f <<EOF;
<Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
--- 352,370 ----
{
my ($self, $f, $cfgname, $p) = @_;
my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4);
! my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd";
! my $libs = '';
! foreach my $lib (@{$self->{libraries}}) {
! my $xlib = $lib;
! foreach my $slib (@{$self->{suffixlib}}) {
! if ($slib eq $lib) {
! $xlib =~ s/\.lib$/$libcfg.lib/;
! last;
! }
! }
! $libs .= $xlib . " ";
! }
! $libs =~ s/ $//;
$libs =~ s/__CFGNAME__/$cfgname/g;
print $f <<EOF;
<Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
Index: src/tools/msvc/Solution.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Solution.pm,v
retrieving revision 1.2
diff -c -r1.2 Solution.pm
*** src/tools/msvc/Solution.pm 15 Sep 2006 21:42:02 -0000 1.2
--- src/tools/msvc/Solution.pm 24 Oct 2006 13:21:10 -0000
***************
*** 83,89 ****
print O "#define USE_SSL 1\n" if ($self->{options}->{openssl});
print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
print O "#define LOCALEDIR \"/usr/local/pgsql/share/locale\"\n" if ($self->{options}->{nls});
! if ($self->{options}->{nls}) {
print O "#define KRB5 1\n";
print O "#define HAVE_KRB5_ERROR_TEXT_DATA 1\n";
print O "#define HAVE_KRB5_TICKET_ENC_PART2 1\n";
--- 83,89 ----
print O "#define USE_SSL 1\n" if ($self->{options}->{openssl});
print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
print O "#define LOCALEDIR \"/usr/local/pgsql/share/locale\"\n" if ($self->{options}->{nls});
! if ($self->{options}->{krb5}) {
print O "#define KRB5 1\n";
print O "#define HAVE_KRB5_ERROR_TEXT_DATA 1\n";
print O "#define HAVE_KRB5_TICKET_ENC_PART2 1\n";
***************
*** 220,227 ****
}
if ($self->{options}->{openssl}) {
$proj->AddIncludeDir($self->{options}->{openssl} . '\include');
! $proj->AddLibrary($self->{options}->{openssl} . '\lib\VC\ssleay32.lib');
! $proj->AddLibrary($self->{options}->{openssl} . '\lib\VC\libeay32.lib');
}
if ($self->{options}->{nls}) {
$proj->AddIncludeDir($self->{options}->{nls} . '\include');
--- 220,227 ----
}
if ($self->{options}->{openssl}) {
$proj->AddIncludeDir($self->{options}->{openssl} . '\include');
! $proj->AddLibrary($self->{options}->{openssl} . '\lib\VC\ssleay32.lib', 1);
! $proj->AddLibrary($self->{options}->{openssl} . '\lib\VC\libeay32.lib', 1);
}
if ($self->{options}->{nls}) {
$proj->AddIncludeDir($self->{options}->{nls} . '\include');
Index: src/tools/msvc/config.pl
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/config.pl,v
retrieving revision 1.2
diff -c -r1.2 config.pl
*** src/tools/msvc/config.pl 22 Oct 2006 17:17:08 -0000 1.2
--- src/tools/msvc/config.pl 24 Oct 2006 15:03:58 -0000
***************
*** 6,12 ****
asserts=>1, # --enable-cassert
nls=>undef, # --enable-nls=<path>
tcl=>'c:\tcl', # --with-tls=<path>
! perl=>1, # --with-perl
python=>'c:\python24', # --with-python=<path>
krb5=>'c:\prog\pgsql\depend\krb5', # --with-krb5=<path>
ldap=>1, # --with-ldap
--- 6,12 ----
asserts=>1, # --enable-cassert
nls=>undef, # --enable-nls=<path>
tcl=>'c:\tcl', # --with-tls=<path>
! perl=>'c:\perl', # --with-perl
python=>'c:\python24', # --with-python=<path>
krb5=>'c:\prog\pgsql\depend\krb5', # --with-krb5=<path>
ldap=>1, # --with-ldap
Index: src/tools/msvc/mkvcbuild.pl
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/mkvcbuild.pl,v
retrieving revision 1.6
diff -c -r1.6 mkvcbuild.pl
*** src/tools/msvc/mkvcbuild.pl 22 Oct 2006 17:17:08 -0000 1.6
--- src/tools/msvc/mkvcbuild.pl 24 Oct 2006 13:19:35 -0000
***************
*** 47,70 ****
$plpgsql->AddReference($postgres);
if ($solution->{options}->{perl}) {
- # Already running in perl, so use the version that we already have information for.
- use Config;
my $plperl = $solution->AddProject('plperl','dll','PLs','src\pl\plperl');
! $plperl->AddIncludeDir($Config{archlibexp} . '\CORE');
$plperl->AddDefine('PLPERL_HAVE_UID_GID');
if (Solution::IsNewer('src\pl\plperl\SPI.c','src\pl\plperl\SPI.xs')) {
print 'Building src\pl\plperl\SPI.c...' . "\n";
! system('perl ' . $Config{privlibexp} . '/ExtUtils/xsubpp -typemap ' . $Config{privlibexp} . '/ExtUtils/typemap src\pl\plperl\SPI.xs >src\pl\plperl\SPI.c');
die 'Failed to create SPI.c' . "\n" if ((!(-f 'src\pl\plperl\SPI.c')) || -z 'src\pl\plperl\SPI.c');
}
$plperl->AddReference($postgres);
! $plperl->AddLibrary($Config{archlibexp} . '\CORE\perl58.lib');
}
if ($solution->{options}->{python}) {
my $plpython = $solution->AddProject('plpython','dll','PLs','src\pl\plpython');
$plpython->AddIncludeDir($solution->{options}->{python} . '\include');
! $plpython->AddLibrary($solution->{options}->{python} . '\Libs\python24.lib');
$plpython->AddReference($postgres);
}
--- 47,69 ----
$plpgsql->AddReference($postgres);
if ($solution->{options}->{perl}) {
my $plperl = $solution->AddProject('plperl','dll','PLs','src\pl\plperl');
! $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE');
$plperl->AddDefine('PLPERL_HAVE_UID_GID');
if (Solution::IsNewer('src\pl\plperl\SPI.c','src\pl\plperl\SPI.xs')) {
print 'Building src\pl\plperl\SPI.c...' . "\n";
! system($solution->{options}->{perl} . '/bin/perl ' . $solution->{options}->{perl} . '/lib/COREExtUtils/xsubpp -typemap ' . $solution->{options}->{perl} . '/lib/CORE/ExtUtils/typemap src\pl\plperl\SPI.xs >src\pl\plperl\SPI.c');
die 'Failed to create SPI.c' . "\n" if ((!(-f 'src\pl\plperl\SPI.c')) || -z 'src\pl\plperl\SPI.c');
}
$plperl->AddReference($postgres);
! $plperl->AddLibrary($solution->{options}->{perl} . '\lib\CORE\perl58.lib');
}
if ($solution->{options}->{python}) {
my $plpython = $solution->AddProject('plpython','dll','PLs','src\pl\plpython');
$plpython->AddIncludeDir($solution->{options}->{python} . '\include');
! $solution->{options}->{python} =~ /\\Python(\d{2})/i || croak "Could not determine python version from path";
! $plpython->AddLibrary($solution->{options}->{python} . "\\Libs\\python$1.lib");
$plpython->AddReference($postgres);
}
***************
*** 125,130 ****
--- 124,131 ----
my $pgevent = $solution->AddProject('pgevent','dll','bin');
$pgevent->AddFiles('src\bin\pgevent','pgevent.c','pgmsgevent.rc');
+ $pgevent->AddResourceFile('src\bin\pgevent','Eventlog message formatter');
+ $pgevent->RemoveFile('src\bin\pgevent\win32ver.rc');
$pgevent->UseDef('src\bin\pgevent\pgevent.def');
my $psql = AddSimpleFrontend('psql', 1);