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
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
...
...
@@ -4,15 +4,16 @@ use Carp;
use
strict
;
use
warnings
;
sub
new
{
my
(
$junk
,
$name
,
$type
,
$solution
)
=
@_
;
sub
new
{
my
(
$junk
,
$name
,
$type
,
$solution
)
=
@_
;
my
$good_types
=
{
lib
=>
1
,
exe
=>
1
,
dll
=>
1
,
};
confess
("
Bad project type:
$type
\n
")
unless
exists
$good_types
->
{
$type
};
my
$self
=
{
confess
("
Bad project type:
$type
\n
")
unless
exists
$good_types
->
{
$type
};
my
$self
=
{
name
=>
$name
,
type
=>
$type
,
guid
=>
Win32::
GuidGen
(),
...
...
@@ -22,362 +23,444 @@ sub new {
suffixlib
=>
[]
,
includes
=>
'',
defines
=>
'
;
',
solution
=>
$solution
,
solution
=>
$solution
,
disablewarnings
=>
'
4018;4244;4273;4102
',
disablelinkerwarnings
=>
''
};
bless
$self
;
return
$self
;
bless
$self
;
return
$self
;
}
sub
AddFile
{
my
(
$self
,
$filename
)
=
@_
;
sub
AddFile
{
my
(
$self
,
$filename
)
=
@_
;
$self
->
{
files
}
->
{
$filename
}
=
1
;
$self
->
{
files
}
->
{
$filename
}
=
1
;
}
sub
AddFiles
{
my
$self
=
shift
;
my
$dir
=
shift
;
sub
AddFiles
{
my
$self
=
shift
;
my
$dir
=
shift
;
while
(
my
$f
=
shift
)
{
$self
->
{
files
}
->
{
$dir
.
"
\\
"
.
$f
}
=
1
;
}
while
(
my
$f
=
shift
)
{
$self
->
{
files
}
->
{
$dir
.
"
\\
"
.
$f
}
=
1
;
}
}
sub
ReplaceFile
{
my
(
$self
,
$filename
,
$newname
)
=
@_
;
my
$re
=
"
\\\\
$filename
\
$
";
sub
ReplaceFile
{
my
(
$self
,
$filename
,
$newname
)
=
@_
;
my
$re
=
"
\\\\
$filename
\
$
";
foreach
my
$file
(
keys
%
{
$self
->
{
files
}
}
)
{
foreach
my
$file
(
keys
%
{
$self
->
{
files
}
}
)
{
# Match complete filename
if
(
$filename
=~
/\\/
)
{
if
(
$file
eq
$filename
)
{
if
(
$filename
=~
/\\/
)
{
if
(
$file
eq
$filename
)
{
delete
$self
->
{
files
}{
$file
};
$self
->
{
files
}{
$newname
}
=
1
;
return
;
}
}
elsif
(
$file
=~
m/($re)/
)
{
return
;
}
}
elsif
(
$file
=~
m/($re)/
)
{
delete
$self
->
{
files
}{
$file
};
$self
->
{
files
}{
"
$newname
\\
$filename
"
}
=
1
;
return
;
}
}
confess
("
Could not find file
$filename
to replace
\n
");
$self
->
{
files
}{
"
$newname
\\
$filename
"
}
=
1
;
return
;
}
}
confess
("
Could not find file
$filename
to replace
\n
");
}
sub
RemoveFile
{
my
(
$self
,
$filename
)
=
@_
;
sub
RemoveFile
{
my
(
$self
,
$filename
)
=
@_
;
my
$orig
=
scalar
keys
%
{
$self
->
{
files
}
};
delete
$self
->
{
files
}
->
{
$filename
};
if
(
$orig
>
scalar
keys
%
{
$self
->
{
files
}}
)
{
if
(
$orig
>
scalar
keys
%
{
$self
->
{
files
}}
)
{
return
;
}
confess
("
Could not find file
$filename
to remove
\n
");
confess
("
Could not find file
$filename
to remove
\n
");
}
sub
AddReference
{
my
$self
=
shift
;
sub
AddReference
{
my
$self
=
shift
;
while
(
my
$ref
=
shift
)
{
push
@
{
$self
->
{
references
}},
$ref
;
$self
->
AddLibrary
("
__CFGNAME__
\\
"
.
$ref
->
{
name
}
.
"
\\
"
.
$ref
->
{
name
}
.
"
.lib
");
}
while
(
my
$ref
=
shift
)
{
push
@
{
$self
->
{
references
}},
$ref
;
$self
->
AddLibrary
("
__CFGNAME__
\\
"
.
$ref
->
{
name
}
.
"
\\
"
.
$ref
->
{
name
}
.
"
.lib
");
}
}
sub
AddLibrary
{
my
(
$self
,
$lib
,
$dbgsuffix
)
=
@_
;
sub
AddLibrary
{
my
(
$self
,
$lib
,
$dbgsuffix
)
=
@_
;
push
@
{
$self
->
{
libraries
}},
$lib
;
if
(
$dbgsuffix
)
{
push
@
{
$self
->
{
suffixlib
}},
$lib
;
}
push
@
{
$self
->
{
libraries
}},
$lib
;
if
(
$dbgsuffix
)
{
push
@
{
$self
->
{
suffixlib
}},
$lib
;
}
}
sub
AddIncludeDir
{
my
(
$self
,
$inc
)
=
@_
;
sub
AddIncludeDir
{
my
(
$self
,
$inc
)
=
@_
;
if
(
$self
->
{
includes
}
ne
'')
{
$self
->
{
includes
}
.=
'
;
';
}
$self
->
{
includes
}
.=
$inc
;
if
(
$self
->
{
includes
}
ne
'')
{
$self
->
{
includes
}
.=
'
;
';
}
$self
->
{
includes
}
.=
$inc
;
}
sub
AddDefine
{
my
(
$self
,
$def
)
=
@_
;
sub
AddDefine
{
my
(
$self
,
$def
)
=
@_
;
$def
=~
s/"/""/g
;
$self
->
{
defines
}
.=
$def
.
'
;
';
$def
=~
s/"/""/g
;
$self
->
{
defines
}
.=
$def
.
'
;
';
}
sub
FullExportDLL
{
my
(
$self
,
$libname
)
=
@_
;
sub
FullExportDLL
{
my
(
$self
,
$libname
)
=
@_
;
$self
->
{
builddef
}
=
1
;
$self
->
{
def
}
=
"
.
\\
__CFGNAME__
\\
$self
->{name}
\\
$self
->{name}.def
";
$self
->
{
implib
}
=
"
__CFGNAME__
\\
$self
->{name}
\\
$libname
";
$self
->
{
builddef
}
=
1
;
$self
->
{
def
}
=
"
.
\\
__CFGNAME__
\\
$self
->{name}
\\
$self
->{name}.def
";
$self
->
{
implib
}
=
"
__CFGNAME__
\\
$self
->{name}
\\
$libname
";
}
sub
UseDef
{
my
(
$self
,
$def
)
=
@_
;
sub
UseDef
{
my
(
$self
,
$def
)
=
@_
;
$self
->
{
def
}
=
$def
;
$self
->
{
def
}
=
$def
;
}
sub
AddDir
{
my
(
$self
,
$reldir
)
=
@_
;
my
$MF
;
my
$t
=
$/
;
undef
$/
;
open
(
$MF
,"
$reldir
\\
Makefile
")
||
open
(
$MF
,"
$reldir
\\
GNUMakefile
")
||
croak
"
Could not open
$reldir
\\
Makefile
\n
";
my
$mf
=
<
$MF
>
;
close
(
$MF
);
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
if
(
$mf
=~
m{^(?:SUB)?DIRS[^=]*=\s*(.*)$}mg
)
{
foreach
my
$subdir
(
split
/\s+/
,
$1
)
{
next
if
$subdir
eq
"
\
$(top_builddir)/src/timezone
";
#special case for non-standard include
$self
->
AddDir
(
$reldir
.
"
\\
"
.
$subdir
);
}
}
while
(
$mf
=~
m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m
)
{
my
$s
=
$1
;
my
$filter_re
=
qr{\$\(filter ([^,]+),\s+\$\(([^\)]+)\)\)}
;
while
(
$s
=~
/$filter_re/
)
{
# Process $(filter a b c, $(VAR)) expressions
my
$list
=
$1
;
my
$filter
=
$2
;
$list
=~
s/\.o/\.c/g
;
my
@pieces
=
split
/\s+/
,
$list
;
my
$matches
=
"";
foreach
my
$p
(
@pieces
)
{
if
(
$filter
eq
"
LIBOBJS
")
{
if
(
grep
(
/$p/
,
@
main::
pgportfiles
)
==
1
)
{
$p
=~
s/\.c/\.o/
;
$matches
.=
$p
.
"
";
}
}
else
{
confess
"
Unknown filter
$filter
\n
";
}
}
$s
=~
s/$filter_re/$matches/
;
}
foreach
my
$f
(
split
/\s+/
,
$s
)
{
next
if
$f
=~
/^\s*$/
;
next
if
$f
eq
"
\\
";
next
if
$f
=~
/\/SUBSYS.o$/
;
$f
=~
s/,$//
;
# Remove trailing comma that can show up from filter stuff
next
unless
$f
=~
/.*\.o$/
;
$f
=~
s/\.o$/\.c/
;
if
(
$f
=~
/^\$\(top_builddir\)\/(.*)/
)
{
$f
=
$1
;
$f
=~
s/\//\\/g
;
$self
->
{
files
}
->
{
$f
}
=
1
;
}
else
{
$f
=~
s/\//\\/g
;
$self
->
{
files
}
->
{"
$reldir
\\
$f
"}
=
1
;
}
}
$mf
=~
s{OBJS[^=]*=\s*(.*)$}{}m
;
}
# Match rules that pull in source files from different directories
my
$replace_re
=
qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+$}
;
while
(
$mf
=~
m{$replace_re}m
)
{
my
$match
=
$1
;
my
$top
=
$2
;
my
$target
=
$3
;
$target
=~
s{/}{\\}g
;
my
@pieces
=
split
/\s+/
,
$match
;
foreach
my
$fn
(
@pieces
)
{
if
(
$top
eq
"
(top_srcdir)
")
{
eval
{
$self
->
ReplaceFile
(
$fn
,
$target
)
};
}
elsif
(
$top
eq
"
(backend_src)
")
{
eval
{
$self
->
ReplaceFile
(
$fn
,
"
src
\\
backend
\\
$target
")
};
}
else
{
confess
"
Bad replacement top:
$top
, on line
$_
\n
";
}
}
$mf
=~
s{$replace_re}{}m
;
}
# See if this Makefile contains a description, and should have a RC file
if
(
$mf
=~
/^PGFILEDESC\s*=\s*\"([^\"]+)\"/m
)
{
my
$desc
=
$1
;
my
$ico
;
if
(
$mf
=~
/^PGAPPICON\s*=\s*(.*)$/m
)
{
$ico
=
$1
;
}
$self
->
AddResourceFile
(
$reldir
,
$desc
,
$ico
);
}
$/
=
$t
;
sub
AddDir
{
my
(
$self
,
$reldir
)
=
@_
;
my
$MF
;
my
$t
=
$/
;
undef
$/
;
open
(
$MF
,"
$reldir
\\
Makefile
")
||
open
(
$MF
,"
$reldir
\\
GNUMakefile
")
||
croak
"
Could not open
$reldir
\\
Makefile
\n
";
my
$mf
=
<
$MF
>
;
close
(
$MF
);
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
if
(
$mf
=~
m{^(?:SUB)?DIRS[^=]*=\s*(.*)$}mg
)
{
foreach
my
$subdir
(
split
/\s+/
,
$1
)
{
next
if
$subdir
eq
"
\
$(top_builddir)/src/timezone
";
#special case for non-standard include
$self
->
AddDir
(
$reldir
.
"
\\
"
.
$subdir
);
}
}
while
(
$mf
=~
m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m
)
{
my
$s
=
$1
;
my
$filter_re
=
qr{\$\(filter ([^,]+),\s+\$\(([^\)]+)\)\)}
;
while
(
$s
=~
/$filter_re/
)
{
# Process $(filter a b c, $(VAR)) expressions
my
$list
=
$1
;
my
$filter
=
$2
;
$list
=~
s/\.o/\.c/g
;
my
@pieces
=
split
/\s+/
,
$list
;
my
$matches
=
"";
foreach
my
$p
(
@pieces
)
{
if
(
$filter
eq
"
LIBOBJS
")
{
if
(
grep
(
/$p/
,
@
main::
pgportfiles
)
==
1
)
{
$p
=~
s/\.c/\.o/
;
$matches
.=
$p
.
"
";
}
}
else
{
confess
"
Unknown filter
$filter
\n
";
}
}
$s
=~
s/$filter_re/$matches/
;
}
foreach
my
$f
(
split
/\s+/
,
$s
)
{
next
if
$f
=~
/^\s*$/
;
next
if
$f
eq
"
\\
";
next
if
$f
=~
/\/SUBSYS.o$/
;
$f
=~
s/,$//
;
# Remove trailing comma that can show up from filter stuff
next
unless
$f
=~
/.*\.o$/
;
$f
=~
s/\.o$/\.c/
;
if
(
$f
=~
/^\$\(top_builddir\)\/(.*)/
)
{
$f
=
$1
;
$f
=~
s/\//\\/g
;
$self
->
{
files
}
->
{
$f
}
=
1
;
}
else
{
$f
=~
s/\//\\/g
;
$self
->
{
files
}
->
{"
$reldir
\\
$f
"}
=
1
;
}
}
$mf
=~
s{OBJS[^=]*=\s*(.*)$}{}m
;
}
# Match rules that pull in source files from different directories
my
$replace_re
=
qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+$}
;
while
(
$mf
=~
m{$replace_re}m
)
{
my
$match
=
$1
;
my
$top
=
$2
;
my
$target
=
$3
;
$target
=~
s{/}{\\}g
;
my
@pieces
=
split
/\s+/
,
$match
;
foreach
my
$fn
(
@pieces
)
{
if
(
$top
eq
"
(top_srcdir)
")
{
eval
{
$self
->
ReplaceFile
(
$fn
,
$target
)
};
}
elsif
(
$top
eq
"
(backend_src)
")
{
eval
{
$self
->
ReplaceFile
(
$fn
,
"
src
\\
backend
\\
$target
")
};
}
else
{
confess
"
Bad replacement top:
$top
, on line
$_
\n
";
}
}
$mf
=~
s{$replace_re}{}m
;
}
# See if this Makefile contains a description, and should have a RC file
if
(
$mf
=~
/^PGFILEDESC\s*=\s*\"([^\"]+)\"/m
)
{
my
$desc
=
$1
;
my
$ico
;
if
(
$mf
=~
/^PGAPPICON\s*=\s*(.*)$/m
)
{
$ico
=
$1
;
}
$self
->
AddResourceFile
(
$reldir
,
$desc
,
$ico
);
}
$/
=
$t
;
}
sub
AddResourceFile
{
my
(
$self
,
$dir
,
$desc
,
$ico
)
=
@_
;
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
,
$isdst
)
=
localtime
(
time
);
my
$d
=
(
$year
-
100
)
.
"
$yday
";
if
(
Solution::
IsNewer
("
$dir
\\
win32ver.rc
",'
src
\
port
\
win32ver.rc
'))
{
print
"
Generating win32ver.rc for
$dir
\n
";
open
(
I
,'
src
\
port
\
win32ver.rc
')
||
confess
"
Could not open win32ver.rc
";
open
(
O
,"
>
$dir
\\
win32ver.rc
")
||
confess
"
Could not write win32ver.rc
";
my
$icostr
=
$ico
?"
IDI_ICON ICON
\"
src/port/
$ico
.ico
\"
":"";
while
(
<
I
>
)
{
s/FILEDESC/"$desc"/gm
;
s/_ICO_/$icostr/gm
;
s/(VERSION.*),0/$1,$d/
;
if
(
$self
->
{
type
}
eq
"
dll
")
{
s/VFT_APP/VFT_DLL/gm
;
}
print
O
;
}
}
close
(
O
);
close
(
I
);
$self
->
AddFile
("
$dir
\\
win32ver.rc
");
sub
AddResourceFile
{
my
(
$self
,
$dir
,
$desc
,
$ico
)
=
@_
;
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
,
$isdst
)
=
localtime
(
time
);
my
$d
=
(
$year
-
100
)
.
"
$yday
";
if
(
Solution::
IsNewer
("
$dir
\\
win32ver.rc
",'
src
\
port
\
win32ver.rc
'))
{
print
"
Generating win32ver.rc for
$dir
\n
";
open
(
I
,'
src
\
port
\
win32ver.rc
')
||
confess
"
Could not open win32ver.rc
";
open
(
O
,"
>
$dir
\\
win32ver.rc
")
||
confess
"
Could not write win32ver.rc
";
my
$icostr
=
$ico
?"
IDI_ICON ICON
\"
src/port/
$ico
.ico
\"
":"";
while
(
<
I
>
)
{
s/FILEDESC/"$desc"/gm
;
s/_ICO_/$icostr/gm
;
s/(VERSION.*),0/$1,$d/
;
if
(
$self
->
{
type
}
eq
"
dll
")
{
s/VFT_APP/VFT_DLL/gm
;
}
print
O
;
}
}
close
(
O
);
close
(
I
);
$self
->
AddFile
("
$dir
\\
win32ver.rc
");
}
sub
DisableLinkerWarnings
{
my
(
$self
,
$warnings
)
=
@_
;
sub
DisableLinkerWarnings
{
my
(
$self
,
$warnings
)
=
@_
;
$self
->
{
disablelinkerwarnings
}
.=
'
;
'
unless
(
$self
->
{
disablelinkerwarnings
}
eq
'');
$self
->
{
disablelinkerwarnings
}
.=
$warnings
;
$self
->
{
disablelinkerwarnings
}
.=
'
;
'
unless
(
$self
->
{
disablelinkerwarnings
}
eq
'');
$self
->
{
disablelinkerwarnings
}
.=
$warnings
;
}
sub
Save
{
my
(
$self
)
=
@_
;
sub
Save
{
my
(
$self
)
=
@_
;
# If doing DLL and haven't specified a DEF file, do a full export of all symbols
# in the project.
if
(
$self
->
{
type
}
eq
"
dll
"
&&
!
$self
->
{
def
})
{
$self
->
FullExportDLL
(
$self
->
{
name
}
.
"
.lib
");
}
# If doing DLL and haven't specified a DEF file, do a full export of all symbols
# in the project.
if
(
$self
->
{
type
}
eq
"
dll
"
&&
!
$self
->
{
def
})
{
$self
->
FullExportDLL
(
$self
->
{
name
}
.
"
.lib
");
}
# Dump the project
open
(
F
,
"
>
$self
->{name}.vcproj
")
||
croak
("
Could not write to
$self
->{name}.vcproj
\n
");
$self
->
WriteHeader
(
*
F
);
$self
->
WriteReferences
(
*
F
);
print
F
<<EOF;
# Dump the project
open
(
F
,
"
>
$self
->{name}.vcproj
")
||
croak
("
Could not write to
$self
->{name}.vcproj
\n
");
$self
->
WriteHeader
(
*
F
);
$self
->
WriteReferences
(
*
F
);
print
F
<<EOF;
<Files>
EOF
my
@dirstack
=
();
my
%
uniquefiles
;
foreach
my
$f
(
sort
keys
%
{
$self
->
{
files
}
})
{
confess
"
Bad format filename '
$f
'
\n
"
unless
(
$f
=~
/^(.*)\\([^\\]+)\.[r]?[cyl]$/
);
my
$dir
=
$1
;
my
$file
=
$2
;
# Walk backwards down the directory stack and close any dirs we're done with
while
(
$#dirstack
>=
0
)
{
if
(
join
('
\
\'
,@dirstack) eq substr($dir, 0, length(join(
'
\\
'
,@dirstack)))) {
last if (length($dir) == length(join(
'
\\
'
,@dirstack)));
last if (substr($dir, length(join(
'
\\
'
,@dirstack)),1) eq
'
\\
'
);
}
print F
'
'
x $#dirstack . " </Filter>
\
n";
pop @dirstack;
}
# Now walk forwards and create whatever directories are needed
while (join(
'
\\
'
,@dirstack) ne $dir) {
my $left = substr($dir, length(join(
'
\\
'
,@dirstack)));
$left =~ s/^
\\
//;
my @pieces = split /
\\
/, $left;
push @dirstack, $pieces[0];
print F
'
'
x $#dirstack . " <Filter Name=
\
"$pieces[0]
\
" Filter=
\
"
\
">
\
n";
}
print F
'
'
x $#dirstack . " <File RelativePath=
\
"$f
\
"";
if ($f =~ /
\
.y$/) {
my $of = $f;
$of =~ s/
\
.y$/.c/;
$of =~ s{^src
\\
pl
\\
plpgsql
\\
src
\\
gram.c$}{src
\\
pl
\\
plpgsql
\\
src
\\
pl_gram.c};
print F
'
>
'
. GenerateCustomTool(
'
Running
bison
on
'
. $f,
'
cmd
/V:ON /c
src
\
tools
\
msvc
\
pgbison
.
bat
'
. $f, $of) .
'
</
File
>
'
. "
\
n";
}
elsif ($f =~ /
\
.l$/) {
my $of = $f;
$of =~ s/
\
.l$/.c/;
$of =~ s{^src
\\
pl
\\
plpgsql
\\
src
\\
scan.c$}{src
\\
pl
\\
plpgsql
\\
src
\\
pl_scan.c};
print F
'
>
'
. GenerateCustomTool(
'
Running
flex
on
'
. $f,
'
src
\
tools
\
msvc
\
pgflex
.
bat
'
. $f,$of) .
'
</
File
>
'
. "
\
n";
}
elsif (defined($uniquefiles{$file})) {
# File already exists, so fake a new name
my $obj = $dir;
$obj =~ s/
\\
/_/g;
print F "><FileConfiguration Name=
\
"Debug|Win32
\
"><Tool Name=
\
"VCCLCompilerTool
\
" ObjectFile=
\
".
\\
debug
\\
$self->{name}
\\
$obj" . "_$file.obj
\
" /></FileConfiguration><FileConfiguration Name=
\
"Release|Win32
\
"><Tool Name=
\
"VCCLCompilerTool
\
" ObjectFile=
\
".
\\
release
\\
$self->{name}
\\
$obj" . "_$file.obj
\
" /></FileConfiguration></File>
\
n";
}
else {
$uniquefiles{$file} = 1;
print F " />
\
n";
}
}
while ($#dirstack >= 0) {
print F
'
'
x $#dirstack . " </Filter>
\
n";
pop @dirstack;
}
$self->Footer(*F);
close(F);
my
@dirstack
=
();
my
%
uniquefiles
;
foreach
my
$f
(
sort
keys
%
{
$self
->
{
files
}
})
{
confess
"
Bad format filename '
$f
'
\n
"
unless
(
$f
=~
/^(.*)\\([^\\]+)\.[r]?[cyl]$/
);
my
$dir
=
$1
;
my
$file
=
$2
;
# Walk backwards down the directory stack and close any dirs we're done with
while
(
$#dirstack
>=
0
)
{
if
(
join
('
\
\'
,@dirstack) eq substr($dir, 0, length(join(
'
\\
'
,@dirstack))))
{
last if (length($dir) == length(join(
'
\\
'
,@dirstack)));
last if (substr($dir, length(join(
'
\\
'
,@dirstack)),1) eq
'
\\
'
);
}
print F
'
'
x $#dirstack . " </Filter>
\
n";
pop @dirstack;
}
# Now walk forwards and create whatever directories are needed
while (join(
'
\\
'
,@dirstack) ne $dir)
{
my $left = substr($dir, length(join(
'
\\
'
,@dirstack)));
$left =~ s/^
\\
//;
my @pieces = split /
\\
/, $left;
push @dirstack, $pieces[0];
print F
'
'
x $#dirstack . " <Filter Name=
\
"$pieces[0]
\
" Filter=
\
"
\
">
\
n";
}
print F
'
'
x $#dirstack . " <File RelativePath=
\
"$f
\
"";
if ($f =~ /
\
.y$/)
{
my $of = $f;
$of =~ s/
\
.y$/.c/;
$of =~ s{^src
\\
pl
\\
plpgsql
\\
src
\\
gram.c$}{src
\\
pl
\\
plpgsql
\\
src
\\
pl_gram.c};
print F
'
>
'
. GenerateCustomTool(
'
Running
bison
on
'
. $f,
'
cmd
/V:ON /c
src
\
tools
\
msvc
\
pgbison
.
bat
'
. $f, $of)
.
'
</
File
>
'
. "
\
n";
}
elsif ($f =~ /
\
.l$/)
{
my $of = $f;
$of =~ s/
\
.l$/.c/;
$of =~ s{^src
\\
pl
\\
plpgsql
\\
src
\\
scan.c$}{src
\\
pl
\\
plpgsql
\\
src
\\
pl_scan.c};
print F
'
>
'
. GenerateCustomTool(
'
Running
flex
on
'
. $f,
'
src
\
tools
\
msvc
\
pgflex
.
bat
'
. $f,$of)
.
'
</
File
>
'
. "
\
n";
}
elsif (defined($uniquefiles{$file}))
{
# File already exists, so fake a new name
my $obj = $dir;
$obj =~ s/
\\
/_/g;
print F
"><FileConfiguration Name=
\
"Debug|Win32
\
"><Tool Name=
\
"VCCLCompilerTool
\
" ObjectFile=
\
".
\\
debug
\\
$self->{name}
\\
$obj"
. "_$file.obj
\
" /></FileConfiguration><FileConfiguration Name=
\
"Release|Win32
\
"><Tool Name=
\
"VCCLCompilerTool
\
" ObjectFile=
\
".
\\
release
\\
$self->{name}
\\
$obj"
. "_$file.obj
\
" /></FileConfiguration></File>
\
n";
}
else
{
$uniquefiles{$file} = 1;
print F " />
\
n";
}
}
while ($#dirstack >= 0)
{
print F
'
'
x $#dirstack . " </Filter>
\
n";
pop @dirstack;
}
$self->Footer(*F);
close(F);
}
sub GenerateCustomTool {
my ($desc, $tool, $output, $cfg) = @_;
if (!defined($cfg)) {
return GenerateCustomTool($desc, $tool, $output,
'
Debug
'
) .
GenerateCustomTool($desc, $tool, $output,
'
Release
'
);
}
return "<FileConfiguration Name=
\
"$cfg|Win32
\
"><Tool Name=
\
"VCCustomBuildTool
\
" Description=
\
"$desc
\
" CommandLine=
\
"$tool
\
" AdditionalDependencies=
\
"
\
" Outputs=
\
"$output
\
" /></FileConfiguration>";
sub GenerateCustomTool
{
my ($desc, $tool, $output, $cfg) = @_;
if (!defined($cfg))
{
return GenerateCustomTool($desc, $tool, $output,
'
Debug
'
)
.GenerateCustomTool($desc, $tool, $output,
'
Release
'
);
}
return
"<FileConfiguration Name=
\
"$cfg|Win32
\
"><Tool Name=
\
"VCCustomBuildTool
\
" Description=
\
"$desc
\
" CommandLine=
\
"$tool
\
" AdditionalDependencies=
\
"
\
" Outputs=
\
"$output
\
" /></FileConfiguration>";
}
sub WriteReferences {
my ($self, $f) = @_;
print $f " <References>
\
n";
foreach my $ref (@{$self->{references}}) {
print $f " <ProjectReference ReferencedProjectIdentifier=
\
"$ref->{guid}
\
" Name=
\
"$ref->{name}
\
" />
\
n";
}
print $f " </References>
\
n";
sub WriteReferences
{
my ($self, $f) = @_;
print $f " <References>
\
n";
foreach my $ref (@{$self->{references}})
{
print $f
" <ProjectReference ReferencedProjectIdentifier=
\
"$ref->{guid}
\
" Name=
\
"$ref->{name}
\
" />
\
n";
}
print $f " </References>
\
n";
}
sub WriteHeader {
my ($self, $f) = @_;
sub WriteHeader
{
my ($self, $f) = @_;
print $f <<EOF;
print $f <<EOF;
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject ProjectType="Visual C++" Version="8.00" Name="$self->{name}" ProjectGUID="$self->{guid}">
<Platforms><Platform Name="Win32"/></Platforms>
<Configurations>
EOF
$self->WriteConfiguration($f,
'
Debug
'
, { defs=>
'
_DEBUG
;
DEBUG
=
1
;'
, wholeopt=>0 , opt=>0, strpool=>
'
false
'
, runtime=>3 });
$self->WriteConfiguration($f,
'
Release
'
, { defs=>
''
, wholeopt=>0, opt=>3, strpool=>
'
true
'
, runtime=>2 });
print $f <<EOF;
$self->WriteConfiguration($f,
'
Debug
'
,
{ defs=>
'
_DEBUG
;
DEBUG
=
1
;'
, wholeopt=>0, opt=>0, strpool=>
'
false
'
, runtime=>3 });
$self->WriteConfiguration($f,
'
Release
'
,
{ defs=>
''
, wholeopt=>0, opt=>3, strpool=>
'
true
'
, runtime=>2 });
print $f <<EOF;
</Configurations>
EOF
}
sub WriteConfiguration
{
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;
my $pth = $self->{solution}->{options}->{pthread};
$pth =
''
unless $pth;
print $f <<EOF;
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;
my $pth = $self->{solution}->{options}->{pthread};
$pth =
''
unless $pth;
print $f <<EOF;
<Configuration Name="$cfgname|Win32" OutputDirectory=".
\\
$cfgname
\\
$self->{name}" IntermediateDirectory=".
\\
$cfgname
\\
$self->{name}"
ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
...
...
@@ -386,7 +469,7 @@ sub WriteConfiguration
StringPooling="$p->{strpool}"
RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
EOF
print $f <<EOF;
print $f <<EOF;
AssemblerOutput="0" AssemblerListingLocation=".
\\
$cfgname
\\
$self->{name}
\\
" ObjectFile=".
\\
$cfgname
\\
$self->{name}
\\
"
ProgramDataBaseFileName=".
\\
$cfgname
\\
$self->{name}
\\
" BrowseInformation="0"
WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="3" CompileAs="0"/>
...
...
@@ -398,55 +481,63 @@ EOF
GenerateMapFile="FALSE" MapFileName=".
\\
$cfgname
\\
$self->{name}
\\
$self->{name}.map"
SubSystem="1" TargetMachine="1"
EOF
if ($self->{disablelinkerwarnings}) {
print $f "
\
t
\
tAdditionalOptions=
\
"/ignore:$self->{disablelinkerwarnings}
\
"
\
n";
}
if ($self->{implib}) {
my $l = $self->{implib};
$l =~ s/__CFGNAME__/$cfgname/g;
print $f "
\
t
\
tImportLibrary=
\
"$l
\
"
\
n";
}
if ($self->{def}) {
my $d = $self->{def};
$d =~ s/__CFGNAME__/$cfgname/g;
print $f "
\
t
\
tModuleDefinitionFile=
\
"$d
\
"
\
n";
}
print $f "
\
t/>
\
n";
print $f "
\
t<Tool Name=
\
"VCLibrarianTool
\
" OutputFile=
\
".
\\
$cfgname
\\
$self->{name}
\\
$self->{name}.lib
\
" IgnoreDefaultLibraryNames=
\
"libc
\
" />
\
n";
print $f "
\
t<Tool Name=
\
"VCResourceCompilerTool
\
" AdditionalIncludeDirectories=
\
"src
\\
include
\
" />
\
n";
if ($self->{builddef}) {
print $f "
\
t<Tool Name=
\
"VCPreLinkEventTool
\
" Description=
\
"Generate DEF file
\
" CommandLine=
\
"perl src
\\
tools
\\
msvc
\\
gendef.pl $cfgname
\\
$self->{name}
\
" />
\
n";
}
print $f <<EOF;
if ($self->{disablelinkerwarnings})
{
print $f "
\
t
\
tAdditionalOptions=
\
"/ignore:$self->{disablelinkerwarnings}
\
"
\
n";
}
if ($self->{implib})
{
my $l = $self->{implib};
$l =~ s/__CFGNAME__/$cfgname/g;
print $f "
\
t
\
tImportLibrary=
\
"$l
\
"
\
n";
}
if ($self->{def})
{
my $d = $self->{def};
$d =~ s/__CFGNAME__/$cfgname/g;
print $f "
\
t
\
tModuleDefinitionFile=
\
"$d
\
"
\
n";
}
print $f "
\
t/>
\
n";
print $f
"
\
t<Tool Name=
\
"VCLibrarianTool
\
" OutputFile=
\
".
\\
$cfgname
\\
$self->{name}
\\
$self->{name}.lib
\
" IgnoreDefaultLibraryNames=
\
"libc
\
" />
\
n";
print $f
"
\
t<Tool Name=
\
"VCResourceCompilerTool
\
" AdditionalIncludeDirectories=
\
"src
\\
include
\
" />
\
n";
if ($self->{builddef})
{
print $f
"
\
t<Tool Name=
\
"VCPreLinkEventTool
\
" Description=
\
"Generate DEF file
\
" CommandLine=
\
"perl src
\\
tools
\\
msvc
\\
gendef.pl $cfgname
\\
$self->{name}
\
" />
\
n";
}
print $f <<EOF;
</Configuration>
EOF
}
sub Footer {
my ($self, $f) = @_;
sub Footer
{
my ($self, $f) = @_;
print $f <<EOF;
print $f <<EOF;
</Files>
<Globals/>
</VisualStudioProject>
EOF
}
# Utility function that loads a complete file
sub read_file {
my $filename = shift;
my $F;
my $t = $/;
undef $/;
open($F, $filename) || croak "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) || croak "Could not open file $filename
\
n";
my $txt = <$F>;
close($F);
$/ = $t;
return $txt;
}
1;
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
...
...
@@ -3,205 +3,243 @@ use Carp;
use
strict
;
use
warnings
;
sub
new
{
my
$junk
=
shift
;
my
$options
=
shift
;
my
$self
=
{
sub
new
{
my
$junk
=
shift
;
my
$options
=
shift
;
my
$self
=
{
projects
=>
{},
options
=>
$options
,
numver
=>
'',
strver
=>
'',
};
bless
$self
;
if
(
$options
->
{
xml
})
{
if
(
!
(
$options
->
{
xslt
}
&&
$options
->
{
iconv
}))
{
die
"
XML requires both XSLT and ICONV
\n
";
}
}
return
$self
;
bless
$self
;
if
(
$options
->
{
xml
})
{
if
(
!
(
$options
->
{
xslt
}
&&
$options
->
{
iconv
}))
{
die
"
XML requires both XSLT and ICONV
\n
";
}
}
return
$self
;
}
# Return 1 if $oldfile is newer than $newfile, or if $newfile doesn't exist.
# Special case - if config.pl has changed, always return 1
sub
IsNewer
{
my
(
$newfile
,
$oldfile
)
=
@_
;
if
(
$oldfile
ne
'
src
\
tools
\
msvc
\
config.pl
')
{
return
1
if
IsNewer
(
$newfile
,
'
src
\
tools
\
msvc
\
config.pl
');
}
return
1
if
(
!
(
-
e
$newfile
));
my
@nstat
=
stat
(
$newfile
);
my
@ostat
=
stat
(
$oldfile
);
return
1
if
(
$nstat
[
9
]
<
$ostat
[
9
]);
return
0
;
sub
IsNewer
{
my
(
$newfile
,
$oldfile
)
=
@_
;
if
(
$oldfile
ne
'
src
\
tools
\
msvc
\
config.pl
')
{
return
1
if
IsNewer
(
$newfile
,
'
src
\
tools
\
msvc
\
config.pl
');
}
return
1
if
(
!
(
-
e
$newfile
));
my
@nstat
=
stat
(
$newfile
);
my
@ostat
=
stat
(
$oldfile
);
return
1
if
(
$nstat
[
9
]
<
$ostat
[
9
]);
return
0
;
}
# Copy a file, *not* preserving date. Only works for text files.
sub
copyFile
{
my
(
$src
,
$dest
)
=
@_
;
open
(
I
,
$src
)
||
croak
"
Could not open
$src
";
open
(
O
,"
>
$dest
")
||
croak
"
Could not open
$dest
";
while
(
<
I
>
)
{
print
O
;
}
close
(
I
);
close
(
O
);
sub
copyFile
{
my
(
$src
,
$dest
)
=
@_
;
open
(
I
,
$src
)
||
croak
"
Could not open
$src
";
open
(
O
,"
>
$dest
")
||
croak
"
Could not open
$dest
";
while
(
<
I
>
)
{
print
O
;
}
close
(
I
);
close
(
O
);
}
sub
GenerateFiles
{
my
$self
=
shift
;
sub
GenerateFiles
{
my
$self
=
shift
;
# Parse configure.in to get version numbers
open
(
C
,"
configure.in
")
||
confess
("
Could not open configure.in for reading
\n
");
while
(
<
C
>
)
{
if
(
/^AC_INIT\(\[PostgreSQL\], \[([^\]]+)\]/
)
{
$self
->
{
strver
}
=
$1
;
if
(
$self
->
{
strver
}
!~
/^(\d+)\.(\d+)(?:\.(\d+))?/
)
{
confess
"
Bad format of version:
$self
->{strver}
\n
"
}
$self
->
{
numver
}
=
sprintf
("
%d%02d%02d
",
$1
,
$2
,
$3
?
$3:0
);
$self
->
{
majorver
}
=
sprintf
("
%d.%d
",
$1
,
$2
);
}
}
close
(
C
);
confess
"
Unable to parse configure.in for all variables!
"
if
(
$self
->
{
strver
}
eq
''
||
$self
->
{
numver
}
eq
'');
# Parse configure.in to get version numbers
open
(
C
,"
configure.in
")
||
confess
("
Could not open configure.in for reading
\n
");
while
(
<
C
>
)
{
if
(
/^AC_INIT\(\[PostgreSQL\], \[([^\]]+)\]/
)
{
$self
->
{
strver
}
=
$1
;
if
(
$self
->
{
strver
}
!~
/^(\d+)\.(\d+)(?:\.(\d+))?/
)
{
confess
"
Bad format of version:
$self
->{strver}
\n
";
}
$self
->
{
numver
}
=
sprintf
("
%d%02d%02d
",
$1
,
$2
,
$3
?
$3:0
);
$self
->
{
majorver
}
=
sprintf
("
%d.%d
",
$1
,
$2
);
}
}
close
(
C
);
confess
"
Unable to parse configure.in for all variables!
"
if
(
$self
->
{
strver
}
eq
''
||
$self
->
{
numver
}
eq
'');
if
(
IsNewer
("
src
\\
include
\\
pg_config_os.h
","
src
\\
include
\\
port
\\
win32.h
"))
{
print
"
Copying pg_config_os.h...
\n
";
copyFile
("
src
\\
include
\\
port
\\
win32.h
","
src
\\
include
\\
pg_config_os.h
");
}
if
(
IsNewer
("
src
\\
include
\\
pg_config.h
","
src
\\
include
\\
pg_config.h.win32
"))
{
print
"
Generating pg_config.h...
\n
";
open
(
I
,"
src
\\
include
\\
pg_config.h.win32
")
||
confess
"
Could not open pg_config.h.win32
\n
";
open
(
O
,"
>src
\\
include
\\
pg_config.h
")
||
confess
"
Could not write to pg_config.h
\n
";
while
(
<
I
>
)
{
s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}
"
};
s{PG_VERSION_NUM
\
d+}{PG_VERSION_NUM
$self
->{numver}};
s{PG_VERSION_STR
"[
^
"
]+
"}{
__STRINGIFY
(
x
)
#x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER)};
print
O
;
}
print
O
"
/* defines added by config steps */
\n
";
print
O
"
#define USE_ASSERT_CHECKING 1
\n
"
if
(
$self
->
{
options
}
->
{
asserts
});
print
O
"
#define USE_INTEGER_DATETIMES 1
\n
"
if
(
$self
->
{
options
}
->
{
integer_datetimes
});
print
O
"
#define USE_LDAP 1
\n
"
if
(
$self
->
{
options
}
->
{
ldap
});
print
O
"
#define HAVE_LIBZ 1
\n
"
if
(
$self
->
{
options
}
->
{
zlib
});
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
\"
/share/locale
\"\n
"
if
(
$self
->
{
options
}
->
{
nls
});
if
(
$self
->
{
options
}
->
{
xml
})
{
print
O
"
#define HAVE_LIBXML2
\n
";
print
O
"
#define USE_LIBXML
\n
";
}
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
";
print
O
"
#define PG_KRB_SRVNAM
\"
postgres
\"\n
";
}
close
(
O
);
close
(
I
);
}
if
(
IsNewer
("
src
\\
include
\\
pg_config_os.h
","
src
\\
include
\\
port
\\
win32.h
"))
{
print
"
Copying pg_config_os.h...
\n
";
copyFile
("
src
\\
include
\\
port
\\
win32.h
","
src
\\
include
\\
pg_config_os.h
");
}
if
(
IsNewer
("
src
\\
interfaces
\\
libpq
\\
libpqdll.def
","
src
\\
interfaces
\\
libpq
\\
exports.txt
"))
{
print
"
Generating libpqdll.def...
\n
";
open
(
I
,"
src
\\
interfaces
\\
libpq
\\
exports.txt
")
||
confess
("
Could not open exports.txt
\n
");
open
(
O
,"
>src
\\
interfaces
\\
libpq
\\
libpqdll.def
")
||
confess
("
Could not open libpqdll.def
\n
");
print
O
"
LIBRARY LIBPQ
\n
EXPORTS
\n
";
while
(
<
I
>
)
{
next
if
(
/^#/
);
my
(
$f
,
$o
)
=
split
;
print
O
"
$f
@
$o
\n
";
}
close
(
O
);
close
(
I
);
}
if
(
IsNewer
("
src
\\
include
\\
pg_config.h
","
src
\\
include
\\
pg_config.h.win32
"))
{
print
"
Generating pg_config.h...
\n
";
open
(
I
,"
src
\\
include
\\
pg_config.h.win32
")
||
confess
"
Could not open pg_config.h.win32
\n
";
open
(
O
,"
>src
\\
include
\\
pg_config.h
")
||
confess
"
Could not write to pg_config.h
\n
";
while
(
<
I
>
)
{
s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}
"
};
s{PG_VERSION_NUM
\
d+}{PG_VERSION_NUM
$self
->{numver}};
s{PG_VERSION_STR
"[
^
"
]+
"}{
__STRINGIFY
(
x
)
#x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER)};
print
O
;
}
print
O
"
/* defines added by config steps */
\n
";
print
O
"
#define USE_ASSERT_CHECKING 1
\n
"
if
(
$self
->
{
options
}
->
{
asserts
});
print
O
"
#define USE_INTEGER_DATETIMES 1
\n
"
if
(
$self
->
{
options
}
->
{
integer_datetimes
});
print
O
"
#define USE_LDAP 1
\n
"
if
(
$self
->
{
options
}
->
{
ldap
});
print
O
"
#define HAVE_LIBZ 1
\n
"
if
(
$self
->
{
options
}
->
{
zlib
});
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
\"
/share/locale
\"\n
"
if
(
$self
->
{
options
}
->
{
nls
});
if
(
IsNewer
("
src
\\
backend
\\
utils
\\
fmgrtab.c
","
src
\\
include
\\
catalog
\\
pg_proc.h
"))
{
print
"
Generating fmgrtab.c and fmgroids.h...
\n
";
open
(
I
,"
src
\\
include
\\
catalog
\\
pg_proc.h
")
||
confess
"
Could not open pg_proc.h
";
my
@fmgr
=
();
my
%
seenit
;
while
(
<
I
>
)
{
next
unless
(
/^DATA/
);
s/^.*OID[^=]*=[^0-9]*//
;
s/\(//g
;
s/[ \t]*\).*$//
;
my
@p
=
split
;
next
if
(
$p
[
4
]
ne
"
12
");
push
@fmgr
,{
if
(
$self
->
{
options
}
->
{
xml
})
{
print
O
"
#define HAVE_LIBXML2
\n
";
print
O
"
#define USE_LIBXML
\n
";
}
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
";
print
O
"
#define PG_KRB_SRVNAM
\"
postgres
\"\n
";
}
close
(
O
);
close
(
I
);
}
if
(
IsNewer
("
src
\\
interfaces
\\
libpq
\\
libpqdll.def
","
src
\\
interfaces
\\
libpq
\\
exports.txt
"))
{
print
"
Generating libpqdll.def...
\n
";
open
(
I
,"
src
\\
interfaces
\\
libpq
\\
exports.txt
")
||
confess
("
Could not open exports.txt
\n
");
open
(
O
,"
>src
\\
interfaces
\\
libpq
\\
libpqdll.def
")
||
confess
("
Could not open libpqdll.def
\n
");
print
O
"
LIBRARY LIBPQ
\n
EXPORTS
\n
";
while
(
<
I
>
)
{
next
if
(
/^#/
);
my
(
$f
,
$o
)
=
split
;
print
O
"
$f
@
$o
\n
";
}
close
(
O
);
close
(
I
);
}
if
(
IsNewer
("
src
\\
backend
\\
utils
\\
fmgrtab.c
","
src
\\
include
\\
catalog
\\
pg_proc.h
"))
{
print
"
Generating fmgrtab.c and fmgroids.h...
\n
";
open
(
I
,"
src
\\
include
\\
catalog
\\
pg_proc.h
")
||
confess
"
Could not open pg_proc.h
";
my
@fmgr
=
();
my
%
seenit
;
while
(
<
I
>
)
{
next
unless
(
/^DATA/
);
s/^.*OID[^=]*=[^0-9]*//
;
s/\(//g
;
s/[ \t]*\).*$//
;
my
@p
=
split
;
next
if
(
$p
[
4
]
ne
"
12
");
push
@fmgr
,
{
oid
=>
$p
[
0
],
proname
=>
$p
[
1
],
prosrc
=>
$p
[
$#p
-
2
],
nargs
=>
$p
[
12
],
strict
=>
$p
[
9
],
retset
=>
$p
[
10
],
};
}
close
(
I
);
};
}
close
(
I
);
open
(
H
,'
>
',
'
src
\
include
\
utils
\
fmgroids.h
')
||
confess
"
Could not open fmgroids.h
";
print
H
"
/* fmgroids.h generated for Visual C++ */
\n
#ifndef FMGROIDS_H
\n
#define FMGROIDS_H
\n\n
";
open
(
T
,"
>src
\\
backend
\\
utils
\\
fmgrtab.c
")
||
confess
"
Could not open fmgrtab.c
";
print
T
"
/* fmgrtab.c generated for Visual C++ */
\n
#include
\"
postgres.h
\"\n
#include
\"
utils/fmgrtab.h
\"\n\n
";
foreach
my
$s
(
sort
{
$a
->
{
oid
}
<=>
$b
->
{
oid
}}
@fmgr
)
{
next
if
$seenit
{
$s
->
{
prosrc
}};
$seenit
{
$s
->
{
prosrc
}}
=
1
;
print
H
"
#define F_
"
.
uc
$s
->
{
prosrc
}
.
"
$s
->{oid}
\n
";
print
T
"
extern Datum
$s
->{prosrc} (PG_FUNCTION_ARGS);
\n
";
}
print
H
"
\n
#endif
\n
/* FMGROIDS_H */
\n
";
close
(
H
);
print
T
"
const FmgrBuiltin fmgr_builtins[] = {
\n
";
my
%
bmap
;
$bmap
{'
t
'}
=
'
true
';
$bmap
{'
f
'}
=
'
false
';
foreach
my
$s
(
sort
{
$a
->
{
oid
}
<=>
$b
->
{
oid
}}
@fmgr
)
{
print
T
"
{
$s
->{oid},
\"
$s
->{prosrc}
\"
,
$s
->{nargs},
$bmap
{
$s
->{strict}},
$bmap
{
$s
->{retset}},
$s
->{prosrc} },
\n
";
}
open
(
H
,'
>
',
'
src
\
include
\
utils
\
fmgroids.h
')
||
confess
"
Could not open fmgroids.h
";
print
H
"
/* fmgroids.h generated for Visual C++ */
\n
#ifndef FMGROIDS_H
\n
#define FMGROIDS_H
\n\n
";
open
(
T
,"
>src
\\
backend
\\
utils
\\
fmgrtab.c
")
||
confess
"
Could not open fmgrtab.c
";
print
T
"
/* fmgrtab.c generated for Visual C++ */
\n
#include
\"
postgres.h
\"\n
#include
\"
utils/fmgrtab.h
\"\n\n
";
foreach
my
$s
(
sort
{
$a
->
{
oid
}
<=>
$b
->
{
oid
}}
@fmgr
)
{
next
if
$seenit
{
$s
->
{
prosrc
}};
$seenit
{
$s
->
{
prosrc
}}
=
1
;
print
H
"
#define F_
"
.
uc
$s
->
{
prosrc
}
.
"
$s
->{oid}
\n
";
print
T
"
extern Datum
$s
->{prosrc} (PG_FUNCTION_ARGS);
\n
";
}
print
H
"
\n
#endif
\n
/* FMGROIDS_H */
\n
";
close
(
H
);
print
T
"
const FmgrBuiltin fmgr_builtins[] = {
\n
";
my
%
bmap
;
$bmap
{'
t
'}
=
'
true
';
$bmap
{'
f
'}
=
'
false
';
foreach
my
$s
(
sort
{
$a
->
{
oid
}
<=>
$b
->
{
oid
}}
@fmgr
)
{
print
T
"
{
$s
->{oid},
\"
$s
->{prosrc}
\"
,
$s
->{nargs},
$bmap
{
$s
->{strict}},
$bmap
{
$s
->{retset}},
$s
->{prosrc} },
\n
";
}
print
T
"
{ 0, NULL, 0, false, false, NULL }
\n
};
\n\n
const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;
\n
";
close
(
T
);
}
print
T
"
{ 0, NULL, 0, false, false, NULL }
\n
};
\n\n
const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;
\n
";
close
(
T
);
}
if
(
IsNewer
('
src
\
interfaces
\
libpq
\
libpq.rc
','
src
\
interfaces
\
libpq
\
libpq.rc.in
'))
{
print
"
Generating libpq.rc...
\n
";
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
,
$isdst
)
=
localtime
(
time
);
my
$d
=
(
$year
-
100
)
.
"
$yday
";
open
(
I
,'
<
',
'
src
\
interfaces
\
libpq
\
libpq.rc.in
')
||
confess
"
Could not open libpq.rc.in
";
open
(
O
,'
>
',
'
src
\
interfaces
\
libpq
\
libpq.rc
')
||
confess
"
Could not open libpq.rc
";
while
(
<
I
>
)
{
s/(VERSION.*),0/$1,$d/
;
print
O
;
}
close
(
I
);
close
(
O
);
}
if
(
IsNewer
('
src
\
interfaces
\
libpq
\
libpq.rc
','
src
\
interfaces
\
libpq
\
libpq.rc.in
'))
{
print
"
Generating libpq.rc...
\n
";
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
,
$isdst
)
=
localtime
(
time
);
my
$d
=
(
$year
-
100
)
.
"
$yday
";
open
(
I
,'
<
',
'
src
\
interfaces
\
libpq
\
libpq.rc.in
')
||
confess
"
Could not open libpq.rc.in
";
open
(
O
,'
>
',
'
src
\
interfaces
\
libpq
\
libpq.rc
')
||
confess
"
Could not open libpq.rc
";
while
(
<
I
>
)
{
s/(VERSION.*),0/$1,$d/
;
print
O
;
}
close
(
I
);
close
(
O
);
}
if
(
IsNewer
('
src
\
bin
\
psql
\
sql_help.h
','
src
\
bin
\
psql
\
create_help.pl
'))
{
print
"
Generating sql_help.h...
\n
";
chdir
('
src
\
bin
\
psql
');
system
("
perl create_help.pl ../../../doc/src/sgml/ref sql_help.h
");
chdir
('
..
\
..
\
..
');
}
if
(
IsNewer
('
src
\
bin
\
psql
\
sql_help.h
','
src
\
bin
\
psql
\
create_help.pl
'))
{
print
"
Generating sql_help.h...
\n
";
chdir
('
src
\
bin
\
psql
');
system
("
perl create_help.pl ../../../doc/src/sgml/ref sql_help.h
");
chdir
('
..
\
..
\
..
');
}
if
(
IsNewer
('
src
\
interfaces
\
ecpg
\
include
\
ecpg_config.h
',
'
src
\
interfaces
\
ecpg
\
include
\
ecpg_config.h.in
'))
{
print
"
Generating ecpg_config.h...
\n
";
open
(
O
,'
>
','
src
\
interfaces
\
ecpg
\
include
\
ecpg_config.h
')
||
confess
"
Could not open ecpg_config.h
";
print
O
<<EOF;
if
(
IsNewer
(
'
src
\
interfaces
\
ecpg
\
include
\
ecpg_config.h
',
'
src
\
interfaces
\
ecpg
\
include
\
ecpg_config.h.in
'
)
)
{
print
"
Generating ecpg_config.h...
\n
";
open
(
O
,'
>
','
src
\
interfaces
\
ecpg
\
include
\
ecpg_config.h
')
||
confess
"
Could not open ecpg_config.h
";
print
O
<<EOF;
#if (_MSC_VER > 1200)
#define HAVE_LONG_LONG_INT_64
#endif
EOF
close
(
O
);
}
close
(
O
);
}
unless
(
-
f
"
src
\\
port
\\
pg_config_paths.h
")
{
print
"
Generating pg_config_paths.h...
\n
";
open
(
O
,'
>
',
'
src
\
port
\
pg_config_paths.h
')
||
confess
"
Could not open pg_config_paths.h
";
print
O
<<EOF;
unless
(
-
f
"
src
\\
port
\\
pg_config_paths.h
")
{
print
"
Generating pg_config_paths.h...
\n
";
open
(
O
,'
>
',
'
src
\
port
\
pg_config_paths.h
')
||
confess
"
Could not open pg_config_paths.h
";
print
O
<<EOF;
#define PGBINDIR "/bin"
#define PGSHAREDIR "/share"
#define SYSCONFDIR "/etc"
...
...
@@ -214,96 +252,112 @@ EOF
#define DOCDIR "/doc"
#define MANDIR "/man"
EOF
close
(
O
);
}
close
(
O
);
}
my
$mf
=
Project::
read_file
('
src
\
backend
\
catalog
\
Makefile
');
$mf
=~
s{\\s*[\r\n]+}{}mg
;
$mf
=~
/^POSTGRES_BKI_SRCS\s*:?=[^,]+,(.*)\)$/gm
||
croak
"
Could not find POSTGRES_BKI_SRCS in Makefile
\n
";
my
@allbki
=
split
/\s+/
,
$1
;
foreach
my
$bki
(
@allbki
)
{
next
if
$bki
eq
"";
if
(
IsNewer
('
src/backend/catalog/postgres.bki
',
"
src/include/catalog/
$bki
"))
{
print
"
Generating postgres.bki...
\n
";
system
("
perl src/tools/msvc/genbki.pl
$self
->{majorver} src/backend/catalog/postgres
"
.
join
('
src/include/catalog/
',
@allbki
));
last
;
my
$mf
=
Project::
read_file
('
src
\
backend
\
catalog
\
Makefile
');
$mf
=~
s{\\s*[\r\n]+}{}mg
;
$mf
=~
/^POSTGRES_BKI_SRCS\s*:?=[^,]+,(.*)\)$/gm
||
croak
"
Could not find POSTGRES_BKI_SRCS in Makefile
\n
";
my
@allbki
=
split
/\s+/
,
$1
;
foreach
my
$bki
(
@allbki
)
{
next
if
$bki
eq
"";
if
(
IsNewer
('
src/backend/catalog/postgres.bki
',
"
src/include/catalog/
$bki
"))
{
print
"
Generating postgres.bki...
\n
";
system
("
perl src/tools/msvc/genbki.pl
$self
->{majorver} src/backend/catalog/postgres
"
.
join
('
src/include/catalog/
',
@allbki
));
last
;
}
}
}
open
(
O
,
"
>doc/src/sgml/version.sgml
")
||
croak
"
Could not write to version.sgml
\n
";
print
O
<<EOF;
open
(
O
,
"
>doc/src/sgml/version.sgml
")
||
croak
"
Could not write to version.sgml
\n
";
print
O
<<EOF;
<!entity version "$self->{strver}">
<!entity majorversion "$self->{majorver}">
EOF
close
(
O
);
close
(
O
);
}
sub
AddProject
{
my
(
$self
,
$name
,
$type
,
$folder
,
$initialdir
)
=
@_
;
sub
AddProject
{
my
(
$self
,
$name
,
$type
,
$folder
,
$initialdir
)
=
@_
;
my
$proj
=
new
Project
(
$name
,
$type
,
$self
);
push
@
{
$self
->
{
projects
}
->
{
$folder
}},
$proj
;
$proj
->
AddDir
(
$initialdir
)
if
(
$initialdir
);
if
(
$self
->
{
options
}
->
{
zlib
})
{
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
zlib
}
.
'
\
include
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
zlib
}
.
'
\
lib
\
zdll.lib
');
}
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
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
nls
}
.
'
\
lib
\
intl.lib
');
}
if
(
$self
->
{
options
}
->
{
krb5
})
{
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
krb5
}
.
'
\
inc
\
krb5
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
krb5
}
.
'
\
lib
\
i386
\
krb5_32.lib
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
krb5
}
.
'
\
lib
\
i386
\
comerr32.lib
');
}
if
(
$self
->
{
options
}
->
{
xml
})
{
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
xml
}
.
'
\
include
');
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
iconv
}
.
'
\
include
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
xml
}
.
'
\
lib
\
libxml2.lib
');
}
return
$proj
;
my
$proj
=
new
Project
(
$name
,
$type
,
$self
);
push
@
{
$self
->
{
projects
}
->
{
$folder
}},
$proj
;
$proj
->
AddDir
(
$initialdir
)
if
(
$initialdir
);
if
(
$self
->
{
options
}
->
{
zlib
})
{
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
zlib
}
.
'
\
include
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
zlib
}
.
'
\
lib
\
zdll.lib
');
}
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
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
nls
}
.
'
\
lib
\
intl.lib
');
}
if
(
$self
->
{
options
}
->
{
krb5
})
{
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
krb5
}
.
'
\
inc
\
krb5
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
krb5
}
.
'
\
lib
\
i386
\
krb5_32.lib
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
krb5
}
.
'
\
lib
\
i386
\
comerr32.lib
');
}
if
(
$self
->
{
options
}
->
{
xml
})
{
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
xml
}
.
'
\
include
');
$proj
->
AddIncludeDir
(
$self
->
{
options
}
->
{
iconv
}
.
'
\
include
');
$proj
->
AddLibrary
(
$self
->
{
options
}
->
{
xml
}
.
'
\
lib
\
libxml2.lib
');
}
return
$proj
;
}
sub
Save
{
my
(
$self
)
=
@_
;
my
%
flduid
;
sub
Save
{
my
(
$self
)
=
@_
;
my
%
flduid
;
$self
->
GenerateFiles
();
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
$proj
->
Save
();
}
}
$self
->
GenerateFiles
();
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
$proj
->
Save
();
}
}
open
(
SLN
,"
>pgsql.sln
")
||
croak
"
Could not write to pgsql.sln
\n
";
print
SLN
<<EOF;
open
(
SLN
,"
>pgsql.sln
")
||
croak
"
Could not write to pgsql.sln
\n
";
print
SLN
<<EOF;
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
EOF
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
print
SLN
<<EOF;
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
print
SLN
<<EOF;
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$proj->{name}", "$proj->{name}.vcproj", "$proj->{guid}"
EndProject
EOF
}
if
(
$fld
ne
"")
{
$flduid
{
$fld
}
=
Win32::
GuidGen
();
print
SLN
<<EOF;
}
if
(
$fld
ne
"")
{
$flduid
{
$fld
}
=
Win32::
GuidGen
();
print
SLN
<<EOF;
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "$fld", "$fld", "$flduid{$fld}"
EndProject
EOF
}
}
}
}
print
SLN
<<EOF;
print
SLN
<<EOF;
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
...
...
@@ -312,18 +366,20 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
EOF
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
print
SLN
<<EOF;
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
print
SLN
<<EOF;
$proj->{guid}.Debug|Win32.ActiveCfg = Debug|Win32
$proj->{guid}.Debug|Win32.Build.0 = Debug|Win32
$proj->{guid}.Release|Win32.ActiveCfg = Release|Win32
$proj->{guid}.Release|Win32.Build.0 = Release|Win32
EOF
}
}
}
}
print
SLN
<<EOF;
print
SLN
<<EOF;
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
@@ -331,18 +387,20 @@ EOF
GlobalSection(NestedProjects) = preSolution
EOF
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
next
if
(
$fld
eq
"");
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
print
SLN
"
\t\t
$proj
->{guid} =
$flduid
{
$fld
}
\n
";
}
}
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}})
{
next
if
(
$fld
eq
"");
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}})
{
print
SLN
"
\t\t
$proj
->{guid} =
$flduid
{
$fld
}
\n
";
}
}
print
SLN
<<EOF;
print
SLN
<<EOF;
EndGlobalSection
EndGlobal
EOF
close
(
SLN
);
close
(
SLN
);
}
1
;
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
...
...
@@ -15,11 +15,11 @@ require 'src/tools/msvc/config.pl';
my
$solution
=
new
Solution
(
$config
);
our
@pgportfiles
=
qw(
crypt.c fseeko.c getrusage.c inet_aton.c random.c srandom.c
unsetenv.c getaddrinfo.c gettimeofday.c kill.c open.c rand.c
snprintf.c strlcat.c strlcpy.c copydir.c dirmod.c exec.c noblock.c path.c pipe.c
pgsleep.c pgstrcasecmp.c qsort.c qsort_arg.c sprompt.c thread.c
getopt.c getopt_long.c dirent.c rint.c win32error.c)
;
crypt.c fseeko.c getrusage.c inet_aton.c random.c srandom.c
unsetenv.c getaddrinfo.c gettimeofday.c kill.c open.c rand.c
snprintf.c strlcat.c strlcpy.c copydir.c dirmod.c exec.c noblock.c path.c pipe.c
pgsleep.c pgstrcasecmp.c qsort.c qsort_arg.c sprompt.c thread.c
getopt.c getopt_long.c dirent.c rint.c win32error.c)
;
my
$libpgport
=
$solution
->
AddProject
('
libpgport
','
lib
','
misc
');
$libpgport
->
AddDefine
('
FRONTEND
');
...
...
@@ -46,35 +46,46 @@ my $plpgsql = $solution->AddProject('plpgsql','dll','PLs','src\pl\plpgsql\src');
$plpgsql
->
AddFiles
('
src
\
pl
\
plpgsql
\
src
','
scan.l
','
gram.y
');
$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/ExtUtils/xsubpp -typemap
'
.
$solution
->
{
options
}
->
{
perl
}
.
'
/lib/ExtUtils/typemap src
\
pl
\
plperl
\
SPI.xs >src
\
pl
\
plperl
\
SPI.c
');
if
((
!
(
-
f
'
src
\
pl
\
plperl
\
SPI.c
'))
||
-
z
'
src
\
pl
\
plperl
\
SPI.c
')
{
unlink
('
src
\
pl
\
plperl
\
SPI.c
');
# if zero size
die
'
Failed to create SPI.c
'
.
"
\n
";
}
}
$plperl
->
AddReference
(
$postgres
);
$plperl
->
AddLibrary
(
$solution
->
{
options
}
->
{
perl
}
.
'
\
lib
\
CORE
\
perl58.lib
');
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/ExtUtils/xsubpp -typemap
'
.
$solution
->
{
options
}
->
{
perl
}
.
'
/lib/ExtUtils/typemap src
\
pl
\
plperl
\
SPI.xs >src
\
pl
\
plperl
\
SPI.c
');
if
((
!
(
-
f
'
src
\
pl
\
plperl
\
SPI.c
'))
||
-
z
'
src
\
pl
\
plperl
\
SPI.c
')
{
unlink
('
src
\
pl
\
plperl
\
SPI.c
');
# if zero size
die
'
Failed to create SPI.c
'
.
"
\n
";
}
}
$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
);
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
);
}
if
(
$solution
->
{
options
}
->
{
tcl
})
{
my
$pltcl
=
$solution
->
AddProject
('
pltcl
','
dll
','
PLs
','
src
\
pl
\
tcl
');
$pltcl
->
AddIncludeDir
(
$solution
->
{
options
}
->
{
tcl
}
.
'
\
include
');
$pltcl
->
AddReference
(
$postgres
);
$pltcl
->
AddLibrary
(
$solution
->
{
options
}
->
{
tcl
}
.
'
\
lib
\
tcl84.lib
');
if
(
$solution
->
{
options
}
->
{
tcl
})
{
my
$pltcl
=
$solution
->
AddProject
('
pltcl
','
dll
','
PLs
','
src
\
pl
\
tcl
');
$pltcl
->
AddIncludeDir
(
$solution
->
{
options
}
->
{
tcl
}
.
'
\
include
');
$pltcl
->
AddReference
(
$postgres
);
$pltcl
->
AddLibrary
(
$solution
->
{
options
}
->
{
tcl
}
.
'
\
lib
\
tcl84.lib
');
}
my
$libpq
=
$solution
->
AddProject
('
libpq
','
dll
','
interfaces
','
src
\
interfaces
\
libpq
');
...
...
@@ -85,39 +96,42 @@ $libpq->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
$libpq
->
UseDef
('
src
\
interfaces
\
libpq
\
libpqdll.def
');
$libpq
->
ReplaceFile
('
src
\
interfaces
\
libpq
\
libpqrc.c
','
src
\
interfaces
\
libpq
\
libpq.rc
');
my
$pgtypes
=
$solution
->
AddProject
('
libpgtypes
','
dll
','
interfaces
','
src
\
interfaces
\
ecpg
\
pgtypeslib
');
my
$pgtypes
=
$solution
->
AddProject
('
libpgtypes
','
dll
','
interfaces
','
src
\
interfaces
\
ecpg
\
pgtypeslib
');
$pgtypes
->
AddDefine
('
FRONTEND
');
$pgtypes
->
AddReference
(
$postgres
,
$libpgport
);
$pgtypes
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
if
(
$config
->
{
pthread
})
{
my
$libecpg
=
$solution
->
AddProject
('
libecpg
','
dll
','
interfaces
','
src
\
interfaces
\
ecpg
\
ecpglib
');
$libecpg
->
AddDefine
('
FRONTEND
');
$libecpg
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
$libecpg
->
AddIncludeDir
('
src
\
interfaces
\
libpq
');
$libecpg
->
AddIncludeDir
('
src
\
port
');
$libecpg
->
AddLibrary
('
wsock32.lib
');
$libecpg
->
AddLibrary
(
$config
->
{'
pthread
'}
.
'
\
pthreadVC2.lib
');
$libecpg
->
AddReference
(
$libpq
,
$pgtypes
);
my
$libecpgcompat
=
$solution
->
AddProject
('
libecpg_compat
','
dll
','
interfaces
','
src
\
interfaces
\
ecpg
\
compatlib
');
$libecpgcompat
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
$libecpgcompat
->
AddIncludeDir
('
src
\
interfaces
\
libpq
');
$libecpgcompat
->
AddReference
(
$pgtypes
,
$libecpg
);
my
$ecpg
=
$solution
->
AddProject
('
ecpg
','
exe
','
interfaces
','
src
\
interfaces
\
ecpg
\
preproc
');
$ecpg
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
$ecpg
->
AddIncludeDir
('
src
\
interfaces
\
libpq
');
$ecpg
->
AddFiles
('
src
\
interfaces
\
ecpg
\
preproc
','
pgc.l
','
preproc.y
');
$ecpg
->
AddDefine
('
MAJOR_VERSION=4
');
$ecpg
->
AddDefine
('
MINOR_VERSION=2
');
$ecpg
->
AddDefine
('
PATCHLEVEL=1
');
$ecpg
->
AddReference
(
$libpgport
);
if
(
$config
->
{
pthread
})
{
my
$libecpg
=
$solution
->
AddProject
('
libecpg
','
dll
','
interfaces
','
src
\
interfaces
\
ecpg
\
ecpglib
');
$libecpg
->
AddDefine
('
FRONTEND
');
$libecpg
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
$libecpg
->
AddIncludeDir
('
src
\
interfaces
\
libpq
');
$libecpg
->
AddIncludeDir
('
src
\
port
');
$libecpg
->
AddLibrary
('
wsock32.lib
');
$libecpg
->
AddLibrary
(
$config
->
{'
pthread
'}
.
'
\
pthreadVC2.lib
');
$libecpg
->
AddReference
(
$libpq
,
$pgtypes
);
my
$libecpgcompat
=
$solution
->
AddProject
('
libecpg_compat
','
dll
','
interfaces
','
src
\
interfaces
\
ecpg
\
compatlib
');
$libecpgcompat
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
$libecpgcompat
->
AddIncludeDir
('
src
\
interfaces
\
libpq
');
$libecpgcompat
->
AddReference
(
$pgtypes
,
$libecpg
);
my
$ecpg
=
$solution
->
AddProject
('
ecpg
','
exe
','
interfaces
','
src
\
interfaces
\
ecpg
\
preproc
');
$ecpg
->
AddIncludeDir
('
src
\
interfaces
\
ecpg
\
include
');
$ecpg
->
AddIncludeDir
('
src
\
interfaces
\
libpq
');
$ecpg
->
AddFiles
('
src
\
interfaces
\
ecpg
\
preproc
','
pgc.l
','
preproc.y
');
$ecpg
->
AddDefine
('
MAJOR_VERSION=4
');
$ecpg
->
AddDefine
('
MINOR_VERSION=2
');
$ecpg
->
AddDefine
('
PATCHLEVEL=1
');
$ecpg
->
AddReference
(
$libpgport
);
}
else
{
print
"
Not building ecpg due to lack of pthreads.
\n
";
}
else
{
print
"
Not building ecpg due to lack of pthreads.
\n
";
}
# src/bin
my
$initdb
=
AddSimpleFrontend
('
initdb
',
1
);
...
...
@@ -158,113 +172,130 @@ my $zic = $solution->AddProject('zic','exe','utils');
$zic
->
AddFiles
('
src
\
timezone
','
zic.c
','
ialloc.c
','
scheck.c
','
localtime.c
');
$zic
->
AddReference
(
$libpgport
);
my
$contrib_defines
=
{
'
refint
'
=>
'
REFINT_VERBOSE
'
};
my
$contrib_defines
=
{'
refint
'
=>
'
REFINT_VERBOSE
'};
my
@contrib_uselibpq
=
('
dblink
',
'
oid2name
',
'
pgbench
',
'
vacuumlo
');
my
@contrib_uselibpgport
=
('
oid2name
',
'
pgbench
',
'
pg_standby
',
'
vacuumlo
');
my
$contrib_extralibs
=
{
'
pgbench
'
=>
['
wsock32.lib
']
};
my
$contrib_extraincludes
=
{
'
tsearch2
'
=>
['
contrib/tsearch2
']
};
my
$contrib_extralibs
=
{'
pgbench
'
=>
['
wsock32.lib
']};
my
$contrib_extraincludes
=
{'
tsearch2
'
=>
['
contrib/tsearch2
']};
my
$contrib_extrasource
=
{
'
cube
'
=>
['
cubescan.l
','
cubeparse.y
'],
'
seg
'
=>
['
segscan.l
','
segparse.y
']
'
cube
'
=>
['
cubescan.l
','
cubeparse.y
'],
'
seg
'
=>
['
segscan.l
','
segparse.y
']
};
my
@contrib_excludes
=
('
pgcrypto
');
if
(
$solution
->
{
options
}
->
{
xml
})
{
$contrib_extraincludes
->
{'
xml2
'}
=
[
$solution
->
{
options
}
->
{
xml
}
.
'
\
include
'
,
$solution
->
{
options
}
->
{
xslt
}
.
'
\
include
',
$solution
->
{
options
}
->
{
iconv
}
.
'
\
include
'];
$contrib_extralibs
->
{'
xml2
'}
=
[
$solution
->
{
options
}
->
{
xml
}
.
'
\
lib
\
libxml2.lib
',
$solution
->
{
options
}
->
{
xslt
}
.
'
\
lib
\
libxslt.lib
'];
if
(
$solution
->
{
options
}
->
{
xml
})
{
$contrib_extraincludes
->
{'
xml2
'}
=
[
$solution
->
{
options
}
->
{
xml
}
.
'
\
include
',
$solution
->
{
options
}
->
{
xslt
}
.
'
\
include
',
$solution
->
{
options
}
->
{
iconv
}
.
'
\
include
'
];
$contrib_extralibs
->
{'
xml2
'}
=
[
$solution
->
{
options
}
->
{
xml
}
.
'
\
lib
\
libxml2.lib
',
$solution
->
{
options
}
->
{
xslt
}
.
'
\
lib
\
libxslt.lib
'
];
}
else
{
push
@contrib_excludes
,'
xml2
';
else
{
push
@contrib_excludes
,'
xml2
';
}
if
(
!
$solution
->
{
options
}
->
{
openssl
})
{
push
@contrib_excludes
,'
sslinfo
';
if
(
!
$solution
->
{
options
}
->
{
openssl
})
{
push
@contrib_excludes
,'
sslinfo
';
}
# Pgcrypto makefile too complex to parse....
my
$pgcrypto
=
$solution
->
AddProject
('
pgcrypto
','
dll
','
crypto
');
$pgcrypto
->
AddFiles
('
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
');
if
(
$solution
->
{
options
}
->
{
openssl
})
{
$pgcrypto
->
AddFiles
('
contrib
\
pgcrypto
',
'
openssl.c
','
pgp-mpi-openssl.c
');
$pgcrypto
->
AddFiles
(
'
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
'
);
if
(
$solution
->
{
options
}
->
{
openssl
})
{
$pgcrypto
->
AddFiles
('
contrib
\
pgcrypto
',
'
openssl.c
','
pgp-mpi-openssl.c
');
}
else
{
$pgcrypto
->
AddFiles
('
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
');
else
{
$pgcrypto
->
AddFiles
(
'
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
'
);
}
$pgcrypto
->
AddReference
(
$postgres
);
$pgcrypto
->
AddLibrary
('
wsock32.lib
');
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
");
next
if
(
grep
{
/^$d$/
}
@contrib_excludes
);
AddContrib
(
$d
);
while
(
my
$d
=
readdir
(
$D
))
{
next
if
(
$d
=~
/^\./
);
next
unless
(
-
f
"
contrib/
$d
/Makefile
");
next
if
(
grep
{
/^$d$/
}
@contrib_excludes
);
AddContrib
(
$d
);
}
closedir
(
$D
);
my
$mf
=
Project::
read_file
('
src
\
backend
\
utils
\
mb
\
conversion_procs
\
Makefile
');
$mf
=~
s{\\s*[\r\n]+}{}mg
;
$mf
=~
m{DIRS\s*=\s*(.*)$}m
||
die
'
Could not match in conversion makefile
'
.
"
\n
";
foreach
my
$sub
(
split
/\s+/
,
$1
)
{
my
$mf
=
Project::
read_file
('
src
\
backend
\
utils
\
mb
\
conversion_procs
\
\'
. $sub .
'
\
Makefile
'
);
my $p = $solution->AddProject($sub,
'
dll
'
,
'
conversion
procs
'
);
$p->AddFile(
'
src
\
backend
\
utils
\
mb
\
conversion_procs
\\
'
. $sub .
'
\\
'
. $sub .
'
.
c
'
);
if ($mf =~ m{^SRCS
\
s*
\
+=
\
s*(.*)$}m) {
$p->AddFile(
'
src
\
backend
\
utils
\
mb
\
conversion_procs
\\
'
. $sub .
'
\\
'
. $1);
}
$p->AddReference($postgres);
foreach
my
$sub
(
split
/\s+/
,
$1
)
{
my
$mf
=
Project::
read_file
('
src
\
backend
\
utils
\
mb
\
conversion_procs
\
\'
. $sub .
'
\
Makefile
'
);
my $p = $solution->AddProject($sub,
'
dll
'
,
'
conversion
procs
'
);
$p->AddFile(
'
src
\
backend
\
utils
\
mb
\
conversion_procs
\\
'
. $sub .
'
\\
'
. $sub .
'
.
c
'
);
if ($mf =~ m{^SRCS
\
s*
\
+=
\
s*(.*)$}m)
{
$p->AddFile(
'
src
\
backend
\
utils
\
mb
\
conversion_procs
\\
'
. $sub .
'
\\
'
. $1);
}
$p->AddReference($postgres);
}
$mf = Project::read_file(
'
src
\
bin
\
scripts
\
Makefile
'
);
$mf =~ s{
\\
s*[
\
r
\
n]+}{}mg;
$mf =~ m{PROGRAMS
\
s*=
\
s*(.*)$}m || die
'
Could
not
match
in
bin
\
scripts
\
Makefile
'
. "
\
n";
foreach my $prg (split /
\
s+/,$1) {
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;
foreach my $f (@files) {
if ($f =~ /
\
/keywords
\
.o$/) {
$proj->AddFile(
'
src
\
backend
\
parser
\
keywords
.
c
'
);
}
else {
$f =~ s/
\
.o$/
\
.c/;
if ($f eq
'
dumputils
.
c
'
) {
$proj->AddFile(
'
src
\
bin
\
pg_dump
\
dumputils
.
c
'
);
}
elsif ($f =~ /print
\
.c$/) { # Also catches mbprint.c
$proj->AddFile(
'
src
\
bin
\
psql
\\
'
. $f);
}
else {
$proj->AddFile(
'
src
\
bin
\
scripts
\\
'
. $f);
}
}
}
$proj->AddIncludeDir(
'
src
\
interfaces
\
libpq
'
);
$proj->AddIncludeDir(
'
src
\
bin
\
pg_dump
'
);
$proj->AddIncludeDir(
'
src
\
bin
\
psql
'
);
$proj->AddReference($libpq,$libpgport);
$proj->AddResourceFile(
'
src
\
bin
\
scripts
'
,
'
PostgreSQL
Utility
'
);
foreach my $prg (split /
\
s+/,$1)
{
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;
foreach my $f (@files)
{
if ($f =~ /
\
/keywords
\
.o$/)
{
$proj->AddFile(
'
src
\
backend
\
parser
\
keywords
.
c
'
);
}
else
{
$f =~ s/
\
.o$/
\
.c/;
if ($f eq
'
dumputils
.
c
'
)
{
$proj->AddFile(
'
src
\
bin
\
pg_dump
\
dumputils
.
c
'
);
}
elsif ($f =~ /print
\
.c$/)
{ # Also catches mbprint.c
$proj->AddFile(
'
src
\
bin
\
psql
\\
'
. $f);
}
else
{
$proj->AddFile(
'
src
\
bin
\
scripts
\\
'
. $f);
}
}
}
$proj->AddIncludeDir(
'
src
\
interfaces
\
libpq
'
);
$proj->AddIncludeDir(
'
src
\
bin
\
pg_dump
'
);
$proj->AddIncludeDir(
'
src
\
bin
\
psql
'
);
$proj->AddReference($libpq,$libpgport);
$proj->AddResourceFile(
'
src
\
bin
\
scripts
'
,
'
PostgreSQL
Utility
'
);
}
# Regression DLL and EXE
my $regress = $solution->AddProject(
'
regress
'
,
'
dll
'
,
'
misc
'
);
$regress->AddFile(
'
src
\
test
\
regress
\
regress
.
c
'
);
...
...
@@ -284,101 +315,124 @@ $solution->Save();
#####################
# Add a simple frontend project (exe)
sub AddSimpleFrontend {
my $n = shift;
my $uselibpq= shift;
my $p = $solution->AddProject($n,
'
exe
'
,
'
bin
'
);
$p->AddDir(
'
src
\
bin
\\
'
. $n);
$p->AddDefine(
'
FRONTEND
'
);
$p->AddReference($libpgport);
if ($uselibpq) {
$p->AddIncludeDir(
'
src
\
interfaces
\
libpq
'
);
$p->AddReference($libpq);
}
return $p;
sub AddSimpleFrontend
{
my $n = shift;
my $uselibpq= shift;
my $p = $solution->AddProject($n,
'
exe
'
,
'
bin
'
);
$p->AddDir(
'
src
\
bin
\\
'
. $n);
$p->AddDefine(
'
FRONTEND
'
);
$p->AddReference($libpgport);
if ($uselibpq)
{
$p->AddIncludeDir(
'
src
\
interfaces
\
libpq
'
);
$p->AddReference($libpq);
}
return $p;
}
# Add a simple contrib project
sub AddContrib {
my $n = shift;
my $mf = Project::read_file(
'
contrib
\\
'
. $n .
'
\
Makefile
'
);
if ($mf =~ /^MODULE_big/mg) {
$mf =~ s{
\\\
s*[
\
r
\
n]+}{}mg;
my $proj = $solution->AddProject($n,
'
dll
'
,
'
contrib
'
);
$mf =~ /^OBJS
\
s*=
\
s*(.*)$/gm || croak "Could not find objects in MODULE_big for $n
\
n";
foreach my $o (split /
\
s+/, $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) {
my $mf2 = Project::read_file(
'
contrib
\\
'
. $n .
'
\\
'
. $d .
'
\
Makefile
'
);
$mf2 =~ s{
\\\
s*[
\
r
\
n]+}{}mg;
$mf2 =~ /^SUBOBJS
\
s*=
\
s*(.*)$/gm || croak "Could not find objects in MODULE_big for $n, subdir $d
\
n";
foreach my $o (split /
\
s+/, $1) {
$o =~ s/
\
.o$/.c/;
$proj->AddFile(
'
contrib
\\
'
. $n .
'
\\
'
. $d .
'
\\
'
. $o);
}
}
}
AdjustContribProj($proj);
return $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);
}
return undef;
}
elsif ($mf =~ /^PROGRAM
\
s*=
\
s*(.*)$/mg) {
my $proj = $solution->AddProject($1,
'
exe
'
,
'
contrib
'
);
$mf =~ /^OBJS
\
s*=
\
s*(.*)$/gm || croak "Could not find objects in MODULE_big for $n
\
n";
foreach my $o (split /
\
s+/, $1) {
$o =~ s/
\
.o$/.c/;
$proj->AddFile(
'
contrib
\\
'
. $n .
'
\\
'
. $o);
}
AdjustContribProj($proj);
return $proj;
}
else {
croak "Could not determine contrib module type for $n
\
n";
}
sub AddContrib
{
my $n = shift;
my $mf = Project::read_file(
'
contrib
\\
'
. $n .
'
\
Makefile
'
);
if ($mf =~ /^MODULE_big/mg)
{
$mf =~ s{
\\\
s*[
\
r
\
n]+}{}mg;
my $proj = $solution->AddProject($n,
'
dll
'
,
'
contrib
'
);
$mf =~ /^OBJS
\
s*=
\
s*(.*)$/gm || croak "Could not find objects in MODULE_big for $n
\
n";
foreach my $o (split /
\
s+/, $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)
{
my $mf2 = Project::read_file(
'
contrib
\\
'
. $n .
'
\\
'
. $d .
'
\
Makefile
'
);
$mf2 =~ s{
\\\
s*[
\
r
\
n]+}{}mg;
$mf2 =~ /^SUBOBJS
\
s*=
\
s*(.*)$/gm
|| croak "Could not find objects in MODULE_big for $n, subdir $d
\
n";
foreach my $o (split /
\
s+/, $1)
{
$o =~ s/
\
.o$/.c/;
$proj->AddFile(
'
contrib
\\
'
. $n .
'
\\
'
. $d .
'
\\
'
. $o);
}
}
}
AdjustContribProj($proj);
return $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);
}
return undef;
}
elsif ($mf =~ /^PROGRAM
\
s*=
\
s*(.*)$/mg)
{
my $proj = $solution->AddProject($1,
'
exe
'
,
'
contrib
'
);
$mf =~ /^OBJS
\
s*=
\
s*(.*)$/gm || croak "Could not find objects in MODULE_big for $n
\
n";
foreach my $o (split /
\
s+/, $1)
{
$o =~ s/
\
.o$/.c/;
$proj->AddFile(
'
contrib
\\
'
. $n .
'
\\
'
. $o);
}
AdjustContribProj($proj);
return $proj;
}
else
{
croak "Could not determine contrib module type for $n
\
n";
}
}
sub AdjustContribProj {
my $proj = shift;
my $n = $proj->{name};
if ($contrib_defines->{$n}) {
foreach my $d ($contrib_defines->{$n}) {
$proj->AddDefine($d);
}
}
if (grep {/^$n$/} @contrib_uselibpq) {
$proj->AddIncludeDir(
'
src
\
interfaces
\
libpq
'
);
$proj->AddReference($libpq);
}
if (grep {/^$n$/} @contrib_uselibpgport) {
$proj->AddReference($libpgport);
}
if ($contrib_extralibs->{$n}) {
foreach my $l (@{$contrib_extralibs->{$n}}) {
$proj->AddLibrary($l);
}
}
if ($contrib_extraincludes->{$n}) {
foreach my $i (@{$contrib_extraincludes->{$n}}) {
$proj->AddIncludeDir($i);
}
}
if ($contrib_extrasource->{$n}) {
$proj->AddFiles(
'
contrib
\\
'
. $n, @{$contrib_extrasource->{$n}});
}
sub AdjustContribProj
{
my $proj = shift;
my $n = $proj->{name};
if ($contrib_defines->{$n})
{
foreach my $d ($contrib_defines->{$n})
{
$proj->AddDefine($d);
}
}
if (grep {/^$n$/} @contrib_uselibpq)
{
$proj->AddIncludeDir(
'
src
\
interfaces
\
libpq
'
);
$proj->AddReference($libpq);
}
if (grep {/^$n$/} @contrib_uselibpgport)
{
$proj->AddReference($libpgport);
}
if ($contrib_extralibs->{$n})
{
foreach my $l (@{$contrib_extralibs->{$n}})
{
$proj->AddLibrary($l);
}
}
if ($contrib_extraincludes->{$n})
{
foreach my $i (@{$contrib_extraincludes->{$n}})
{
$proj->AddIncludeDir($i);
}
}
if ($contrib_extrasource->{$n})
{
$proj->AddFiles(
'
contrib
\\
'
. $n, @{$contrib_extrasource->{$n}});
}
}
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