Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2c0b14

Browse files
committed
Various MSVC build fixes from Magnus; also remove stray Windows
newlines.
1 parentfa5d08f commitc2c0b14

File tree

6 files changed

+296
-139
lines changed

6 files changed

+296
-139
lines changed

‎src/tools/msvc/Project.pm

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ EOF
286286
my$of =$f;
287287
$of =~s/\.y$/.c/;
288288
$of =~s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
289-
print F'>' . GenerateCustomTool('Running bison on' .$f,'src\tools\msvc\pgbison.bat' .$f,$of) .'</File>' ."\n";
289+
print F'>' . GenerateCustomTool('Running bison on' .$f,'cmd /V:ON /csrc\tools\msvc\pgbison.bat' .$f,$of) .'</File>' ."\n";
290290
}
291291
elsif ($f =~/\.l$/) {
292292
my$of =$f;
@@ -358,7 +358,7 @@ sub WriteConfiguration
358358
ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
359359
<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
360360
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{solution}->{options}->{pthread};$self->{includes}"
361-
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
361+
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
362362
StringPooling="$p->{strpool}"
363363
RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
364364
EOF
@@ -407,4 +407,19 @@ EOF
407407
}
408408

409409

410+
# Utility function that loads a complete file
411+
subread_file {
412+
my$filename =shift;
413+
my$F;
414+
my$t =$/;
415+
416+
undef$/;
417+
open($F,$filename) || croak"Could not open file$filename\n";
418+
my$txt = <$F>;
419+
close($F);
420+
$/ =$t;
421+
422+
return$txt;
423+
}
424+
410425
1;

‎src/tools/msvc/config.pl

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
# Configuration arguments for vcbuild.
2-
use strict;
3-
use warnings;
4-
5-
our$config = {
6-
asserts=>1,# --enable-cassert
7-
nls=>undef,# --enable-nls=<path>
8-
tcl=>'c:\tcl',# --with-tls=<path>
9-
perl=>1,# --with-perl
10-
python=>'c:\python24',# --with-python=<path>
11-
krb5=>'c:\prog\pgsql\depend\krb5',# --with-krb5=<path>
12-
ldap=>1,# --with-ldap
13-
openssl=>'c:\openssl',# --with-ssl=<path>
14-
pthread=>'c:\prog\pgsql\depend\pthread',# foo baz?
15-
zlib=>'c:\prog\pgsql\depend\zlib'# --with-zlib=<path>
16-
};
17-
18-
1;
1+
# Configuration arguments for vcbuild.
2+
use strict;
3+
use warnings;
4+
5+
our$config = {
6+
asserts=>1,# --enable-cassert
7+
nls=>undef,# --enable-nls=<path>
8+
tcl=>'c:\tcl',# --with-tls=<path>
9+
perl=>1,# --with-perl
10+
python=>'c:\python24',# --with-python=<path>
11+
krb5=>'c:\prog\pgsql\depend\krb5',# --with-krb5=<path>
12+
ldap=>1,# --with-ldap
13+
openssl=>'c:\openssl',# --with-ssl=<path>
14+
pthread=>'c:\prog\pgsql\depend\pthread',
15+
xml=>'c:\prog\pgsql\depend\libxml2',
16+
xslt=>'c:\prog\pgsql\depend\libxslt',
17+
iconv=>'c:\prog\pgsql\depend\iconv',
18+
zlib=>'c:\prog\pgsql\depend\zlib'# --with-zlib=<path>
19+
};
20+
21+
1;

‎src/tools/msvc/gendef.pl

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
my@def;
2-
3-
die"Usage: gendef.pl <modulepath>\n"unless ($ARGV[0] =~/\\([^\\]+$)/);
4-
my$defname =uc$1;
5-
6-
if (-f"$ARGV[0]/$defname.def") {
7-
print"Not re-generating$defname.DEF, file already exists.\n";
8-
exit(0);
9-
}
10-
11-
print"Generating$defname.DEF from directory$ARGV[0]\n";
12-
13-
while (<$ARGV[0]/*>) {
14-
print".";
15-
open(F,"dumpbin /symbols$_|") ||die"Could not open$_\n";
16-
while (<F>) {
17-
s/\(\)//g;
18-
nextunless/^\d/;
19-
my@pieces =split ;
20-
nextunless$pieces[6];
21-
nextif ($pieces[2]eq"UNDEF");
22-
nextunless ($pieces[4]eq"External");
23-
nextif$pieces[6] =~/^@/;
24-
nextif$pieces[6] =~/^\(/;
25-
nextif$pieces[6] =~/^__real/;
26-
nextif$pieces[6] =~/^__imp/;
27-
nextif$pieces[6] =~/NULL_THUNK_DATA$/;
28-
nextif$pieces[6] =~/^__IMPORT_DESCRIPTOR/;
29-
nextif$pieces[6] =~/^__NULL_IMPORT/;
30-
31-
push@def,$pieces[6];
32-
}
33-
close(F);
34-
}
35-
print"\n";
36-
37-
open(DEF,">$ARGV[0]/$defname.def") ||die"Could not write to$defname\n";
38-
print DEF"EXPORTS\n";
39-
my$i = 0;
40-
my$last ="";
41-
foreachmy$f (sort@def) {
42-
nextif ($feq$last);
43-
$last =$f;
44-
$f =~s/^_//;
45-
$i++;
46-
# print DEF " $f \@ $i\n"; # ordinaled exports?
47-
print DEF"$f\n";
48-
}
49-
close(DEF);
50-
print"Generated$i symbols\n";
1+
my@def;
2+
3+
die"Usage: gendef.pl <modulepath>\n"unless ($ARGV[0] =~/\\([^\\]+$)/);
4+
my$defname =uc$1;
5+
6+
if (-f"$ARGV[0]/$defname.def") {
7+
print"Not re-generating$defname.DEF, file already exists.\n";
8+
exit(0);
9+
}
10+
11+
print"Generating$defname.DEF from directory$ARGV[0]\n";
12+
13+
while (<$ARGV[0]/*>) {
14+
print".";
15+
open(F,"dumpbin /symbols$_|") ||die"Could not open$_\n";
16+
while (<F>) {
17+
s/\(\)//g;
18+
nextunless/^\d/;
19+
my@pieces =split ;
20+
nextunless$pieces[6];
21+
nextif ($pieces[2]eq"UNDEF");
22+
nextunless ($pieces[4]eq"External");
23+
nextif$pieces[6] =~/^@/;
24+
nextif$pieces[6] =~/^\(/;
25+
nextif$pieces[6] =~/^__real/;
26+
nextif$pieces[6] =~/^__imp/;
27+
nextif$pieces[6] =~/NULL_THUNK_DATA$/;
28+
nextif$pieces[6] =~/^__IMPORT_DESCRIPTOR/;
29+
nextif$pieces[6] =~/^__NULL_IMPORT/;
30+
31+
push@def,$pieces[6];
32+
}
33+
close(F);
34+
}
35+
print"\n";
36+
37+
open(DEF,">$ARGV[0]/$defname.def") ||die"Could not write to$defname\n";
38+
print DEF"EXPORTS\n";
39+
my$i = 0;
40+
my$last ="";
41+
foreachmy$f (sort@def) {
42+
nextif ($feq$last);
43+
$last =$f;
44+
$f =~s/^_//;
45+
$i++;
46+
# print DEF " $f \@ $i\n"; # ordinaled exports?
47+
print DEF"$f\n";
48+
}
49+
close(DEF);
50+
print"Generated$i symbols\n";

‎src/tools/msvc/mkvcbuild.pl

Lines changed: 148 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,73 @@
144144
$pgrestore->{name} ='pg_restore';
145145
$pgrestore->AddFile('src\bin\pg_dump\pg_restore.c');
146146

147-
open(MF,'src\backend\utils\mb\conversion_procs\Makefile') ||die'Could not open src\backend\utils\mb\conversion_procs\Makefile';
148-
my$t =$/;undef$/;
149-
my$mf = <MF>;
150-
close(MF);
147+
my$zic =$solution->AddProject('zic','exe','utils');
148+
$zic->AddFiles('src\timezone','zic.c','ialloc.c','scheck.c','localtime.c');
149+
$zic->AddReference($libpgport);
150+
151+
my$contrib_defines = {
152+
'refint'=>'REFINT_VERBOSE'
153+
};
154+
my@contrib_uselibpq = ('dblink','oid2name','pgbench','vacuumlo');
155+
my@contrib_uselibpgport = ('oid2name','pgbench','vacuumlo');
156+
my$contrib_extralibs = {
157+
'pgbench'=> ['wsock32.lib']
158+
};
159+
my$contrib_extraincludes = {
160+
'tsearch2'=> ['contrib/tsearch2']
161+
};
162+
my$contrib_extrasource = {
163+
'cube'=> ['cubescan.l','cubeparse.y'],
164+
'seg'=> ['segscan.l','segparse.y']
165+
};
166+
167+
my@contrib_excludes = ('pgcrypto');
168+
169+
if ($solution->{options}->{xml}) {
170+
$contrib_extraincludes->{'xml2'} = [$solution->{options}->{xml} .'\include' ,
171+
$solution->{options}->{xslt} .'\include',
172+
$solution->{options}->{iconv} .'\include'];
173+
174+
$contrib_extralibs->{'xml2'} = [$solution->{options}->{xml} .'\lib\libxml2.lib',
175+
$solution->{options}->{xslt} .'\lib\libxslt.lib'];
176+
}
177+
else {
178+
push@contrib_excludes,'xml2';
179+
}
180+
181+
# Pgcrypto makefile too complex to parse....
182+
my$pgcrypto =$solution->AddProject('pgcrypto','dll','crypto');
183+
$pgcrypto->AddFiles('contrib\pgcrypto','pgcrypto.c','px.c','px-hmac.c','px-crypt.c',
184+
'crypt-gensalt.c','crypt-blowfish.c','crypt-des.c','crypt-md5.c','mbuf.c',
185+
'pgp.c','pgp-armor.c','pgp-cfb.c','pgp-compress.c','pgp-decrypt.c','pgp-encrypt.c',
186+
'pgp-info.c','pgp-mpi.c','pgp-pubdec.c','pgp-pubenc.c','pgp-pubkey.c','pgp-s2k.c',
187+
'pgp-pgsql.c');
188+
if ($solution->{options}->{openssl}) {
189+
$pgcrypto->AddFiles('contrib\pgcrypto','openssl.c','pgp-mpi-openssl.c');
190+
}
191+
else {
192+
$pgcrypto->AddFiles('contrib\pgcrypto','md5.c','sha1.c','sha2.c','internal.c','internal-sha2.c',
193+
'blf.c','rijndael.c','fortuna.c','random.c','pgp-mpi-internal.c','imath.c');
194+
}
195+
$pgcrypto->AddReference($postgres);
196+
$pgcrypto->AddLibrary('wsock32.lib');
197+
198+
my$D;
199+
opendir($D,'contrib') || croak"Could not opendir on contrib!\n";
200+
while (my$d =readdir($D)) {
201+
nextif ($d =~/^\./);
202+
nextunless (-f"contrib/$d/Makefile");
203+
nextif (grep {/^$d$/}@contrib_excludes);
204+
AddContrib($d);
205+
}
206+
closedir($D);
207+
208+
209+
my$mf = Project::read_file('src\backend\utils\mb\conversion_procs\Makefile');
151210
$mf =~s{\\s*[\r\n]+}{}mg;
152211
$mf =~m{DIRS\s*=\s*(.*)$}m ||die'Could not match in conversion makefile' ."\n";
153212
foreachmy$sub (split /\s+/,$1) {
154-
open(MF,'src\backend\utils\mb\conversion_procs\\' .$sub .'\Makefile') ||die'Could not open Makefile for $sub';
155-
$mf = <MF>;
156-
close(MF);
213+
my$mf = Project::read_file('src\backend\utils\mb\conversion_procs\\' .$sub .'\Makefile');
157214
my$p =$solution->AddProject($sub,'dll','conversion procs');
158215
$p->AddFile('src\backend\utils\mb\conversion_procs\\' .$sub .'\\' .$sub .'.c');
159216
if ($mf =~m{^SRCS\s*\+=\s*(.*)$}m) {
@@ -162,9 +219,7 @@
162219
$p->AddReference($postgres);
163220
}
164221

165-
open(MF,'src\bin\scripts\Makefile') ||die'Could not open src\bin\scripts\Makefile';
166-
$mf = <MF>;
167-
close(MF);
222+
$mf = Project::read_file('src\bin\scripts\Makefile');
168223
$mf =~s{\\s*[\r\n]+}{}mg;
169224
$mf =~m{PROGRAMS\s*=\s*(.*)$}m ||die'Could not match in bin\scripts\Makefile' ."\n";
170225
foreachmy$prg (split /\s+/,$1) {
@@ -194,24 +249,13 @@
194249
$proj->AddReference($libpq,$libpgport);
195250
$proj->AddResourceFile('src\bin\scripts','PostgreSQL Utility');
196251
}
197-
$/ =$t;
198252

199253

200254
# Regression DLLs
201255
my$regress =$solution->AddProject('regress','dll','misc');
202256
$regress->AddFile('src\test\regress\regress.c');
203257
$regress->AddReference($postgres);
204258

205-
my$refint =$solution->AddProject('refint','dll','contrib');
206-
$refint->AddFile('contrib\spi\refint.c');
207-
$refint->AddReference($postgres);
208-
$refint->AddDefine('REFINT_VERBOSE');
209-
210-
my$autoinc =$solution->AddProject('autoinc','dll','contrib');
211-
$autoinc->AddFile('contrib\spi\autoinc.c');
212-
$autoinc->AddReference($postgres);
213-
214-
215259
$solution->Save();
216260

217261
#####################
@@ -234,3 +278,86 @@ sub AddSimpleFrontend {
234278
return$p;
235279
}
236280

281+
282+
# Add a simple contrib project
283+
subAddContrib {
284+
my$n =shift;
285+
my$mf = Project::read_file('contrib\\' .$n .'\Makefile');
286+
287+
if ($mf =~/^MODULE_big/mg) {
288+
$mf =~s{\\\s*[\r\n]+}{}mg;
289+
my$proj =$solution->AddProject($n,'dll','contrib');
290+
$mf =~/^OBJS\s*=\s*(.*)$/gm || croak"Could not find objects in MODULE_big for$n\n";
291+
foreachmy$o (split /\s+/,$1) {
292+
$o =~s/\.o$/.c/;
293+
$proj->AddFile('contrib\\' .$n .'\\' .$o);
294+
}
295+
$proj->AddReference($postgres);
296+
if ($mf =~/^SUBDIRS\s*:?=\s*(.*)$/mg) {
297+
foreachmy$d (split /\s+/,$1) {
298+
my$mf2 = Project::read_file('contrib\\' .$n .'\\' .$d .'\Makefile');
299+
$mf2 =~s{\\\s*[\r\n]+}{}mg;
300+
$mf2 =~/^SUBOBJS\s*=\s*(.*)$/gm || croak"Could not find objects in MODULE_big for$n, subdir$d\n";
301+
foreachmy$o (split /\s+/,$1) {
302+
$o =~s/\.o$/.c/;
303+
$proj->AddFile('contrib\\' .$n .'\\' .$d .'\\' .$o);
304+
}
305+
}
306+
}
307+
AdjustContribProj($proj);
308+
return$proj;
309+
}
310+
elsif ($mf =~/^MODULES\s*=\s*(.*)$/mg) {
311+
foreachmy$mod (split /\s+/,$1) {
312+
my$proj =$solution->AddProject($mod,'dll','contrib');
313+
$proj->AddFile('contrib\\' .$n .'\\' .$mod .'.c');
314+
$proj->AddReference($postgres);
315+
AdjustContribProj($proj);
316+
}
317+
returnundef;
318+
}
319+
elsif ($mf =~/^PROGRAM\s*=\s*(.*)$/mg) {
320+
my$proj =$solution->AddProject($1,'exe','contrib');
321+
$mf =~/^OBJS\s*=\s*(.*)$/gm || croak"Could not find objects in MODULE_big for$n\n";
322+
foreachmy$o (split /\s+/,$1) {
323+
$o =~s/\.o$/.c/;
324+
$proj->AddFile('contrib\\' .$n .'\\' .$o);
325+
}
326+
AdjustContribProj($proj);
327+
return$proj;
328+
}
329+
else {
330+
croak"Could not determine contrib module type for$n\n";
331+
}
332+
}
333+
334+
subAdjustContribProj {
335+
my$proj =shift;
336+
my$n =$proj->{name};
337+
338+
if ($contrib_defines->{$n}) {
339+
foreachmy$d ($contrib_defines->{$n}) {
340+
$proj->AddDefine($d);
341+
}
342+
}
343+
if (grep {/^$n$/}@contrib_uselibpq) {
344+
$proj->AddIncludeDir('src\interfaces\libpq');
345+
$proj->AddReference($libpq);
346+
}
347+
if (grep {/^$n$/}@contrib_uselibpgport) {
348+
$proj->AddReference($libpgport);
349+
}
350+
if ($contrib_extralibs->{$n}) {
351+
foreachmy$l (@{$contrib_extralibs->{$n}}) {
352+
$proj->AddLibrary($l);
353+
}
354+
}
355+
if ($contrib_extraincludes->{$n}) {
356+
foreachmy$i (@{$contrib_extraincludes->{$n}}) {
357+
$proj->AddIncludeDir($i);
358+
}
359+
}
360+
if ($contrib_extrasource->{$n}) {
361+
$proj->AddFiles('contrib\\' .$n, @{$contrib_extrasource->{$n}});
362+
}
363+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp