Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
eee22892
Commit
eee22892
authored
Mar 12, 2007
by
Magnus Hagander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a run with perltidy to format the code. Per request from Andrew Dunstan.
parent
576027bb
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1376 additions
and
1089 deletions
+1376
-1089
src/tools/msvc/Project.pm
src/tools/msvc/Project.pm
+417
-326
src/tools/msvc/README
src/tools/msvc/README
+8
-0
src/tools/msvc/Solution.pm
src/tools/msvc/Solution.pm
+303
-245
src/tools/msvc/config.pl
src/tools/msvc/config.pl
+14
-14
src/tools/msvc/genbki.pl
src/tools/msvc/genbki.pl
+164
-127
src/tools/msvc/gendef.pl
src/tools/msvc/gendef.pl
+36
-31
src/tools/msvc/install.pl
src/tools/msvc/install.pl
+157
-123
src/tools/msvc/mkvcbuild.pl
src/tools/msvc/mkvcbuild.pl
+277
-223
No files found.
src/tools/msvc/Project.pm
View file @
eee22892
This diff is collapsed.
Click to expand it.
src/tools/msvc/README
View file @
eee22892
...
...
@@ -63,3 +63,11 @@ Get from http://www.zlib.net
libxml2 and libxslt - required for XML support
Get from http://www.zlatkovic.com/pub/libxml or build from source from
http://xmlsoft.org. Note that libxml2 requires iconv.
Code indention
--------------
If the perl code is modified, use perltidy on it since pgindent won't
touch perl code. Use the following commandline:
perltidy -b -bl -nsfs -naws -l=100 *.pl *.pm
src/tools/msvc/Solution.pm
View file @
eee22892
This diff is collapsed.
Click to expand it.
src/tools/msvc/config.pl
View file @
eee22892
...
...
@@ -3,20 +3,20 @@ use strict;
use
warnings
;
our
$config
=
{
asserts
=>
1
,
# --enable-cassert
integer_datetimes
=>
1
,
# --enable-integer-datetimes
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
openssl
=>
'
c:
\
openssl
',
# --with-ssl=<path>
pthread
=>
'
c:
\
prog
\
pgsql
\
depend
\
pthread
',
xml
=>
'
c:
\
prog
\
pgsql
\
depend
\
libxml2
',
xslt
=>
'
c:
\
prog
\
pgsql
\
depend
\
libxslt
',
iconv
=>
'
c:
\
prog
\
pgsql
\
depend
\
iconv
',
zlib
=>
'
c:
\
prog
\
pgsql
\
depend
\
zlib
'
# --with-zlib=<path>
asserts
=>
1
,
# --enable-cassert
integer_datetimes
=>
1
,
# --enable-integer-datetimes
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
openssl
=>
'
c:
\
openssl
',
# --with-ssl=<path>
pthread
=>
'
c:
\
prog
\
pgsql
\
depend
\
pthread
',
xml
=>
'
c:
\
prog
\
pgsql
\
depend
\
libxml2
',
xslt
=>
'
c:
\
prog
\
pgsql
\
depend
\
libxslt
',
iconv
=>
'
c:
\
prog
\
pgsql
\
depend
\
iconv
',
zlib
=>
'
c:
\
prog
\
pgsql
\
depend
\
zlib
'
# --with-zlib=<path>
};
1
;
src/tools/msvc/genbki.pl
View file @
eee22892
...
...
@@ -11,7 +11,7 @@
#
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/tools/msvc/genbki.pl,v 1.
4 2007/02/19 14:05:42
mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/genbki.pl,v 1.
5 2007/03/12 19:10:50
mha Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -25,24 +25,28 @@ $version =~ /^(\d+\.\d+)/ || die "Bad format verison $version\n";
my
$majorversion
=
$1
;
my
$pgext
=
read_file
("
src/include/pg_config_manual.h
");
$pgext
=~
/^#define\s+NAMEDATALEN\s+(\d+)$/mg
||
die
"
Could not read NAMEDATALEN from pg_config_manual.h
\n
";
$pgext
=~
/^#define\s+NAMEDATALEN\s+(\d+)$/mg
||
die
"
Could not read NAMEDATALEN from pg_config_manual.h
\n
";
my
$namedatalen
=
$1
;
my
$pgauthid
=
read_file
("
src/include/catalog/pg_authid.h
");
$pgauthid
=~
/^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg
||
die
"
Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h
\n
";
$pgauthid
=~
/^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg
||
die
"
Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h
\n
";
my
$bootstrapsuperuserid
=
$1
;
my
$pgnamespace
=
read_file
("
src/include/catalog/pg_namespace.h
");
$pgnamespace
=~
/^#define\s+PG_CATALOG_NAMESPACE\s+(\d+)$/mg
||
die
"
Could not read PG_CATALOG_NAMESPACE from pg_namespace.h
\n
";
$pgnamespace
=~
/^#define\s+PG_CATALOG_NAMESPACE\s+(\d+)$/mg
||
die
"
Could not read PG_CATALOG_NAMESPACE from pg_namespace.h
\n
";
my
$pgcatalognamespace
=
$1
;
my
$indata
=
"";
while
(
my
$f
=
shift
)
{
$indata
.=
read_file
(
$f
);
$indata
.=
"
\n
";
while
(
my
$f
=
shift
)
{
$indata
.=
read_file
(
$f
);
$indata
.=
"
\n
";
}
# Strip C comments, from perl FAQ 4.27
# Strip C comments, from perl FAQ 4.27
$indata
=~
s{/\*.*?\*/}{}gs
;
$indata
=~
s{;\s*$}{}gm
;
...
...
@@ -73,112 +77,143 @@ my $nc = 0;
my
$inside
=
0
;
my
@attr
;
my
@types
;
foreach
my
$line
(
split
/\n/
,
$indata
)
{
if
(
$line
=~
/^DATA\((.*)\)$/m
)
{
my
$data
=
$1
;
my
@fields
=
split
/\s+/
,
$data
;
if
(
$#fields
>=
4
&&
$fields
[
0
]
eq
"
insert
"
&&
$fields
[
1
]
eq
"
OID
"
&&
$fields
[
2
]
eq
"
=
")
{
$oid
=
$fields
[
3
];
}
else
{
$oid
=
0
;
}
$data
=~
s/\s{2,}/ /g
;
$bki
.=
$data
.
"
\n
";
}
elsif
(
$line
=~
/^DESCR\("(.*)"\)$/m
){
if
(
$oid
!=
0
)
{
$desc
.=
sprintf
("
%d
\t
%s
\t
0
\t
%s
\n
",
$oid
,
$catalog
,
$1
);
}
}
elsif
(
$line
=~
/^SHDESCR\("(.*)"\)$/m
)
{
if
(
$oid
!=
0
)
{
$shdesc
.=
sprintf
("
%d
\t
%s
\t
%s
\n
",
$oid
,
$catalog
,
$1
);
}
}
elsif
(
$line
=~
/^DECLARE_(UNIQUE_)?INDEX\((.*)\)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
$u
=
$1
?"
unique
":"";
my
@fields
=
split
/,/
,
$2
,
3
;
$fields
[
2
]
=~
s/\s{2,}/ /g
;
$bki
.=
"
declare
$u
index
$fields
[0]
$fields
[1]
$fields
[2]
\n
";
}
elsif
(
$line
=~
/^DECLARE_TOAST\((.*)\)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
@fields
=
split
/,/
,
$1
;
foreach
my
$line
(
split
/\n/
,
$indata
)
{
if
(
$line
=~
/^DATA\((.*)\)$/m
)
{
my
$data
=
$1
;
my
@fields
=
split
/\s+/
,
$data
;
if
(
$#fields
>=
4
&&
$fields
[
0
]
eq
"
insert
"
&&
$fields
[
1
]
eq
"
OID
"
&&
$fields
[
2
]
eq
"
=
")
{
$oid
=
$fields
[
3
];
}
else
{
$oid
=
0
;
}
$data
=~
s/\s{2,}/ /g
;
$bki
.=
$data
.
"
\n
";
}
elsif
(
$line
=~
/^DESCR\("(.*)"\)$/m
)
{
if
(
$oid
!=
0
)
{
$desc
.=
sprintf
("
%d
\t
%s
\t
0
\t
%s
\n
",
$oid
,
$catalog
,
$1
);
}
}
elsif
(
$line
=~
/^SHDESCR\("(.*)"\)$/m
)
{
if
(
$oid
!=
0
)
{
$shdesc
.=
sprintf
("
%d
\t
%s
\t
%s
\n
",
$oid
,
$catalog
,
$1
);
}
}
elsif
(
$line
=~
/^DECLARE_(UNIQUE_)?INDEX\((.*)\)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
$u
=
$1
?"
unique
":"";
my
@fields
=
split
/,/
,
$2
,
3
;
$fields
[
2
]
=~
s/\s{2,}/ /g
;
$bki
.=
"
declare
$u
index
$fields
[0]
$fields
[1]
$fields
[2]
\n
";
}
elsif
(
$line
=~
/^DECLARE_TOAST\((.*)\)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
@fields
=
split
/,/
,
$1
;
$bki
.=
"
declare toast
$fields
[1]
$fields
[2] on
$fields
[0]
\n
";
}
elsif
(
$line
=~
/^BUILD_INDICES/
)
{
$bki
.=
"
build indices
\n
";
}
elsif
(
$line
=~
/^CATALOG\((.*)\)(.*)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
$rest
=
$2
;
my
@fields
=
split
/,/
,
$1
;
$catalog
=
$fields
[
0
];
$oid
=
$fields
[
1
];
$bootstrap
=
$shared_relation
=
$without_oids
=
"";
if
(
$rest
=~
/BKI_BOOTSTRAP/
)
{
$bootstrap
=
"
bootstrap
";
}
if
(
$rest
=~
/BKI_SHARED_RELATION/
)
{
$shared_relation
=
"
shared_relation
";
}
if
(
$rest
=~
/BKI_WITHOUT_OIDS/
)
{
$without_oids
=
"
without_oids
";
}
$nc
++
;
$inside
=
1
;
next
;
}
if
(
$inside
==
1
)
{
next
if
(
$line
=~
/{/
);
if
(
$line
=~
/}/
)
{
# Last line
$bki
.=
"
create
$bootstrap$shared_relation$without_oids$catalog
$oid
\n
(
\n
";
my
$first
=
1
;
for
(
my
$i
=
0
;
$i
<=
$#attr
;
$i
++
)
{
if
(
$first
==
1
)
{
$first
=
0
;
}
else
{
$bki
.=
"
,
\n
";
}
$bki
.=
"
"
.
$attr
[
$i
]
.
"
=
"
.
$types
[
$i
];
}
$bki
.=
"
\n
)
\n
";
undef
(
@attr
);
undef
(
@types
);
$reln_open
=
1
;
$inside
=
0
;
if
(
$bootstrap
eq
"")
{
$bki
.=
"
open
$catalog
\n
";
}
next
;
}
# inside catalog definition, so keep sucking up attributes
my
@fields
=
split
/\s+/
,
$line
;
if
(
$fields
[
1
]
=~
/(.*)\[.*\]/
)
{
#Array attribute
push
@attr
,
$1
;
push
@types
,
$fields
[
0
]
.
'
[]
';
}
else
{
push
@attr
,
$fields
[
1
];
push
@types
,
$fields
[
0
];
}
next
;
}
}
elsif
(
$line
=~
/^BUILD_INDICES/
)
{
$bki
.=
"
build indices
\n
";
}
elsif
(
$line
=~
/^CATALOG\((.*)\)(.*)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
$rest
=
$2
;
my
@fields
=
split
/,/
,
$1
;
$catalog
=
$fields
[
0
];
$oid
=
$fields
[
1
];
$bootstrap
=
$shared_relation
=
$without_oids
=
"";
if
(
$rest
=~
/BKI_BOOTSTRAP/
)
{
$bootstrap
=
"
bootstrap
";
}
if
(
$rest
=~
/BKI_SHARED_RELATION/
)
{
$shared_relation
=
"
shared_relation
";
}
if
(
$rest
=~
/BKI_WITHOUT_OIDS/
)
{
$without_oids
=
"
without_oids
";
}
$nc
++
;
$inside
=
1
;
next
;
}
if
(
$inside
==
1
)
{
next
if
(
$line
=~
/{/
);
if
(
$line
=~
/}/
)
{
# Last line
$bki
.=
"
create
$bootstrap$shared_relation$without_oids$catalog
$oid
\n
(
\n
";
my
$first
=
1
;
for
(
my
$i
=
0
;
$i
<=
$#attr
;
$i
++
)
{
if
(
$first
==
1
)
{
$first
=
0
;
}
else
{
$bki
.=
"
,
\n
";
}
$bki
.=
"
"
.
$attr
[
$i
]
.
"
=
"
.
$types
[
$i
];
}
$bki
.=
"
\n
)
\n
";
undef
(
@attr
);
undef
(
@types
);
$reln_open
=
1
;
$inside
=
0
;
if
(
$bootstrap
eq
"")
{
$bki
.=
"
open
$catalog
\n
";
}
next
;
}
# inside catalog definition, so keep sucking up attributes
my
@fields
=
split
/\s+/
,
$line
;
if
(
$fields
[
1
]
=~
/(.*)\[.*\]/
)
{
#Array attribute
push
@attr
,
$1
;
push
@types
,
$fields
[
0
]
.
'
[]
';
}
else
{
push
@attr
,
$fields
[
1
];
push
@types
,
$fields
[
0
];
}
next
;
}
}
if
(
$reln_open
==
1
)
{
$bki
.=
"
close
$catalog
\n
";
if
(
$reln_open
==
1
)
{
$bki
.=
"
close
$catalog
\n
";
}
open
(
O
,"
>
$prefix
.bki
")
||
die
"
Could not write
$prefix
.bki
\n
";
...
...
@@ -192,22 +227,24 @@ open(O,">$prefix.shdescription") || die "Could not write $prefix.shdescription\n
print
O
$shdesc
;
close
(
O
);
sub
Usage
{
print
"
Usage: genbki.pl <version> <prefix> <input1> [<input2> <input3>...]
\n
";
exit
(
1
);
sub
Usage
{
print
"
Usage: genbki.pl <version> <prefix> <input1> [<input2> <input3>...]
\n
";
exit
(
1
);
}
sub
read_file
{
my
$filename
=
shift
;
my
$F
;
my
$t
=
$/
;
undef
$/
;
open
(
$F
,
$filename
)
||
die
"
Could not open file
$filename
\n
";
my
$txt
=
<
$F
>
;
close
(
$F
);
$/
=
$t
;
return
$txt
;
sub
read_file
{
my
$filename
=
shift
;
my
$F
;
my
$t
=
$/
;
undef
$/
;
open
(
$F
,
$filename
)
||
die
"
Could not open file
$filename
\n
";
my
$txt
=
<
$F
>
;
close
(
$F
);
$/
=
$t
;
return
$txt
;
}
src/tools/msvc/gendef.pl
View file @
eee22892
...
...
@@ -3,36 +3,39 @@ my @def;
die
"
Usage: gendef.pl <modulepath>
\n
"
unless
(
$ARGV
[
0
]
=~
/\\([^\\]+$)/
);
my
$defname
=
uc
$1
;
if
(
-
f
"
$ARGV
[0]/
$defname
.def
")
{
print
"
Not re-generating
$defname
.DEF, file already exists.
\n
";
exit
(
0
);
if
(
-
f
"
$ARGV
[0]/
$defname
.def
")
{
print
"
Not re-generating
$defname
.DEF, file already exists.
\n
";
exit
(
0
);
}
print
"
Generating
$defname
.DEF from directory
$ARGV
[0]
\n
";
while
(
<
$ARGV
[
0
]
/*.
obj
>
)
{
while
(
<
$ARGV
[
0
]
/*.
obj
>
)
{
print
"
.
";
system
("
dumpbin /symbols /out:symbols.out
$_
>NUL
")
&&
die
"
Could not call dumpbin
";
open
(
F
,
"
<symbols.out
")
||
die
"
Could not open symbols.out for
$_
\n
";
while
(
<
F
>
)
{
s/\(\)//g
;
next
unless
/^\d/
;
my
@pieces
=
split
;
next
unless
$pieces
[
6
];
next
if
(
$pieces
[
2
]
eq
"
UNDEF
");
next
unless
(
$pieces
[
4
]
eq
"
External
");
next
if
$pieces
[
6
]
=~
/^@/
;
next
if
$pieces
[
6
]
=~
/^\(/
;
next
if
$pieces
[
6
]
=~
/^__real/
;
next
if
$pieces
[
6
]
=~
/^__imp/
;
next
if
$pieces
[
6
]
=~
/NULL_THUNK_DATA$/
;
next
if
$pieces
[
6
]
=~
/^__IMPORT_DESCRIPTOR/
;
next
if
$pieces
[
6
]
=~
/^__NULL_IMPORT/
;
system
("
dumpbin /symbols /out:symbols.out
$_
>NUL
")
&&
die
"
Could not call dumpbin
";
open
(
F
,
"
<symbols.out
")
||
die
"
Could not open symbols.out for
$_
\n
";
while
(
<
F
>
)
{
s/\(\)//g
;
next
unless
/^\d/
;
my
@pieces
=
split
;
next
unless
$pieces
[
6
];
next
if
(
$pieces
[
2
]
eq
"
UNDEF
");
next
unless
(
$pieces
[
4
]
eq
"
External
");
next
if
$pieces
[
6
]
=~
/^@/
;
next
if
$pieces
[
6
]
=~
/^\(/
;
next
if
$pieces
[
6
]
=~
/^__real/
;
next
if
$pieces
[
6
]
=~
/^__imp/
;
next
if
$pieces
[
6
]
=~
/NULL_THUNK_DATA$/
;
next
if
$pieces
[
6
]
=~
/^__IMPORT_DESCRIPTOR/
;
next
if
$pieces
[
6
]
=~
/^__NULL_IMPORT/
;
push
@def
,
$pieces
[
6
];
}
close
(
F
);
unlink
("
symbols.out
");
push
@def
,
$pieces
[
6
];
}
close
(
F
);
unlink
("
symbols.out
");
}
print
"
\n
";
...
...
@@ -40,13 +43,15 @@ open(DEF,">$ARGV[0]/$defname.def") || die "Could not write to $defname\n";
print
DEF
"
EXPORTS
\n
";
my
$i
=
0
;
my
$last
=
"";
foreach
my
$f
(
sort
@def
)
{
next
if
(
$f
eq
$last
);
$last
=
$f
;
$f
=~
s/^_//
;
$i
++
;
# print DEF " $f \@ $i\n"; # ordinaled exports?
print
DEF
"
$f
\n
";
foreach
my
$f
(
sort
@def
)
{
next
if
(
$f
eq
$last
);
$last
=
$f
;
$f
=~
s/^_//
;
$i
++
;
# print DEF " $f \@ $i\n"; # ordinaled exports?
print
DEF
"
$f
\n
";
}
close
(
DEF
);
print
"
Generated
$i
symbols
\n
";
src/tools/msvc/install.pl
View file @
eee22892
...
...
@@ -10,159 +10,193 @@ my $target = shift || Usage();
chdir
("
../../..
")
if
(
-
f
"
../../../configure
");
my
$conf
=
"";
if
(
-
d
"
debug
")
{
$conf
=
"
debug
";
if
(
-
d
"
debug
")
{
$conf
=
"
debug
";
}
if
(
-
d
"
release
")
{
$conf
=
"
release
";
if
(
-
d
"
release
")
{
$conf
=
"
release
";
}
die
"
Could not find debug or release binaries
"
if
(
$conf
eq
"");
print
"
Installing for
$conf
\n
";
EnsureDirectories
('
bin
','
lib
','
share
','
share/timezonesets
');
EnsureDirectories
('
bin
','
lib
','
share
','
share/timezonesets
');
CopySolutionOutput
(
$conf
,
$target
);
copy
(
$target
.
'
/lib/libpq.dll
',
$target
.
'
/bin/libpq.dll
');
CopySetOfFiles
('
config files
',
"
*.sample
",
$target
.
'
/share/
');
CopySetOfFiles
('
timezone names
',
'
src
\
timezone
\
tznames
\
*.txt
',
$target
.
'
/share/timezonesets/
');
CopyFiles
('
timezone sets
',
$target
.
'
/share/timezonesets/
',
'
src/timezone/tznames/
',
'
Default
','
Australia
','
India
');
CopyFiles
(
'
timezone sets
',
$target
.
'
/share/timezonesets/
',
'
src/timezone/tznames/
',
'
Default
','
Australia
','
India
'
);
CopySetOfFiles
('
BKI files
',
"
src
\\
backend
\\
catalog
\\
postgres.*
",
$target
.
'
/share/
');
CopySetOfFiles
('
SQL files
',
"
src
\\
backend
\\
catalog
\\
*.sql
",
$target
.
'
/share/
');
CopyFiles
('
Information schema data
',
$target
.
'
/share/
',
'
src/backend/catalog/
',
'
sql_features.txt
');
CopyFiles
(
'
Information schema data
',
$target
.
'
/share/
',
'
src/backend/catalog/
',
'
sql_features.txt
'
);
GenerateConversionScript
();
GenerateTimezoneFiles
();
sub
Usage
{
print
"
Usage: install.pl <targetdir>
\n
";
exit
(
1
);
sub
Usage
{
print
"
Usage: install.pl <targetdir>
\n
";
exit
(
1
);
}
sub
EnsureDirectories
{
mkdir
$target
unless
-
d
(
$target
);
while
(
my
$d
=
shift
)
{
mkdir
$target
.
'
/
'
.
$d
unless
-
d
(
$target
.
'
/
'
.
$d
);
}
sub
EnsureDirectories
{
mkdir
$target
unless
-
d
(
$target
);
while
(
my
$d
=
shift
)
{
mkdir
$target
.
'
/
'
.
$d
unless
-
d
(
$target
.
'
/
'
.
$d
);
}
}
sub
CopyFiles
{
my
$what
=
shift
;
my
$target
=
shift
;
my
$basedir
=
shift
;
print
"
Copying
$what
";
while
(
my
$f
=
shift
)
{
print
"
.
";
$f
=
$basedir
.
$f
;
die
"
No file
$f
\n
"
if
(
!
-
f
$f
);
copy
(
$f
,
$target
.
basename
(
$f
))
||
croak
"
Could not copy
$f
to
$target
"
.
basename
(
$f
)
.
"
to
$target
"
.
basename
(
$f
)
.
"
\n
";
}
print
"
\n
";
sub
CopyFiles
{
my
$what
=
shift
;
my
$target
=
shift
;
my
$basedir
=
shift
;
print
"
Copying
$what
";
while
(
my
$f
=
shift
)
{
print
"
.
";
$f
=
$basedir
.
$f
;
die
"
No file
$f
\n
"
if
(
!-
f
$f
);
copy
(
$f
,
$target
.
basename
(
$f
))
||
croak
"
Could not copy
$f
to
$target
"
.
basename
(
$f
)
.
"
to
$target
"
.
basename
(
$f
)
.
"
\n
";
}
print
"
\n
";
}
sub
CopySetOfFiles
{
my
$what
=
shift
;
my
$spec
=
shift
;
my
$target
=
shift
;
my
$D
;
print
"
Copying
$what
";
open
(
$D
,
"
dir /b /s
$spec
|
")
||
croak
"
Could not list
$spec
\n
";
while
(
<
$D
>
)
{
chomp
;
next
if
/regress/
;
# Skip temporary install in regression subdir
my
$tgt
=
$target
.
basename
(
$_
);
print
"
.
";
copy
(
$_
,
$tgt
)
||
croak
"
Could not copy
$_
: $!
\n
";
}
close
(
$D
);
print
"
\n
";
sub
CopySetOfFiles
{
my
$what
=
shift
;
my
$spec
=
shift
;
my
$target
=
shift
;
my
$D
;
print
"
Copying
$what
";
open
(
$D
,
"
dir /b /s
$spec
|
")
||
croak
"
Could not list
$spec
\n
";
while
(
<
$D
>
)
{
chomp
;
next
if
/regress/
;
# Skip temporary install in regression subdir
my
$tgt
=
$target
.
basename
(
$_
);
print
"
.
";
copy
(
$_
,
$tgt
)
||
croak
"
Could not copy
$_
: $!
\n
";
}
close
(
$D
);
print
"
\n
";
}
sub
CopySolutionOutput
{
my
$conf
=
shift
;
my
$target
=
shift
;
my
$rem
=
qr{Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"\) = "([^"]+)"}
;
my
$sln
=
read_file
("
pgsql.sln
")
||
croak
"
Could not open pgsql.sln
\n
";
print
"
Copying build output files...
";
while
(
$sln
=~
$rem
)
{
my
$pf
=
$1
;
my
$dir
;
my
$ext
;
$sln
=~
s/$rem//
;
my
$proj
=
read_file
("
$pf
.vcproj
")
||
croak
"
Could not open
$pf
.vcproj
\n
";
if
(
$proj
!~
qr{ConfigurationType="([^"]+)"}
)
{
croak
"
Could not parse
$pf
.vcproj
\n
";
}
if
(
$1
==
1
)
{
$dir
=
"
bin
";
$ext
=
"
exe
";
}
elsif
(
$1
==
2
)
{
$dir
=
"
lib
";
$ext
=
"
dll
";
}
else
{
# Static lib, such as libpgport, only used internally during build, don't install
next
;
}
copy
("
$conf
\\
$pf
\\
$pf
.
$ext
","
$target
\\
$dir
\\
$pf
.
$ext
")
||
croak
"
Could not copy
$pf
.
$ext
\n
";
print
"
.
";
}
print
"
\n
";
sub
CopySolutionOutput
{
my
$conf
=
shift
;
my
$target
=
shift
;
my
$rem
=
qr{Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"\) = "([^"]+)"}
;
my
$sln
=
read_file
("
pgsql.sln
")
||
croak
"
Could not open pgsql.sln
\n
";
print
"
Copying build output files...
";
while
(
$sln
=~
$rem
)
{
my
$pf
=
$1
;
my
$dir
;
my
$ext
;
$sln
=~
s/$rem//
;
my
$proj
=
read_file
("
$pf
.vcproj
")
||
croak
"
Could not open
$pf
.vcproj
\n
";
if
(
$proj
!~
qr{ConfigurationType="([^"]+)"}
)
{
croak
"
Could not parse
$pf
.vcproj
\n
";
}
if
(
$1
==
1
)
{
$dir
=
"
bin
";
$ext
=
"
exe
";
}
elsif
(
$1
==
2
)
{
$dir
=
"
lib
";
$ext
=
"
dll
";
}
else
{
# Static lib, such as libpgport, only used internally during build, don't install
next
;
}
copy
("
$conf
\\
$pf
\\
$pf
.
$ext
","
$target
\\
$dir
\\
$pf
.
$ext
")
||
croak
"
Could not copy
$pf
.
$ext
\n
";
print
"
.
";
}
print
"
\n
";
}
sub
GenerateConversionScript
{
my
$sql
=
"";
my
$F
;
print
"
Generating conversion proc script...
";
my
$mf
=
read_file
('
src/backend/utils/mb/conversion_procs/Makefile
');
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
$mf
=~
/^CONVERSIONS\s*=\s*(.*)$/m
||
die
"
Could not find CONVERSIONS line in conversions Makefile
\n
";
my
@pieces
=
split
/\s+/
,
$1
;
while
(
$#pieces
>
0
)
{
my
$name
=
shift
@pieces
;
my
$se
=
shift
@pieces
;
my
$de
=
shift
@pieces
;
my
$func
=
shift
@pieces
;
my
$obj
=
shift
@pieces
;
$sql
.=
"
--
$se
-->
$de
\n
";
$sql
.=
"
CREATE OR REPLACE FUNCTION
$func
(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '
\
$libdir
/
$obj
', '
$func
' LANGUAGE C STRICT;
\n
";
$sql
.=
"
DROP CONVERSION pg_catalog.
$name
;
\n
";
$sql
.=
"
CREATE DEFAULT CONVERSION pg_catalog.
$name
FOR '
$se
' TO '
$de
' FROM
$func
;
\n
";
}
open
(
$F
,"
>
$target
/share/conversion_create.sql
")
||
die
"
Could not write to conversion_create.sql
\n
";
print
$F
$sql
;
close
(
$F
);
print
"
\n
";
sub
GenerateConversionScript
{
my
$sql
=
"";
my
$F
;
print
"
Generating conversion proc script...
";
my
$mf
=
read_file
('
src/backend/utils/mb/conversion_procs/Makefile
');
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
$mf
=~
/^CONVERSIONS\s*=\s*(.*)$/m
||
die
"
Could not find CONVERSIONS line in conversions Makefile
\n
";
my
@pieces
=
split
/\s+/
,
$1
;
while
(
$#pieces
>
0
)
{
my
$name
=
shift
@pieces
;
my
$se
=
shift
@pieces
;
my
$de
=
shift
@pieces
;
my
$func
=
shift
@pieces
;
my
$obj
=
shift
@pieces
;
$sql
.=
"
--
$se
-->
$de
\n
";
$sql
.=
"
CREATE OR REPLACE FUNCTION
$func
(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '
\
$libdir
/
$obj
', '
$func
' LANGUAGE C STRICT;
\n
";
$sql
.=
"
DROP CONVERSION pg_catalog.
$name
;
\n
";
$sql
.=
"
CREATE DEFAULT CONVERSION pg_catalog.
$name
FOR '
$se
' TO '
$de
' FROM
$func
;
\n
";
}
open
(
$F
,"
>
$target
/share/conversion_create.sql
")
||
die
"
Could not write to conversion_create.sql
\n
";
print
$F
$sql
;
close
(
$F
);
print
"
\n
";
}
sub
GenerateTimezoneFiles
{
my
$mf
=
read_file
("
src/timezone/Makefile
");
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
$mf
=~
/^TZDATA\s*:?=\s*(.*)$/m
||
die
"
Could not find TZDATA row in timezone makefile
\n
";
my
@tzfiles
=
split
/\s+/
,
$1
;
unshift
@tzfiles
,'';
print
"
Generating timezone files...
";
system
("
$conf
\\
zic
\\
zic -d
$target
/share/timezone
"
.
join
("
src/timezone/data/
",
@tzfiles
));
print
"
\n
";
sub
GenerateTimezoneFiles
{
my
$mf
=
read_file
("
src/timezone/Makefile
");
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
$mf
=~
/^TZDATA\s*:?=\s*(.*)$/m
||
die
"
Could not find TZDATA row in timezone makefile
\n
";
my
@tzfiles
=
split
/\s+/
,
$1
;
unshift
@tzfiles
,'';
print
"
Generating timezone files...
";
system
("
$conf
\\
zic
\\
zic -d
$target
/share/timezone
"
.
join
("
src/timezone/data/
",
@tzfiles
));
print
"
\n
";
}
sub
read_file
{
my
$filename
=
shift
;
my
$F
;
my
$t
=
$/
;
sub
read_file
{
my
$filename
=
shift
;
my
$F
;
my
$t
=
$/
;
undef
$/
;
open
(
$F
,
$filename
)
||
die
"
Could not open file
$filename
\n
";
my
$txt
=
<
$F
>
;
close
(
$F
);
$/
=
$t
;
undef
$/
;
open
(
$F
,
$filename
)
||
die
"
Could not open file
$filename
\n
";
my
$txt
=
<
$F
>
;
close
(
$F
);
$/
=
$t
;
return
$txt
;
return
$txt
;
}
src/tools/msvc/mkvcbuild.pl
View file @
eee22892
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment