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

Commitae8c1be

Browse files
committed
More MSVC build support from Magnus.
1 parent0943799 commitae8c1be

File tree

4 files changed

+411
-0
lines changed

4 files changed

+411
-0
lines changed

‎src/tools/msvc/Solution.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ sub GenerateFiles {
5555
confess"Bad format of version:$self->{strver}\n"
5656
}
5757
$self->{numver} =sprintf("%d%02d%02d",$1,$2,$3?$3:0);
58+
$self->{majorver} =sprintf("%d.%d",$1,$2);
5859
}
5960
}
6061
close(C);
@@ -206,6 +207,19 @@ EOF
206207
EOF
207208
close(O);
208209
}
210+
211+
my$mf = Project::read_file('src\backend\catalog\Makefile');
212+
$mf =~s{\\s*[\r\n]+}{}mg;
213+
$mf =~/^POSTGRES_BKI_SRCS\s*:=[^,]+,(.*)\)$/gm || croak"Could not find POSTGRES_BKI_SRCS in Makefile\n";
214+
my@allbki =split /\s+/,$1;
215+
foreachmy$bki (@allbki) {
216+
nextif$bkieq"";
217+
if (IsNewer('src/backend/catalog/postgres.bki',"src/include/catalog/$bki")) {
218+
print"Generating postgres.bki...\n";
219+
system("perl src/tools/msvc/genbki.pl$self->{majorver} src/backend/catalog/postgres" .join(' src/include/catalog/',@allbki));
220+
last;
221+
}
222+
}
209223
}
210224

211225
subAddProject {

‎src/tools/msvc/clean.bat

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@echooff
2+
3+
setD=%CD%
4+
ifexist ..\msvcifexist ..\..\..\srccd ..\..\..
5+
6+
ifexist debugrd /s /q debug
7+
ifexist releaserd /s /q release
8+
call :del *.vcproj
9+
call :del pgsql.sln
10+
del /s /q src\bin\win32ver.rc2>NUL
11+
del /s /q src\interfaces\win32ver.rc2>NUL
12+
call :del src\backend\win32ver.rc
13+
14+
15+
REM Delete files created with GenerateFiles() in Solution.pm
16+
call :del src\include\pg_config.h
17+
call :del src\include\pg_config_os.h
18+
call :del src\include\parser\parse.h
19+
call :del src\include\utils\fmgroids.h
20+
21+
call :del src\backend\utils\fmgrtab.c
22+
call :del src\backend\catalog\postgres.bki
23+
call :del src\backend\catalog\postgres.description
24+
call :del src\backend\catalog\postgres.shdescription
25+
call :del src\backend\parser\gram.c
26+
call :del src\backend\bootstrap\bootparse.c
27+
call :del src\backend\bootstrap\bootstrap_tokens.h
28+
29+
call :del src\bin\psql\sql_help.h
30+
31+
call :del src\interfaces\libpq\libpq.rc
32+
call :del src\interfaces\libpq\libpqdll.def
33+
call :del src\interfaces\ecpg\include\ecpg_config.h
34+
call :del src\interfaces\ecpg\preproc\preproc.c
35+
call :del src\interfaces\ecpg\preproc\preproc.h
36+
37+
call :del src\port\pg_config_paths.h
38+
39+
call :del src\pl\plperl\spi.c
40+
call :del src\pl\plpgsql\src\pl_gram.c
41+
call :del src\pl\plpgsql\src\pl.tab.h
42+
43+
call :del contrib\cube\cubeparse.c
44+
call :del contrib\cube\cubeparse.h
45+
call :del contrib\seg\segparse.c
46+
call :del contrib\seg\segparse.h
47+
48+
49+
cd%D%
50+
goto :eof
51+
52+
53+
:del
54+
ifexist%1del /q%1
55+
goto :eof

‎src/tools/msvc/genbki.pl

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
#!/usr/bin/perl
2+
#-------------------------------------------------------------------------
3+
#
4+
# genbki.pl--
5+
# perl script which generates .bki files from specially formatted .h
6+
# files. These .bki files are used to initialize the postgres template
7+
# database.
8+
#
9+
# Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
10+
# Portions Copyright (c) 1994, Regents of the University of California
11+
#
12+
#
13+
# IDENTIFICATION
14+
# $PostgreSQL: pgsql/src/tools/msvc/genbki.pl,v 1.1 2006/11/29 19:49:31 tgl Exp $
15+
#
16+
#-------------------------------------------------------------------------
17+
18+
use strict;
19+
use warnings;
20+
21+
my$version =shift || Usage();
22+
my$prefix =shift || Usage();
23+
24+
$version =~/^(\d+\.\d+)/ ||die"Bad format verison$version\n";
25+
my$majorversion =$1;
26+
27+
my$pgext = read_file("src/include/postgres_ext.h");
28+
$pgext =~/^#define\s+NAMEDATALEN\s+(\d+)$/mg ||die"Could not read NAMEDATALEN from postgres_ext.h\n";
29+
my$namedatalen =$1;
30+
31+
my$pgauthid = read_file("src/include/catalog/pg_authid.h");
32+
$pgauthid =~/^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg ||die"Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h\n";
33+
my$bootstrapsuperuserid =$1;
34+
35+
my$pgnamespace = read_file("src/include/catalog/pg_namespace.h");
36+
$pgnamespace =~/^#define\s+PG_CATALOG_NAMESPACE\s+(\d+)$/mg ||die"Could not read PG_CATALOG_NAMESPACE from pg_namespace.h\n";
37+
my$pgcatalognamespace =$1;
38+
39+
my$indata ="";
40+
while (my$f =shift) {
41+
$indata .= read_file($f);
42+
$indata .="\n";
43+
}
44+
45+
# Strip C comments, from perl FAQ 4.27
46+
$indata =~s{/\*.*?\*/}{}gs;
47+
48+
$indata =~s{;\s*$}{}gm;
49+
$indata =~s{^\s+}{}gm;
50+
$indata =~s{^Oid}{oid}gm;
51+
$indata =~s{\(Oid}{(oid}gm;
52+
$indata =~s{^NameData}{name}gm;
53+
$indata =~s{\(NameData}{(name}g;
54+
$indata =~s{^TransactionId}{xid}gm;
55+
$indata =~s{\(TransactionId}{(xid}g;
56+
$indata =~s{PGUID}{$bootstrapsuperuserid}g;
57+
$indata =~s{NAMEDATALEN}{$namedatalen}g;
58+
$indata =~s{PGNSP}{$pgcatalognamespace}g;
59+
60+
#print $indata;
61+
62+
my$bki ="";
63+
my$desc ="";
64+
my$shdesc ="";
65+
66+
my$oid = 0;
67+
my$catalog = 0;
68+
my$reln_open = 0;
69+
my$bootstrap ="";
70+
my$shared_relation ="";
71+
my$without_oids ="";
72+
my$nc = 0;
73+
my$inside = 0;
74+
my@attr;
75+
my@types;
76+
foreachmy$line (split /\n/,$indata) {
77+
if ($line =~/^DATA\((.*)\)$/m) {
78+
my$data =$1;
79+
my@fields =split /\s+/,$data;
80+
if ($#fields >=4 &&$fields[0]eq"insert" &&$fields[1]eq"OID" &&$fields[2]eq"=") {
81+
$oid =$fields[3];
82+
}
83+
$data =~s/\s{2,}//g;
84+
$bki .=$data ."\n";
85+
}
86+
elsif ($line =~/^DESCR\("(.*)"\)$/m){
87+
if ($oid != 0) {
88+
$desc .=sprintf("%d\t%s\t0\t%s\n",$oid,$catalog,$1);
89+
}
90+
}
91+
elsif ($line =~/^SHDESCR\("(.*)"\)$/m) {
92+
if ($oid != 0) {
93+
$shdesc .=sprintf("%d\t%s\t%s\n",$oid,$catalog,$1);
94+
}
95+
}
96+
elsif ($line =~/^DECLARE_(UNIQUE_)?INDEX\((.*)\)$/m) {
97+
if ($reln_open) {
98+
$bki .="close$catalog\n";
99+
$reln_open = 0;
100+
}
101+
my$u =$1?" unique":"";
102+
my@fields =split /,/,$2,3;
103+
$fields[2] =~s/\s{2,}//g;
104+
$bki .="declare$u index$fields[0]$fields[1]$fields[2]\n";
105+
}
106+
elsif ($line =~/^DECLARE_TOAST\((.*)\)$/m) {
107+
if ($reln_open) {
108+
$bki .="close$catalog\n";
109+
$reln_open = 0;
110+
}
111+
my@fields =split /,/,$1;
112+
$bki .="declare toast$fields[1]$fields[2] on$fields[0]\n";
113+
}
114+
elsif ($line =~/^BUILD_INDICES/) {
115+
$bki .="build indices\n";
116+
}
117+
elsif ($line =~/^CATALOG\((.*)\)(.*)$/m) {
118+
if ($reln_open) {
119+
$bki .="close$catalog\n";
120+
$reln_open = 0;
121+
}
122+
my$rest =$2;
123+
my@fields =split /,/,$1;
124+
$catalog =$fields[0];
125+
$oid =$fields[1];
126+
$bootstrap=$shared_relation=$without_oids="";
127+
if ($rest =~/BKI_BOOTSTRAP/) {
128+
$bootstrap ="bootstrap";
129+
}
130+
if ($rest =~/BKI_SHARED_RELATION/) {
131+
$shared_relation ="shared_relation";
132+
}
133+
if ($rest =~/BKI_WITHOUT_OIDS/) {
134+
$without_oids ="without_oids";
135+
}
136+
$nc++;
137+
$inside = 1;
138+
next;
139+
}
140+
if ($inside==1) {
141+
nextif ($line =~/{/);
142+
if ($line =~/}/) {
143+
# Last line
144+
$bki .="create$bootstrap$shared_relation$without_oids$catalog$oid\n (\n";
145+
my$first = 1;
146+
for (my$i = 0;$i <=$#attr;$i++) {
147+
if ($first == 1) {
148+
$first = 0;
149+
}else {
150+
$bki .=",\n";
151+
}
152+
$bki .="" .$attr[$i] ." =" .$types[$i];
153+
}
154+
$bki .="\n )\n";
155+
undef(@attr);
156+
undef(@types);
157+
$reln_open = 1;
158+
$inside = 0;
159+
if ($bootstrapeq"") {
160+
$bki .="open$catalog\n";
161+
}
162+
next;
163+
}
164+
# inside catalog definition, so keep sucking up attributes
165+
my@fields =split /\s+/,$line;
166+
if ($fields[1] =~/(.*)\[.*\]/) {#Array attribute
167+
push@attr,$1;
168+
push@types,$fields[0] .'[]';
169+
}
170+
else {
171+
push@attr,$fields[1];
172+
push@types,$fields[0];
173+
}
174+
next;
175+
}
176+
}
177+
if ($reln_open == 1) {
178+
$bki .="close$catalog\n";
179+
}
180+
181+
open(O,">$prefix.bki") ||die"Could not write$prefix.bki\n";
182+
print O"# PostgreSQL$majorversion\n";
183+
print O$bki;
184+
close(O);
185+
open(O,">$prefix.description") ||die"Could not write$prefix.description\n";
186+
print O$desc;
187+
close(O);
188+
open(O,">$prefix.shdescription") ||die"Could not write$prefix.shdescription\n";
189+
print O$shdesc;
190+
close(O);
191+
192+
subUsage {
193+
print"Usage: genbki.pl <version> <prefix> <input1> [<input2> <input3>...]\n";
194+
exit(1);
195+
}
196+
197+
subread_file {
198+
my$filename =shift;
199+
my$F;
200+
my$t =$/;
201+
202+
undef$/;
203+
open($F,$filename) ||die"Could not open file$filename\n";
204+
my$txt = <$F>;
205+
close($F);
206+
$/ =$t;
207+
208+
return$txt;
209+
}
210+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp