Visual Studio 2010/Windows SDK 7.1 support
Hi,
i'v created a patch enables support for building PostgreSQL with Visual
Studio 2010 or Microsoft Windows SDK for Windows 7 and .NET Framework 4
(Windows SDK 7.1).
You can grab it from http://www.piening.info/VS2010.patch
It only touches the .pl, .pm and .bat files in src/tools/msvc so it's
relevant for Windows only (that's why i've left crlf line endings - is
that actually ok or should I have converted them?).
It's diffed against current head + running "perltidy -b -bl -nsfs -naws
-l=100 -ole=unix *.pl *.pm" as described in the README file (which seems
not to have been run before committing Mkvcbuild.pm the last time).
It is problably neither the perfect way to introduce VS2010 support (my
perl is better than my C but probably still not what you are used to)
nor is it my way to try to make you officially support VS 2010. But
perhaps it's something you could start with once you decide to upgrade
the msvc toolchain.
The patch is necessary because M$ got rid of vcbuild in favour of
msbuild which uses a different build file format (*.vcxproj).
It should support all use cases described in
http://www.postgresql.org/docs/current/static/install-windows-full.html
and builds in Windows SDK 7.0 (VS 2008 toolchain) x86 and x64 as well as
Windows SDK 7.1 (VS 2010 toolchain) x86 and x64.
The SDK 7.1 build produces tons of warnings which are mostly macro
redefinitions of EIDRM, EMSGSIZE, EAFNOSUPPORT, EWOULDBLOCK, ECONNRESET,
EINPROGRESS, ENOBUFS, EPROTONOSUPPORT, ECONNREFUSED and EOPNOTSUPP which
seem to have found their way into errno.h finally. Cutting those out of
src\include\pg_config_os.h and src\interfaces\libpq\win32.h makes the
project build pretty clean.
I resisted the temptation to parse them out of those files during
Mkvcbuild::mkvcbuild as this should probably be handled by some
preprocessor defines.
The build result passes vcregress check.
The pgsql.sln file also opens and builds in VS 2010.
I hope it is of some use.
Best regards,
Brar
On Mon, Jan 3, 2011 at 08:19, Brar Piening <brar@gmx.de> wrote:
Hi,
i'v created a patch enables support for building PostgreSQL with Visual
Studio 2010 or Microsoft Windows SDK for Windows 7 and .NET Framework 4
(Windows SDK 7.1).
You can grab it from http://www.piening.info/VS2010.patch
This patch does not apply at all to my repository. Every single hunk
fails - I have a feeling it might have double line-ending encodings or
something like that? Since you're using git (at least eh patch
indicates so), have you perhaps published a git branch somewhere that
I could try pulling from instead?
Or if not - just to be sure, you are basing this off the master branch, I hope?
It's diffed against current head + running "perltidy -b -bl -nsfs -naws
-l=100 -ole=unix *.pl *.pm" as described in the README file (which seems not
to have been run before committing Mkvcbuild.pm the last time).
Yeah, it looks that way - it's missing the ordering of the contrib
arrays. I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.
If you still see any changes on top of that, then there's something
strange going on..
It is problably neither the perfect way to introduce VS2010 support (my perl
is better than my C but probably still not what you are used to) nor is it
my way to try to make you officially support VS 2010. But perhaps it's
something you could start with once you decide to upgrade the msvc
toolchain.
Oh, starting with a patch is definitely not the wrong way :-)
it does look like they changed the file format extensively this time
though - that's annoying, but hopefully they will stick to the new
format this time...
The SDK 7.1 build produces tons of warnings which are mostly macro
redefinitions of EIDRM, EMSGSIZE, EAFNOSUPPORT, EWOULDBLOCK, ECONNRESET,
EINPROGRESS, ENOBUFS, EPROTONOSUPPORT, ECONNREFUSED and EOPNOTSUPP which
seem to have found their way into errno.h finally. Cutting those out of
src\include\pg_config_os.h and src\interfaces\libpq\win32.h makes the
project build pretty clean.
I resisted the temptation to parse them out of those files during
Mkvcbuild::mkvcbuild as this should probably be handled by some preprocessor
defines.
Yes, it's good that you resisted that :-)
It should be done with something like
#if _MSC_VER >= 1400
(with 1400 replaced with whatever version is appropriate)
There's at elast one example in c.h already, and several others spread
through files and code.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
-------- Original-Nachricht --------
Datum: Mon, 3 Jan 2011 10:44:19 +0100
Von: Magnus Hagander <magnus@hagander.net>
An: Brar Piening <brar@gmx.de>
CC: pgsql-hackers@postgresql.org
Betreff: Re: [HACKERS] Visual Studio 2010/Windows SDK 7.1 support
This patch does not apply at all to my repository. Every single hunk
fails - I have a feeling it might have double line-ending encodings or
something like that?
double line-endings indeed!
Surprisingly only some of them (<CR><CR><LF> follow some <CR><LF>'s).
I was quite unsure about the best line endings for this patch so I probably messed it up by converting them forth and back. Still I'm not sure if there's something wrong with my git config - perhaps due to using git-external-diff (I wasn't able to find win32 binaries for filterdiff).
Sorry about that!
perl -e "open(INFILE, '<VS2010.patch');open(OUTFILE, '>VS2010_fixed.patch');binmode(INFILE);binmode(OUTFILE);$/=\"\015\015\012\";$\=\"\015\012\";while(<INFILE>){chomp; print OUTFILE;}close(INFILE);close(OUTFILE)"
fixes the problem.
Yeah, it looks that way - it's missing the ordering of the contrib
arrays. I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.If you still see any changes on top of that, then there's something
strange going on..
No that was probably all.
My patch - fixed as described above - should apply to your repository once you've run perltidy.
I'll rebase the patch as soon as I return from work unless you tell me otherwise.
Best Regards
Brar
--
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
On 01/03/2011 06:26 AM, Brar Piening wrote:
No that was probably all.
My patch - fixed as described above - should apply to your repository once you've run perltidy.
I'll rebase the patch as soon as I return from work unless you tell me otherwise.
Please, this time let's backpatch the fixes to all supported branches
(from the buildfarm's POV that means back to 8.3 on for MSVC). I have
just been wrestling with the fact that we didn't do that with the VS
2008 changes, and these changes are much, much more extensive.
cheers
andrew
On Mon, 3 Jan 2011 10:44:19 +0100, Magnus Hagander
<magnus@hagander.net> wrote:
Yeah, it looks that way - it's missing the ordering of the contrib
I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.
The rebased patch can be grabbed from http://www.piening.info/VS2010v2.patch
It's actually the same patch as before with the corrupted line-endings
parsed out.
"git diff master VS2010 > ../VS2010.patch" reproduceabyl generates those
on my (windows) system when I use git-external-diff configured as
described in
http://wiki.postgresql.org/wiki/Working_with_Git#Context_diffs_with_Git
to produce context diffs.
Unified diffs (git diff master VS2010 --no-ext-diff >
../VS2010_unified.patch) only contain valid unix linfeeds
Perhaps it has got something to do with core.autocrlf=true but I don't
really care as long as I can get rid of it with one line of perl ;-)
For the records I'm using
$ git --version
git version 1.7.3.1.msysgit.0
and the configuration of the postgresql repository is
$ git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
user.name=Brar Piening
user.email=[myemail]
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git://git.postgresql.org/git/postgresql.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
diff.external=git-external-diff
Best regards,
Brar
On Mon, Jan 3, 2011 at 16:45, Brar Piening <brar@gmx.de> wrote:
On Mon, 3 Jan 2011 10:44:19 +0100, Magnus Hagander <magnus@hagander.net>
wrote:Yeah, it looks that way - it's missing the ordering of the contrib
I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.The rebased patch can be grabbed from http://www.piening.info/VS2010v2.patch
Thanks. It still has windows linebreaks, but only once now, so they
can be properly removed by patch. It applies cleanly now.
It's actually the same patch as before with the corrupted line-endings
parsed out."git diff master VS2010 > ../VS2010.patch" reproduceabyl generates those on
my (windows) system when I use git-external-diff configured as described in
http://wiki.postgresql.org/wiki/Working_with_Git#Context_diffs_with_Git to
produce context diffs.
Yeah, I'm not sure those instructions really take Windows into account :-)
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On 01/05/2011 12:33 PM, Magnus Hagander wrote:
It's actually the same patch as before with the corrupted line-endings
parsed out."git diff master VS2010> ../VS2010.patch" reproduceabyl generates those on
my (windows) system when I use git-external-diff configured as described in
http://wiki.postgresql.org/wiki/Working_with_Git#Context_diffs_with_Git to
produce context diffs.Yeah, I'm not sure those instructions really take Windows into account :-)
I've abandoned the use of an external diff program for git. If I need
context diffs I produce them by piping normal git diff output through
"filterdiff --format=context".
cheers
andrew
On Wed, Jan 5, 2011 at 12:59 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
I've abandoned the use of an external diff program for git. If I need
context diffs I produce them by piping normal git diff output through
"filterdiff --format=context".
One possible disadvantage of that it strips out this stuff:
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 6a9b21d..1c6ae02 100644
I actually haven't figured out exactly under what circumstances that
index information is used by git, but I think in theory it's supposed
to make it possible for git to apply patches that would otherwise
fail. However, I actually haven't figured out the best way to make
git do that, either; I'm still using patch -p1, which is basically
horrible if there are >0 conflicts.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Robert Haas <robertmhaas@gmail.com> writes:
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index 6a9b21d..1c6ae02 100644I actually haven't figured out exactly under what circumstances that
I think it's for git am -3
http://www.kernel.org/pub/software/scm/git/docs/git-am.html
But I don't see how to use that on a patch directly, the UI seems to
expect a mail file (mbox or Maildir formats).
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
On Mon, Jan 3, 2011 at 16:45, Brar Piening <brar@gmx.de> wrote:
On Mon, 3 Jan 2011 10:44:19 +0100, Magnus Hagander <magnus@hagander.net>
wrote:Yeah, it looks that way - it's missing the ordering of the contrib
I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.The rebased patch can be grabbed from http://www.piening.info/VS2010v2.patch
Hi!
Please make sure this goes on the commitfest page
(https://commitfest.postgresql.org/action/commitfest_view?id=9), so
it's not missed.
I'm currently lacking an env where I can put VS2010 on it (given that
the amazon cloud no longer works reasonably for windows machines, and
I can't put another version of VS on the other VM I'm using right
now), so it'll be a while before I can look at this.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On 1/15/2011 1:42 PM, Magnus Hagander wrote:
On Mon, Jan 3, 2011 at 16:45, Brar Piening<brar@gmx.de> wrote:
On Mon, 3 Jan 2011 10:44:19 +0100, Magnus Hagander<magnus@hagander.net>
wrote:Yeah, it looks that way - it's missing the ordering of the contrib
I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.The rebased patch can be grabbed from http://www.piening.info/VS2010v2.patch
Hi!
Please make sure this goes on the commitfest page
(https://commitfest.postgresql.org/action/commitfest_view?id=9), so
it's not missed.I'm currently lacking an env where I can put VS2010 on it (given that
the amazon cloud no longer works reasonably for windows machines, and
I can't put another version of VS on the other VM I'm using right
now), so it'll be a while before I can look at this.
I can provide a windows box with VS2010 if you'd like. Wouldn't be
until Monday or Tuesday. Any preference on windows version? Maybe
Windows 7? You want 64-bit?
Send a private email.
--
Andrew Chernow
eSilo, LLC
global backup
http://www.esilo.com/
Hi,
I initially considered this patch as a primer to start off some basic
VS2010 support and not as something to be commited within the next few
commitfests.
As there seems to be at least some interest in this patch I refactored
the code and did some more testing (actually found some weird issues
with pgbison.bat and pgflex.bat and replaced them with perl variants).
So there is now a third version of this patch at
http://www.piening.info/VS2010v3.patch
This time even with unix linefeeds ;-)
On Sat, 15 Jan 2011 19:42:06 +0100, Magnus Hagander
<magnus@hagander.net> wrote:
Please make sure this goes on the commitfest page
(https://commitfest.postgresql.org/action/commitfest_view?id=9), so
it's not missed.
I'll add it.
Regards,
Brar
On Tue, 18 Jan 2011 00:06:10 +0100, Brar Piening <brar@gmx.de> wrote:
So there is now a third version of this patch at
http://www.piening.info/VS2010v3.patch
Forgot to run perltidy on it - fixed in
http://www.piening.info/VS2010v4.patch
Sorry!
Brar
On Sat, Jan 15, 2011 at 1:42 PM, Magnus Hagander <magnus@hagander.net> wrote:
On Mon, Jan 3, 2011 at 16:45, Brar Piening <brar@gmx.de> wrote:
On Mon, 3 Jan 2011 10:44:19 +0100, Magnus Hagander <magnus@hagander.net>
wrote:Yeah, it looks that way - it's missing the ordering of the contrib
I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.The rebased patch can be grabbed from http://www.piening.info/VS2010v2.patch
Hi!
Please make sure this goes on the commitfest page
(https://commitfest.postgresql.org/action/commitfest_view?id=9), so
it's not missed.I'm currently lacking an env where I can put VS2010 on it (given that
the amazon cloud no longer works reasonably for windows machines, and
I can't put another version of VS on the other VM I'm using right
now), so it'll be a while before I can look at this.
Magnus, are you planning to get this committed for 9.1?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Sun, Jan 30, 2011 at 21:06, Robert Haas <robertmhaas@gmail.com> wrote:
On Sat, Jan 15, 2011 at 1:42 PM, Magnus Hagander <magnus@hagander.net> wrote:
On Mon, Jan 3, 2011 at 16:45, Brar Piening <brar@gmx.de> wrote:
On Mon, 3 Jan 2011 10:44:19 +0100, Magnus Hagander <magnus@hagander.net>
wrote:Yeah, it looks that way - it's missing the ordering of the contrib
I'll run it once for that now, and then please rebase your
patch on top of that - makes it easier to review it.The rebased patch can be grabbed from http://www.piening.info/VS2010v2.patch
Hi!
Please make sure this goes on the commitfest page
(https://commitfest.postgresql.org/action/commitfest_view?id=9), so
it's not missed.I'm currently lacking an env where I can put VS2010 on it (given that
the amazon cloud no longer works reasonably for windows machines, and
I can't put another version of VS on the other VM I'm using right
now), so it'll be a while before I can look at this.Magnus, are you planning to get this committed for 9.1?
I'd like to, but I'm not sure I'll have the time. Per the comment from
Brar it was intended as an initial attempt not quite ready yet, so
it's not something we should hold up the CF / release for.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On Sun, Jan 30, 2011 at 3:26 PM, Magnus Hagander <magnus@hagander.net> wrote:
Magnus, are you planning to get this committed for 9.1?
I'd like to, but I'm not sure I'll have the time. Per the comment from
Brar it was intended as an initial attempt not quite ready yet, so
it's not something we should hold up the CF / release for.
OK, I'm marking it Returned with Feedback. We can resurrect it if need be.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Sun, 30 Jan 2011 21:26:22 +0100, Magnus Hagander
<magnus@hagander.net> wrote:
it's not something we should hold up the CF / release for.
I agree.
At least it should get some more testing besides mine.
I've set up virtual machines with VS 2003, VS 2005 Express, VS 2008
Express (+ my PC with VS 2010) for testing purposes but I didn't test
all possible build paths with respect to the external libraries to include.
While I didn't change much of the existing VS 2005/8 code I currently
can't guarantee that the VS 2010 build will work for every possible
external library one could include (yet I didn't stumble into any
failure while testing) and still I could have broken some VS 2005/8
build path too.
The patch could also be extended to automatically support building libpq
when VS 2003 is detected or support other desireable features that
aren't really in the context of supporting VS 2010.
Being somewhat short of time in the next weeks I'm at least willing to
rebase the patch on request and do some more testing or fix issues
someone else has detected before the next release (9.2?) goes beta.
If there's some pressure to support VS 2010 asap - please let me know
and I'll see what I can do.
Best regards,
Brar
On Sun, Feb 6, 2011 at 23:06, Brar Piening <brar@gmx.de> wrote:
On Sun, 30 Jan 2011 21:26:22 +0100, Magnus Hagander <magnus@hagander.net>
wrote:it's not something we should hold up the CF / release for.
I agree.
At least it should get some more testing besides mine.I've set up virtual machines with VS 2003, VS 2005 Express, VS 2008 Express
(+ my PC with VS 2010) for testing purposes but I didn't test all possible
build paths with respect to the external libraries to include.
Yeah, the external libraries are really the biggest thing.
While I didn't change much of the existing VS 2005/8 code I currently can't
guarantee that the VS 2010 build will work for every possible external
library one could include (yet I didn't stumble into any failure while
testing) and still I could have broken some VS 2005/8 build path too.
The patch could also be extended to automatically support building libpq
when VS 2003 is detected or support other desireable features that aren't
really in the context of supporting VS 2010.Being somewhat short of time in the next weeks I'm at least willing to
rebase the patch on request and do some more testing or fix issues someone
else has detected before the next release (9.2?) goes beta.
Sounds good.
If there's some pressure to support VS 2010 asap - please let me know and
I'll see what I can do.
I don't think there is, really. It's a "nice to have", but if it comes
in 9.2 instead of 9.1, I don't think that's a problem. 99.9% of all
Win32 users don't build from source in the first place, and I'm sure
Dave is happy not to have to dela with another version ;)
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On Sun, 06 Feb 2011 23:06:21 +0100, Brar Piening <brar@gmx.de> wrote:
On Sun, 30 Jan 2011 21:26:22 +0100, Magnus Hagander
<magnus@hagander.net> wrote:it's not something we should hold up the CF / release for.
I agree.
At least it should get some more testing besides mine.
[...]
Being somewhat short of time in the next weeks I'm at least willing to
rebase the patch on request and do some more testing or fix issues
someone else has detected before the next release (9.2?) goes beta.
After some months of being able to regularly compile current head using
Visual Studio 2010 compilers and some more tests I no longer see any
reason why this patch would change without external feedback.
I've tested the latest version (http://www.piening.info/VS2010v6.patch)
with the following config.pl for x86
$config->{perl} = 'C:\Perl'; # ActivePerl 5.8.9 Build 829
$config->{tcl} = 'C:\Tcl'; # ActiveState ActiveTcl 8.4.19.5
$config->{python} = 'C:\Python27'; # Python 2.7.1
$config->{openssl} = 'C:\openssl'; # openssl-1.0.0d
$config->{nls} = 'C:\Dev\gnuwin32'; # GetText 0.14.4
$config->{krb5} = 'C:\Dev\kfw-3-2-2-final';
$config->{xml} = 'C:\Dev\libxml2-2.7.7.win32';
$config->{xslt} = 'C:\Dev\libxslt-1.1.26.win32';
$config->{iconv} = 'C:\Dev\iconv-1.9.2.win32';
$config->{zlib} = 'C:\Dev\zlib125';
for x64 I've tested a less extensive configuration as it's still hard to
get the above libraries as x64 binaries.
I'd appreciate any reviews, tests or comments.
If someone with some more C skills than me could silence the warnings
this would be a huge gain for build speed and testing. My previous
attempts silenced the warnings but built a non-connectable backend.
Regards,
Brar
On Fri, May 13, 2011 at 5:34 PM, Brar Piening <brar@gmx.de> wrote:
After some months of being able to regularly compile current head using
Visual Studio 2010 compilers and some more tests I no longer see any reason
why this patch would change without external feedback.
You probably want to add it here, then:
https://commitfest.postgresql.org/action/commitfest_view/open
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Fri, 13 May 2011 21:52:47 -0400, Robert Haas
<robertmhaas@gmail.com> wrote:
You probably want to add it here, then:
https://commitfest.postgresql.org/action/commitfest_view/open
I's been in the last commitfest and i've recently moved it to the
current one already.
See https://commitfest.postgresql.org/action/patch_view?id=523
Regards,
Brar
On Fri, 13 May 2011 23:34:05 +0200, Brar Piening <brar@gmx.de> wrote:
[...]
I'd appreciate any reviews, tests or comments.
As the current commitfest is getting more and more active recently i've
rechecked my patch and updated it for code drift.
No real changes.
See http://www.piening.info/VS2010v7.patch
The huge increase in size is due to running perltidy which also tidied
up the new builddoc.pl which seems to have gotten in untidied.
In a working Windows build environment all you have to do to test this
patch is
1. Download Windows SDK v7.1 from
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b
and install it
2. Apply the patch
3. Add your usual buildenv.pl and config.pl
4. Build Postgres using the Windows SDK 7.1 Command Prompt
5. Check if everything is working fine (build vcregress, ...)
If someone with some more C skills than me could silence the warnings
this would be a huge gain for build speed and testing. My previous
attempts silenced the warnings but built a non-connectable backend.
This one still stands as it is. Probably not a big issue for anyone of you.
Regards,
Brar
Brar Piening <brar@gmx.de> writes:
On Fri, 13 May 2011 23:34:05 +0200, Brar Piening <brar@gmx.de> wrote:
[...]I'd appreciate any reviews, tests or comments.
As the current commitfest is getting more and more active recently i've
rechecked my patch and updated it for code drift.
No real changes.
See http://www.piening.info/VS2010v7.patch
Please submit your patches on-list, not just by reference to some URL
somewhere. We have both legal and archival reasons for insisting on
that.
The huge increase in size is due to running perltidy which also tidied
up the new builddoc.pl which seems to have gotten in untidied.
Please do *not* submit a patch that combines actual reviewable changes
with something like that. It makes the reviewer's life harder and
doesn't have any counterbalancing benefit. You can either submit a
separate patch that tidies the existing code, or just request that some
committer do it.
regards, tom lane
On Mon, 06 Jun 2011 19:11:14 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Please submit your patches on-list, not just by reference to some URL
somewhere. We have both legal and archival reasons for insisting on
that.
attached...
You can either submit a separate patch that tidies the existing code,
or just request that some committer do it.
done...
(see attached perltidy_before.patch)
Regards,
Brar
Attachments:
perltidy_before.patchtext/plain; name=perltidy_before.patchDownload
diff -Napcdr -x .git postgresql/src/tools/msvc/Install.pm postgresql_dev/src/tools/msvc/Install.pm
*** postgresql/src/tools/msvc/Install.pm Mon Jun 6 21:27:28 2011
--- postgresql_dev/src/tools/msvc/Install.pm Tue Jun 7 04:53:49 2011
*************** sub Install
*** 56,65 ****
my $majorver = DetermineMajorVersion();
print "Installing version $majorver for $conf in $target\n";
! EnsureDirectories($target, 'bin', 'lib', 'share', 'share/timezonesets',
! 'share/extension', 'share/contrib',
! 'doc', 'doc/extension', 'doc/contrib',
! 'symbols', 'share/tsearch_data');
CopySolutionOutput($conf, $target);
lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
--- 56,66 ----
my $majorver = DetermineMajorVersion();
print "Installing version $majorver for $conf in $target\n";
! EnsureDirectories(
! $target, 'bin', 'lib', 'share',
! 'share/timezonesets','share/extension', 'share/contrib','doc',
! 'doc/extension', 'doc/contrib','symbols', 'share/tsearch_data'
! );
CopySolutionOutput($conf, $target);
lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
*************** sub Install
*** 113,123 ****
CopyContribFiles($config,$target);
CopyIncludeFiles($target);
! my $pl_extension_files = [];
! my @pldirs = ('src/pl/plpgsql/src');
! push @pldirs,"src/pl/plperl" if $config->{perl};
! push @pldirs,"src/pl/plpython" if $config->{python};
! push @pldirs,"src/pl/tcl" if $config->{tcl};
File::Find::find(
{
wanted =>sub {
--- 114,124 ----
CopyContribFiles($config,$target);
CopyIncludeFiles($target);
! my $pl_extension_files = [];
! my @pldirs = ('src/pl/plpgsql/src');
! push @pldirs,"src/pl/plperl" if $config->{perl};
! push @pldirs,"src/pl/plpython" if $config->{python};
! push @pldirs,"src/pl/tcl" if $config->{tcl};
File::Find::find(
{
wanted =>sub {
*************** sub Install
*** 127,136 ****
},
@pldirs
);
! CopySetOfFiles(
! 'PL Extension files', $pl_extension_files,
! $target . '/share/extension/'
! );
GenerateNLSFiles($target,$config->{nls},$majorver) if ($config->{nls});
--- 128,134 ----
},
@pldirs
);
! CopySetOfFiles('PL Extension files', $pl_extension_files,$target . '/share/extension/');
GenerateNLSFiles($target,$config->{nls},$majorver) if ($config->{nls});
*************** sub CopyContribFiles
*** 350,358 ****
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f . '.control',
! $target . '/share/extension/' . $f . '.control')
! || croak("Could not copy file $f.control in contrib $d");
print '.';
}
}
--- 348,357 ----
foreach my $f (split /\s+/,$flist)
{
! lcopy(
! 'contrib/' . $d . '/' . $f . '.control',
! $target . '/share/extension/' . $f . '.control'
! )|| croak("Could not copy file $f.control in contrib $d");
print '.';
}
}
*************** sub CopyContribFiles
*** 369,375 ****
foreach my $f (split /\s+/,$flist)
{
lcopy('contrib/' . $d . '/' . $f,
! $target . '/share/' . $moduledir . '/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
--- 368,374 ----
foreach my $f (split /\s+/,$flist)
{
lcopy('contrib/' . $d . '/' . $f,
! $target . '/share/' . $moduledir . '/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
*************** sub CopyContribFiles
*** 383,390 ****
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f,
! $target . '/share/tsearch_data/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
--- 382,388 ----
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f,$target . '/share/tsearch_data/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
*************** sub CopyContribFiles
*** 402,409 ****
if ($d eq 'spi');
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f,
! $target . '/doc/' . $moduledir . '/' . $f)
|| croak("Could not copy file $f in contrib $d");
print '.';
}
--- 400,406 ----
if ($d eq 'spi');
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f,$target . '/doc/' . $moduledir . '/' . $f)
|| croak("Could not copy file $f in contrib $d");
print '.';
}
*************** sub CopyIncludeFiles
*** 473,486 ****
$target . '/include/server/',
'src/include/', 'pg_config.h', 'pg_config_os.h'
);
! CopyFiles('Grammar header', $target . '/include/server/parser/',
! 'src/backend/parser/', 'gram.h');
CopySetOfFiles('',[ glob("src\\include\\*.h") ],$target . '/include/server/');
my $D;
opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";
! # some xcopy progs don't like mixed slash style paths
! (my $ctarget = $target) =~ s!/!\\!g;
while (my $d = readdir($D))
{
next if ($d =~ /^\./);
--- 470,483 ----
$target . '/include/server/',
'src/include/', 'pg_config.h', 'pg_config_os.h'
);
! CopyFiles('Grammar header', $target . '/include/server/parser/','src/backend/parser/',
! 'gram.h');
CopySetOfFiles('',[ glob("src\\include\\*.h") ],$target . '/include/server/');
my $D;
opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";
! # some xcopy progs don't like mixed slash style paths
! (my $ctarget = $target) =~ s!/!\\!g;
while (my $d = readdir($D))
{
next if ($d =~ /^\./);
diff -Napcdr -x .git postgresql/src/tools/msvc/Mkvcbuild.pm postgresql_dev/src/tools/msvc/Mkvcbuild.pm
*** postgresql/src/tools/msvc/Mkvcbuild.pm Mon Jun 6 21:27:28 2011
--- postgresql_dev/src/tools/msvc/Mkvcbuild.pm Tue Jun 7 04:53:50 2011
*************** sub mkvcbuild
*** 172,177 ****
--- 172,178 ----
if ($solution->{options}->{python})
{
+
# Attempt to get python version and location.
# Assume python.exe in specified dir.
open(P,
*************** sub mkvcbuild
*** 190,197 ****
if (!(defined($pyprefix) && defined($pyver)));
my $pymajorver = substr($pyver, 0, 1);
! my $plpython = $solution->AddProject('plpython' . $pymajorver, 'dll',
! 'PLs', 'src\pl\plpython');
$plpython->AddIncludeDir($pyprefix . '\include');
$plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
$plpython->AddReference($postgres);
--- 191,198 ----
if (!(defined($pyprefix) && defined($pyver)));
my $pymajorver = substr($pyver, 0, 1);
! my $plpython =
! $solution->AddProject('plpython' . $pymajorver, 'dll','PLs', 'src\pl\plpython');
$plpython->AddIncludeDir($pyprefix . '\include');
$plpython->AddLibrary($pyprefix . "\\Libs\\python$pyver.lib");
$plpython->AddReference($postgres);
diff -Napcdr -x .git postgresql/src/tools/msvc/Solution.pm postgresql_dev/src/tools/msvc/Solution.pm
*** postgresql/src/tools/msvc/Solution.pm Mon Jun 6 21:27:28 2011
--- postgresql_dev/src/tools/msvc/Solution.pm Tue Jun 7 04:53:50 2011
*************** s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x)
*** 273,295 ****
);
}
! if ($self->{options}->{python} && IsNewer('src\pl\plpython\spiexceptions.h','src\include\backend\errcodes.txt'))
{
print "Generating spiexceptions.h...\n";
! system('perl src\pl\plpython\generate-spiexceptions.pl src\backend\utils\errcodes.txt > src\pl\plpython\spiexceptions.h');
}
if (IsNewer('src\include\utils\errcodes.h','src\backend\utils\errcodes.txt'))
{
print "Generating errcodes.h...\n";
! system('perl src\backend\utils\generate-errcodes.pl src\backend\utils\errcodes.txt > src\backend\utils\errcodes.h');
copyFile('src\backend\utils\errcodes.h','src\include\utils\errcodes.h');
}
if (IsNewer('src\pl\plpgsql\src\plerrcodes.h','src\backend\utils\errcodes.txt'))
{
print "Generating plerrcodes.h...\n";
! system('perl src\pl\plpgsql\src\generate-plerrcodes.pl src\backend\utils\errcodes.txt > src\pl\plpgsql\src\plerrcodes.h');
}
if (IsNewer('src\interfaces\libpq\libpq.rc','src\interfaces\libpq\libpq.rc.in'))
--- 273,302 ----
);
}
! if ($self->{options}->{python}
! && IsNewer('src\pl\plpython\spiexceptions.h','src\include\backend\errcodes.txt'))
{
print "Generating spiexceptions.h...\n";
! system(
! 'perl src\pl\plpython\generate-spiexceptions.pl src\backend\utils\errcodes.txt > src\pl\plpython\spiexceptions.h'
! );
}
if (IsNewer('src\include\utils\errcodes.h','src\backend\utils\errcodes.txt'))
{
print "Generating errcodes.h...\n";
! system(
! 'perl src\backend\utils\generate-errcodes.pl src\backend\utils\errcodes.txt > src\backend\utils\errcodes.h'
! );
copyFile('src\backend\utils\errcodes.h','src\include\utils\errcodes.h');
}
if (IsNewer('src\pl\plpgsql\src\plerrcodes.h','src\backend\utils\errcodes.txt'))
{
print "Generating plerrcodes.h...\n";
! system(
! 'perl src\pl\plpgsql\src\generate-plerrcodes.pl src\backend\utils\errcodes.txt > src\pl\plpgsql\src\plerrcodes.h'
! );
}
if (IsNewer('src\interfaces\libpq\libpq.rc','src\interfaces\libpq\libpq.rc.in'))
diff -Napcdr -x .git postgresql/src/tools/msvc/builddoc.pl postgresql_dev/src/tools/msvc/builddoc.pl
*** postgresql/src/tools/msvc/builddoc.pl Mon Jun 6 21:27:28 2011
--- postgresql_dev/src/tools/msvc/builddoc.pl Tue Jun 7 04:53:49 2011
*************** use strict;
*** 9,15 ****
use File::Copy;
use Cwd qw(abs_path getcwd);
-
my $startdir = getcwd();
my $openjade = 'openjade-1.3.1';
--- 9,14 ----
*************** die "bad DOCROOT '$docroot'" unless ($do
*** 27,44 ****
my @notfound;
foreach my $dir ('docbook', $openjade, $dsssl)
{
! push(@notfound,$dir) unless -d "$docroot/$dir";
}
missing() if @notfound;
my $arg = shift;
renamefiles();
-
chdir 'doc/src/sgml';
! $ENV{SGML_CATALOG_FILES} = "$docroot/$openjade/dsssl/catalog;" .
! "$docroot/docbook/docbook.cat";
my $cmd;
--- 26,41 ----
my @notfound;
foreach my $dir ('docbook', $openjade, $dsssl)
{
! push(@notfound,$dir) unless -d "$docroot/$dir";
}
missing() if @notfound;
my $arg = shift;
renamefiles();
chdir 'doc/src/sgml';
! $ENV{SGML_CATALOG_FILES} = "$docroot/$openjade/dsssl/catalog;" ."$docroot/docbook/docbook.cat";
my $cmd;
*************** my $cmd;
*** 46,86 ****
# can't die on "failure"
$cmd =
! "perl mk_feature_tables.pl YES " .
! "../../../src/backend/catalog/sql_feature_packages.txt " .
! "../../../src/backend/catalog/sql_features.txt " .
! "> features-supported.sgml";
! system($cmd); die "features_supported" if $?;
! $cmd =
! "perl mk_feature_tables.pl NO " .
! "\"../../../src/backend/catalog/sql_feature_packages.txt\" " .
! "\"../../../src/backend/catalog/sql_features.txt\" " .
! "> features-unsupported.sgml";
! system($cmd); die "features_unsupported" if $?;
$cmd =
! "perl generate-errcodes-table.pl \"../../../src/backend/utils/errcodes.txt\" " .
! "> errcodes-table.sgml";
! system($cmd); die "errcodes-table" if $?;
print "Running first build...\n";
$cmd =
! "\"$docroot/$openjade/bin/openjade\" -V html-index -wall " .
! "-wno-unused-param -wno-empty -D . -c \"$docroot/$dsssl/catalog\" " .
! "-d stylesheet.dsl -i output-html -t sgml postgres.sgml 2>&1 " .
! "| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
print "Running collateindex...\n";
! $cmd =
! "perl \"$docroot/$dsssl/bin/collateindex.pl\" -f -g -i bookindex " .
! "-o bookindex.sgml HTML.index";
! system($cmd); die "collateindex" if $?;
mkdir "html";
print "Running second build...\n";
$cmd =
! "\"$docroot/$openjade/bin/openjade\" -wall -wno-unused-param -wno-empty " .
! "-D . -c \"$docroot/$dsssl/catalog\" -d stylesheet.dsl -t sgml " .
! "-i output-html -i include-index postgres.sgml 2>&1 " .
! "| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
--- 43,85 ----
# can't die on "failure"
$cmd =
! "perl mk_feature_tables.pl YES "
! ."../../../src/backend/catalog/sql_feature_packages.txt "
! ."../../../src/backend/catalog/sql_features.txt "
! ."> features-supported.sgml";
! system($cmd);
! die "features_supported" if $?;
$cmd =
! "perl mk_feature_tables.pl NO "
! ."\"../../../src/backend/catalog/sql_feature_packages.txt\" "
! ."\"../../../src/backend/catalog/sql_features.txt\" "
! ."> features-unsupported.sgml";
! system($cmd);
! die "features_unsupported" if $?;
! $cmd ="perl generate-errcodes-table.pl \"../../../src/backend/utils/errcodes.txt\" "
! ."> errcodes-table.sgml";
! system($cmd);
! die "errcodes-table" if $?;
print "Running first build...\n";
$cmd =
! "\"$docroot/$openjade/bin/openjade\" -V html-index -wall "
! ."-wno-unused-param -wno-empty -D . -c \"$docroot/$dsssl/catalog\" "
! ."-d stylesheet.dsl -i output-html -t sgml postgres.sgml 2>&1 "
! ."| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
print "Running collateindex...\n";
! $cmd ="perl \"$docroot/$dsssl/bin/collateindex.pl\" -f -g -i bookindex "
! ."-o bookindex.sgml HTML.index";
! system($cmd);
! die "collateindex" if $?;
mkdir "html";
print "Running second build...\n";
$cmd =
! "\"$docroot/$openjade/bin/openjade\" -wall -wno-unused-param -wno-empty "
! ."-D . -c \"$docroot/$dsssl/catalog\" -d stylesheet.dsl -t sgml "
! ."-i output-html -i include-index postgres.sgml 2>&1 "
! ."| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
*************** exit;
*** 94,122 ****
sub renamefiles
{
! # Rename ISO entity files
! my $savedir = getcwd();
! chdir "$docroot/docbook";
! foreach my $f (glob('ISO*'))
! {
! next if $f =~ /\.gml$/i;
! my $nf = $f;
! $nf =~ s/ISO(.*)/ISO-$1.gml/;
! move $f, $nf;
! }
! chdir $savedir;
!
}
sub missing
{
! print STDERR "could not find $docroot/$_\n" foreach (@notfound);
! exit 1;
}
sub noversion
{
! print STDERR "Could not find version.sgml. ",
! "Please run mkvcbuild.pl first!\n";
! exit 1;
}
--- 93,121 ----
sub renamefiles
{
!
! # Rename ISO entity files
! my $savedir = getcwd();
! chdir "$docroot/docbook";
! foreach my $f (glob('ISO*'))
! {
! next if $f =~ /\.gml$/i;
! my $nf = $f;
! $nf =~ s/ISO(.*)/ISO-$1.gml/;
! move $f, $nf;
! }
! chdir $savedir;
!
}
sub missing
{
! print STDERR "could not find $docroot/$_\n" foreach (@notfound);
! exit 1;
}
sub noversion
{
! print STDERR "Could not find version.sgml. ","Please run mkvcbuild.pl first!\n";
! exit 1;
}
diff -Napcdr -x .git postgresql/src/tools/msvc/vcregress.pl postgresql_dev/src/tools/msvc/vcregress.pl
*** postgresql/src/tools/msvc/vcregress.pl Mon Jun 6 21:27:28 2011
--- postgresql_dev/src/tools/msvc/vcregress.pl Tue Jun 7 04:53:49 2011
*************** my %command = (
*** 72,78 ****
INSTALLCHECK => \&installcheck,
ECPGCHECK => \&ecpgcheck,
CONTRIBCHECK => \&contribcheck,
! ISOLATIONCHECK => \&isolationcheck,
);
my $proc = $command{$what};
--- 72,78 ----
INSTALLCHECK => \&installcheck,
ECPGCHECK => \&ecpgcheck,
CONTRIBCHECK => \&contribcheck,
! ISOLATIONCHECK => \&isolationcheck,
);
my $proc = $command{$what};
*************** sub ecpgcheck
*** 140,153 ****
sub isolationcheck
{
! chdir "../isolation";
! copy("../../../$Config/isolationtester/isolationtester.exe",".");
my @args = (
! "../../../$Config/pg_isolation_regress/pg_isolation_regress",
! "--psqldir=../../../$Config/psql",
! "--inputdir=.",
! "--schedule=./isolation_schedule"
! );
push(@args,$maxconn) if $maxconn;
system(@args);
my $status = $? >>8;
--- 140,152 ----
sub isolationcheck
{
! chdir "../isolation";
! copy("../../../$Config/isolationtester/isolationtester.exe",".");
my @args = (
! "../../../$Config/pg_isolation_regress/pg_isolation_regress",
! "--psqldir=../../../$Config/psql",
! "--inputdir=.","--schedule=./isolation_schedule"
! );
push(@args,$maxconn) if $maxconn;
system(@args);
my $status = $? >>8;
VS2010v8.patchtext/plain; name=VS2010v8.patchDownload
diff -Napcdr -x .git postgresql/src/tools/msvc/Install.pm postgresql_dev/src/tools/msvc/Install.pm
*** postgresql/src/tools/msvc/Install.pm Tue Jun 7 05:07:51 2011
--- postgresql_dev/src/tools/msvc/Install.pm Tue Jun 7 05:10:40 2011
*************** sub Install
*** 56,66 ****
my $majorver = DetermineMajorVersion();
print "Installing version $majorver for $conf in $target\n";
! EnsureDirectories(
! $target, 'bin', 'lib', 'share',
! 'share/timezonesets','share/extension', 'share/contrib','doc',
! 'doc/extension', 'doc/contrib','symbols', 'share/tsearch_data'
! );
CopySolutionOutput($conf, $target);
lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
--- 56,63 ----
my $majorver = DetermineMajorVersion();
print "Installing version $majorver for $conf in $target\n";
! EnsureDirectories($target, 'bin', 'lib', 'share','share/timezonesets','share/extension',
! 'share/contrib','doc','doc/extension', 'doc/contrib','symbols', 'share/tsearch_data');
CopySolutionOutput($conf, $target);
lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
*************** sub CopySolutionOutput
*** 186,191 ****
--- 183,195 ----
my $rem = qr{Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"\) = "([^"]+)"};
my $sln = read_file("pgsql.sln") || croak "Could not open pgsql.sln\n";
+
+ my $vcproj = 'vcproj';
+ if ($sln =~ /Microsoft Visual Studio Solution File, Format Version (\d+)\.\d+/ && $1 >= 11)
+ {
+ $vcproj = 'vcxproj';
+ }
+
print "Copying build output files...";
while ($sln =~ $rem)
{
*************** sub CopySolutionOutput
*** 195,220 ****
$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;
}
lcopy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext")
|| croak "Could not copy $pf.$ext\n";
--- 199,246 ----
$sln =~ s/$rem//;
! my $proj = read_file("$pf.$vcproj") || croak "Could not open $pf.$vcproj\n";
! if ($vcproj eq 'vcproj' && $proj =~ qr{ConfigurationType="([^"]+)"})
{
! 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;
! }
}
! elsif ($vcproj eq 'vcxproj' && $proj =~ qr{<ConfigurationType>(\w+)</ConfigurationType>})
{
! if ($1 eq 'Application')
! {
! $dir = "bin";
! $ext = "exe";
! }
! elsif ($1 eq 'DynamicLibrary')
! {
! $dir = "lib";
! $ext = "dll";
! }
! else # 'StaticLibrary'
! {
!
! # Static lib, such as libpgport, only used internally during build, don't install
! next;
! }
}
else
{
! croak "Could not parse $pf.$vcproj\n";
}
lcopy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext")
|| croak "Could not copy $pf.$ext\n";
*************** sub CopyIncludeFiles
*** 470,477 ****
$target . '/include/server/',
'src/include/', 'pg_config.h', 'pg_config_os.h'
);
! CopyFiles('Grammar header', $target . '/include/server/parser/','src/backend/parser/',
! 'gram.h');
CopySetOfFiles('',[ glob("src\\include\\*.h") ],$target . '/include/server/');
my $D;
opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";
--- 496,502 ----
$target . '/include/server/',
'src/include/', 'pg_config.h', 'pg_config_os.h'
);
! CopyFiles('Grammar header', $target . '/include/server/parser/','src/backend/parser/','gram.h');
CopySetOfFiles('',[ glob("src\\include\\*.h") ],$target . '/include/server/');
my $D;
opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";
diff -Napcdr -x .git postgresql/src/tools/msvc/Mkvcbuild.pm postgresql_dev/src/tools/msvc/Mkvcbuild.pm
*** postgresql/src/tools/msvc/Mkvcbuild.pm Tue Jun 7 05:07:51 2011
--- postgresql_dev/src/tools/msvc/Mkvcbuild.pm Tue Jun 7 05:10:40 2011
*************** sub mkvcbuild
*** 45,51 ****
chdir('..\..\..') if (-d '..\msvc' && -d '..\..\..\src');
die 'Must run from root or msvc directory' unless (-d 'src\tools\msvc' && -d 'src');
! $solution = new Solution($config);
our @pgportfiles = qw(
chklocale.c crypt.c fseeko.c getrusage.c inet_aton.c random.c srandom.c
--- 45,53 ----
chdir('..\..\..') if (-d '..\msvc' && -d '..\..\..\src');
die 'Must run from root or msvc directory' unless (-d 'src\tools\msvc' && -d 'src');
! my $vsVersion = VSObjectFactory::DetermineVisualStudioVersion();
!
! $solution = VSObjectFactory::CreateSolution($vsVersion, $config);
our @pgportfiles = qw(
chklocale.c crypt.c fseeko.c getrusage.c inet_aton.c random.c srandom.c
*************** sub mkvcbuild
*** 488,493 ****
--- 490,496 ----
$pgregress->AddReference($libpgport);
$solution->Save();
+ return $solution->{vcver};
}
#####################
diff -Napcdr -x .git postgresql/src/tools/msvc/Project.pm postgresql_dev/src/tools/msvc/Project.pm
*** postgresql/src/tools/msvc/Project.pm Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/Project.pm Tue Jun 7 05:10:40 2011
*************** use strict;
*** 10,18 ****
use warnings;
use File::Basename;
! sub new
{
! my ($junk, $name, $type, $solution) = @_;
my $good_types = {
lib => 1,
exe => 1,
--- 10,18 ----
use warnings;
use File::Basename;
! sub _new
{
! my ($classname, $name, $type, $solution) = @_;
my $good_types = {
lib => 1,
exe => 1,
*************** sub new
*** 20,43 ****
};
confess("Bad project type: $type\n") unless exists $good_types->{$type};
my $self = {
! name => $name,
! type => $type,
! guid => Win32::GuidGen(),
! files => {},
! references => [],
! libraries => [],
! suffixlib => [],
! includes => '',
! prefixincludes => '',
! defines => ';',
! solution => $solution,
! disablewarnings => '4018;4244;4273;4102;4090;4267',
disablelinkerwarnings => '',
! vcver => $solution->{vcver},
! platform => $solution->{platform},
};
! bless $self;
return $self;
}
--- 20,46 ----
};
confess("Bad project type: $type\n") unless exists $good_types->{$type};
my $self = {
! name => $name,
! type => $type,
! guid => Win32::GuidGen(),
! files => {},
! references => [],
! libraries => [],
! suffixlib => [],
! includes => '',
! prefixincludes => '',
! defines => ';',
! solution => $solution,
! disablewarnings => '4018;4244;4273;4102;4090;4267',
disablelinkerwarnings => '',
!
! # vcver has to be set in derived classes
! vcver => undef,
! filenameExtension => '.vcproj',
! platform => $solution->{platform},
};
! bless($self, $classname);
return $self;
}
*************** sub Save
*** 355,371 ****
$self->DisableLinkerWarnings('4197') if ($self->{platform} eq 'x64');
# 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;
--- 358,407 ----
$self->DisableLinkerWarnings('4197') if ($self->{platform} eq 'x64');
# Dump the project
! open(F, ">$self->{name}$self->{filenameExtension}")
! || croak("Could not write to $self->{name}$self->{filenameExtension}\n");
$self->WriteHeader(*F);
! $self->WriteFiles(*F);
! $self->Footer(*F);
! close(F);
! }
!
! sub GenerateCustomTool
! {
! my ($self, $desc, $tool, $output, $cfg) = @_;
! if (!defined($cfg))
! {
! return $self->GenerateCustomTool($desc, $tool, $output, 'Debug')
! .$self->GenerateCustomTool($desc, $tool, $output, 'Release');
! }
! return
! "<FileConfiguration Name=\"$cfg|$self->{platform}\"><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 WriteFiles
! {
! my ($self, $f) = @_;
! print $f <<EOF;
<Files>
EOF
my @dirstack = ();
my %uniquefiles;
! foreach my $fileNameWithPath (sort keys %{ $self->{files} })
{
! confess "Bad format filename '$fileNameWithPath'\n"
! unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
my $dir = $1;
my $file = $2;
*************** EOF
*** 377,383 ****
last if (length($dir) == length(join('\\',@dirstack)));
last if (substr($dir, length(join('\\',@dirstack)),1) eq '\\');
}
! print F ' ' x $#dirstack . " </Filter>\n";
pop @dirstack;
}
--- 413,419 ----
last if (length($dir) == length(join('\\',@dirstack)));
last if (substr($dir, length(join('\\',@dirstack)),1) eq '\\');
}
! print $f ' ' x $#dirstack . " </Filter>\n";
pop @dirstack;
}
*************** EOF
*** 388,414 ****
$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 '>'
! . $self->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/;
! print F '>'
! . $self->GenerateCustomTool('Running flex on ' . $f,
! 'src\tools\msvc\pgflex.bat ' . $f,$of)
. '</File>' . "\n";
}
elsif (defined($uniquefiles{$file}))
--- 424,450 ----
$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=\"$fileNameWithPath\"";
! if ($fileNameWithPath =~ /\.y$/)
{
! my $of = $fileNameWithPath;
$of =~ s/\.y$/.c/;
$of =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
! print $f '>'
! . $self->GenerateCustomTool('Running bison on ' . $fileNameWithPath,
! "perl src\\tools\\msvc\\pgbison.pl $fileNameWithPath", $of)
. '</File>' . "\n";
}
! elsif ($fileNameWithPath =~ /\.l$/)
{
! my $of = $fileNameWithPath;
$of =~ s/\.l$/.c/;
! print $f '>'
! . $self->GenerateCustomTool('Running flex on ' . $fileNameWithPath,
! "perl src\\tools\\msvc\\pgflex.pl $fileNameWithPath", $of)
. '</File>' . "\n";
}
elsif (defined($uniquefiles{$file}))
*************** EOF
*** 417,423 ****
# File already exists, so fake a new name
my $obj = $dir;
$obj =~ s/\\/_/g;
! print F
"><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
. "_$file.obj\" /></FileConfiguration></File>\n";
--- 453,459 ----
# File already exists, so fake a new name
my $obj = $dir;
$obj =~ s/\\/_/g;
! print $f
"><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
. "_$file.obj\" /></FileConfiguration></File>\n";
*************** EOF
*** 425,464 ****
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 ($self, $desc, $tool, $output, $cfg) = @_;
! if (!defined($cfg))
! {
! return $self->GenerateCustomTool($desc, $tool, $output, 'Debug')
! .$self->GenerateCustomTool($desc, $tool, $output, 'Release');
! }
! return
! "<FileConfiguration Name=\"$cfg|$self->{platform}\"><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 WriteHeader
--- 461,477 ----
else
{
$uniquefiles{$file} = 1;
! print $f " />\n";
}
}
while ($#dirstack >= 0)
{
! print $f ' ' x $#dirstack . " </Filter>\n";
pop @dirstack;
}
! print $f <<EOF;
! </Files>
! EOF
}
sub WriteHeader
*************** EOF
*** 478,489 ****
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}})
--- 491,502 ----
print $f <<EOF;
</Configurations>
EOF
+ $self->WriteReferences($f);
}
! sub GetAdditionalLinkerDependencies
{
! my ($self, $cfgname, $seperator) = @_;
my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd";
my $libs = '';
foreach my $lib (@{$self->{libraries}})
*************** sub WriteConfiguration
*** 497,506 ****
last;
}
}
! $libs .= $xlib . " ";
}
! $libs =~ s/ $//;
$libs =~ s/__CFGNAME__/$cfgname/g;
my $targetmachine = $self->{platform} eq 'Win32' ? 1 : 17;
--- 510,527 ----
last;
}
}
! $libs .= $xlib . $seperator;
}
! $libs =~ s/.$//;
$libs =~ s/__CFGNAME__/$cfgname/g;
+ return $libs;
+ }
+
+ sub WriteConfiguration
+ {
+ my ($self, $f, $cfgname, $p) = @_;
+ my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4);
+ my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ' ');
my $targetmachine = $self->{platform} eq 'Win32' ? 1 : 17;
*************** sub Footer
*** 563,569 ****
my ($self, $f) = @_;
print $f <<EOF;
- </Files>
<Globals/>
</VisualStudioProject>
EOF
--- 584,589 ----
diff -Napcdr -x .git postgresql/src/tools/msvc/Solution.pm postgresql_dev/src/tools/msvc/Solution.pm
*** postgresql/src/tools/msvc/Solution.pm Tue Jun 7 05:07:51 2011
--- postgresql_dev/src/tools/msvc/Solution.pm Tue Jun 7 05:10:41 2011
*************** package Solution;
*** 8,17 ****
use Carp;
use strict;
use warnings;
! sub new
{
! my $junk = shift;
my $options = shift;
my $self = {
projects => {},
--- 8,18 ----
use Carp;
use strict;
use warnings;
+ use VSObjectFactory;
! sub _new
{
! my $classname = shift;
my $options = shift;
my $self = {
projects => {},
*************** sub new
*** 21,27 ****
vcver => undef,
platform => undef,
};
! bless $self;
# integer_datetimes is now the default
$options->{integer_datetimes} = 1
--- 22,28 ----
vcver => undef,
platform => undef,
};
! bless($self, $classname);
# integer_datetimes is now the default
$options->{integer_datetimes} = 1
*************** sub new
*** 53,80 ****
die "Bad wal_segsize $options->{wal_segsize}"
unless grep {$_ == $options->{wal_segsize}} (1,2,4,8,16,32,64);
! $self->DetermineToolVersions();
return $self;
}
! sub DetermineToolVersions
{
my $self = shift;
- # Determine version of vcbuild command, to set proper verison of visual studio
- open(P,"vcbuild /? |") || die "vcbuild command not found";
- my $line = <P>;
- close(P);
- if ($line !~ /^Microsoft\s*\(R\) Visual C\+\+ [^-]+ - \D+(\d+)\.00\.\d+/)
- {
- die "Unable to determine vcbuild version from first line of output!";
- }
- if ($1 == 8) { $self->{vcver} = '8.00' }
- elsif ($1 == 9) { $self->{vcver} = '9.00' }
- else { die "Unsupported version of Visual Studio: $1" }
- print "Detected Visual Studio version $self->{vcver}\n";
-
# Determine if we are in 32 or 64-bit mode. Do this by seeing if CL has
# 64-bit only parameters.
$self->{platform} = 'Win32';
--- 54,68 ----
die "Bad wal_segsize $options->{wal_segsize}"
unless grep {$_ == $options->{wal_segsize}} (1,2,4,8,16,32,64);
! $self->DeterminePlatform();
return $self;
}
! sub DeterminePlatform
{
my $self = shift;
# Determine if we are in 32 or 64-bit mode. Do this by seeing if CL has
# 64-bit only parameters.
$self->{platform} = 'Win32';
*************** sub AddProject
*** 428,434 ****
{
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})
--- 416,422 ----
{
my ($self, $name, $type, $folder, $initialdir) = @_;
! my $proj = VSObjectFactory::CreateProject($self->{vcver}, $name, $type, $self);
push @{$self->{projects}->{$folder}}, $proj;
$proj->AddDir($initialdir) if ($initialdir);
if ($self->{options}->{zlib})
*************** sub Save
*** 488,495 ****
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}})
--- 476,483 ----
open(SLN,">pgsql.sln") || croak "Could not write to pgsql.sln\n";
print SLN <<EOF;
! Microsoft Visual Studio Solution File, Format Version $self->{solutionFileVersion}
! # $self->{visualStudioName}
EOF
foreach my $fld (keys %{$self->{projects}})
*************** EOF
*** 497,503 ****
foreach my $proj (@{$self->{projects}->{$fld}})
{
print SLN <<EOF;
! Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$proj->{name}", "$proj->{name}.vcproj", "$proj->{guid}"
EndProject
EOF
}
--- 485,491 ----
foreach my $proj (@{$self->{projects}->{$fld}})
{
print SLN <<EOF;
! Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$proj->{name}", "$proj->{name}$proj->{filenameExtension}", "$proj->{guid}"
EndProject
EOF
}
diff -Napcdr -x .git postgresql/src/tools/msvc/VC2005Project.pm postgresql_dev/src/tools/msvc/VC2005Project.pm
*** postgresql/src/tools/msvc/VC2005Project.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VC2005Project.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,25 ----
+ package VC2005Project;
+
+ #
+ # Package that encapsulates a Visual C++ 2005 project file
+ #
+ # src/tools/msvc/VC2005Project.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Project);
+
+ sub new
+ {
+ my $classname = shift;
+ my $self = $classname->SUPER::_new(@_);
+ bless($self, $classname);
+
+ $self->{vcver} = '8.00';
+
+ return $self;
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VC2008Project.pm postgresql_dev/src/tools/msvc/VC2008Project.pm
*** postgresql/src/tools/msvc/VC2008Project.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VC2008Project.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,25 ----
+ package VC2008Project;
+
+ #
+ # Package that encapsulates a Visual C++ 2008 project file
+ #
+ # src/tools/msvc/VC2008Project.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Project);
+
+ sub new
+ {
+ my $classname = shift;
+ my $self = $classname->SUPER::_new(@_);
+ bless($self, $classname);
+
+ $self->{vcver} = '9.00';
+
+ return $self;
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VC2010Project.pm postgresql_dev/src/tools/msvc/VC2010Project.pm
*** postgresql/src/tools/msvc/VC2010Project.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VC2010Project.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,368 ----
+ package VC2010Project;
+
+ #
+ # Package that encapsulates a Visual C++ 2010 project file
+ #
+ # src/tools/msvc/VC2010Project.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Project);
+
+ sub new
+ {
+ my $classname = shift;
+ my $self = $classname->SUPER::_new(@_);
+ bless($self, $classname);
+
+ $self->{vcver} = '10.00';
+ $self->{filenameExtension} = '.vcxproj';
+
+ return $self;
+ }
+
+ sub AddDefine
+ {
+ my ($self, $def) = @_;
+
+ $self->{defines} .= $def . ';';
+ }
+
+ sub WriteReferences
+ {
+ my ($self, $f) = @_;
+
+ my @references = @{$self->{references}};
+
+ if (scalar(@references))
+ {
+ print $f <<EOF;
+ <ItemGroup>
+ EOF
+ foreach my $ref (@references)
+ {
+ print $f <<EOF;
+ <ProjectReference Include="$ref->{name}$ref->{filenameExtension}">
+ <Project>$ref->{guid}</Project>
+ </ProjectReference>
+ EOF
+ }
+ print $f <<EOF;
+ </ItemGroup>
+ EOF
+ }
+ }
+
+ sub WriteFiles
+ {
+ my ($self, $f) = @_;
+ print $f <<EOF;
+ <ItemGroup>
+ EOF
+ my @grammarFiles = ();
+ my @resourceFiles = ();
+ my %uniquefiles;
+ foreach my $fileNameWithPath (sort keys %{ $self->{files} })
+ {
+ confess "Bad format filename '$fileNameWithPath'\n"
+ unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
+ my $dir = $1;
+ my $fileName = $2;
+ if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
+ {
+ push @grammarFiles, $fileNameWithPath;
+ }
+ elsif ($fileNameWithPath =~ /\.rc$/)
+ {
+ push @resourceFiles, $fileNameWithPath;
+ }
+ elsif (defined($uniquefiles{$fileName}))
+ {
+
+ # File already exists, so fake a new name
+ my $obj = $dir;
+ $obj =~ s/\\/_/g;
+
+ print $f <<EOF;
+ <ClCompile Include="$fileNameWithPath">
+ <ObjectFileName Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">.\\debug\\$self->{name}\\${obj}_$fileName.obj</ObjectFileName>
+ <ObjectFileName Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">.\\release\\$self->{name}\\${obj}_$fileName.obj</ObjectFileName>
+ </ClCompile>
+ EOF
+ }
+ else
+ {
+ $uniquefiles{$fileName} = 1;
+ print $f <<EOF;
+ <ClCompile Include="$fileNameWithPath" />
+ EOF
+ }
+
+ }
+ print $f <<EOF;
+ </ItemGroup>
+ EOF
+ if (scalar(@grammarFiles))
+ {
+ print $f <<EOF;
+ <ItemGroup>
+ EOF
+ foreach my $grammarFile (@grammarFiles)
+ {
+ (my $outputFile = $grammarFile) =~ s/\.(y|l)$/.c/;
+ if ($grammarFile =~ /\.y$/)
+ {
+ $outputFile =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
+ print $f <<EOF;
+ <CustomBuild Include="$grammarFile">
+ <Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running bison on $grammarFile</Message>
+ <Command Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"</Command>
+ <AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
+ <Outputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
+ <Message Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">Running bison on $grammarFile</Message>
+ <Command Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"</Command>
+ <AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
+ <Outputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
+ </CustomBuild>
+ EOF
+ }
+ else #if ($grammarFile =~ /\.l$/)
+ {
+ print $f <<EOF;
+ <CustomBuild Include="$grammarFile">
+ <Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running flex on $grammarFile</Message>
+ <Command Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"</Command>
+ <AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
+ <Outputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
+ <Message Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">Running flex on $grammarFile</Message>
+ <Command Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"</Command>
+ <AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
+ <Outputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
+ </CustomBuild>
+ EOF
+ }
+ }
+ print $f <<EOF;
+ </ItemGroup>
+ EOF
+ }
+ if (scalar(@resourceFiles))
+ {
+ print $f <<EOF;
+ <ItemGroup>
+ EOF
+ foreach my $rcFile (@resourceFiles)
+ {
+ print $f <<EOF;
+ <ResourceCompile Include="$rcFile" />
+ EOF
+ }
+ print $f <<EOF;
+ </ItemGroup>
+ EOF
+ }
+ }
+
+ sub WriteHeader
+ {
+ my ($self, $f) = @_;
+
+ print $f <<EOF;
+ <?xml version="1.0" encoding="Windows-1252"?>
+ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ EOF
+ $self->WriteConfigurationHeader($f, 'Debug');
+ $self->WriteConfigurationHeader($f, 'Release');
+ print $f <<EOF;
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>$self->{guid}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
+ EOF
+ $self->WriteConfigurationPropertyGroup($f, 'Release',{ wholeopt=>'false' });
+ $self->WriteConfigurationPropertyGroup($f, 'Debug',{ wholeopt=>'false' });
+ print $f <<EOF;
+ <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ EOF
+ $self->WritePropertySheetsPropertyGroup($f, 'Release');
+ $self->WritePropertySheetsPropertyGroup($f, 'Debug');
+ print $f <<EOF;
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ EOF
+ $self->WriteAdditionalProperties($f, 'Debug');
+ $self->WriteAdditionalProperties($f, 'Release');
+ print $f <<EOF;
+ </PropertyGroup>
+ EOF
+ $self->WriteItemDefinitionGroup(
+ $f, 'Debug',
+ {
+ defs=>'_DEBUG;DEBUG=1;',
+ opt=>'Disabled',
+ strpool=>'false',
+ runtime=>'MultiThreadedDebugDLL'
+ }
+ );
+ $self->WriteItemDefinitionGroup($f, 'Release',
+ { defs=>'', opt=>'Full', strpool=>'true', runtime=>'MultiThreadedDLL' });
+ }
+
+ sub WriteConfigurationHeader
+ {
+ my ($self, $f, $cfgname) = @_;
+ print $f <<EOF;
+ <ProjectConfiguration Include="$cfgname|$self->{platform}">
+ <Configuration>$cfgname</Configuration>
+ <Platform>$self->{platform}</Platform>
+ </ProjectConfiguration>
+ EOF
+ }
+
+ sub WriteConfigurationPropertyGroup
+ {
+ my ($self, $f, $cfgname, $p) = @_;
+ my $cfgtype =
+ ($self->{type} eq "exe")
+ ?'Application'
+ :($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
+
+ print $f <<EOF;
+ <PropertyGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" Label="Configuration">
+ <ConfigurationType>$cfgtype</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
+ </PropertyGroup>
+ EOF
+ }
+
+ sub WritePropertySheetsPropertyGroup
+ {
+ my ($self, $f, $cfgname) = @_;
+ print $f <<EOF;
+ <ImportGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" Label="PropertySheets">
+ <Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ EOF
+ }
+
+ sub WriteAdditionalProperties
+ {
+ my ($self, $f, $cfgname) = @_;
+ print $f <<EOF;
+ <OutDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</OutDir>
+ <IntDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</IntDir>
+ <LinkIncremental Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">false</LinkIncremental>
+ EOF
+ }
+
+ sub WriteItemDefinitionGroup
+ {
+ my ($self, $f, $cfgname, $p) = @_;
+ my $cfgtype =
+ ($self->{type} eq "exe")
+ ?'Application'
+ :($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
+ my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';');
+
+ my $targetmachine = $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
+
+ my $includes = $self->{includes};
+ unless ($includes eq '' or $includes =~ /;$/)
+ {
+ $includes .= ';';
+ }
+ print $f <<EOF;
+ <ItemDefinitionGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">
+ <ClCompile>
+ <Optimization>$p->{opt}</Optimization>
+ <AdditionalIncludeDirectories>$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$includes\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}\%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>$p->{strpool}</StringPooling>
+ <RuntimeLibrary>$p->{runtime}</RuntimeLibrary>
+ <DisableSpecificWarnings>$self->{disablewarnings};\%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalOptions>/MP \%(AdditionalOptions)</AdditionalOptions>
+ <AssemblerOutput>
+ </AssemblerOutput>
+ <AssemblerListingLocation>.\\$cfgname\\$self->{name}\\</AssemblerListingLocation>
+ <ObjectFileName>.\\$cfgname\\$self->{name}\\</ObjectFileName>
+ <ProgramDataBaseFileName>.\\$cfgname\\$self->{name}\\</ProgramDataBaseFileName>
+ <BrowseInformation>false</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <Link>
+ <OutputFile>.\\$cfgname\\$self->{name}\\$self->{name}.$self->{type}</OutputFile>
+ <AdditionalDependencies>$libs;\%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalLibraryDirectories>\%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <IgnoreSpecificDefaultLibraries>libc;\%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <StackReserveSize>4194304</StackReserveSize>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\\$cfgname\\$self->{name}\\$self->{name}.pdb</ProgramDatabaseFile>
+ <GenerateMapFile>false</GenerateMapFile>
+ <MapFileName>.\\$cfgname\\$self->{name}\\$self->{name}.map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>$targetmachine</TargetMachine>
+ EOF
+ if ($self->{disablelinkerwarnings})
+ {
+ print $f
+ " <AdditionalOptions>/ignore:$self->{disablelinkerwarnings} \%(AdditionalOptions)</AdditionalOptions>\n";
+ }
+ if ($self->{implib})
+ {
+ my $l = $self->{implib};
+ $l =~ s/__CFGNAME__/$cfgname/g;
+ print $f " <ImportLibrary>$l</ImportLibrary>\n";
+ }
+ if ($self->{def})
+ {
+ my $d = $self->{def};
+ $d =~ s/__CFGNAME__/$cfgname/g;
+ print $f " <ModuleDefinitionFile>$d</ModuleDefinitionFile>\n";
+ }
+ print $f <<EOF;
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>src\\include;\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ EOF
+ if ($self->{builddef})
+ {
+ print $f <<EOF;
+ <PreLinkEvent>
+ <Message>Generate DEF file</Message>
+ <Command>perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}</Command>
+ </PreLinkEvent>
+ EOF
+ }
+ print $f <<EOF;
+ </ItemDefinitionGroup>
+ EOF
+ }
+
+ sub Footer
+ {
+ my ($self, $f) = @_;
+ $self->WriteReferences($f);
+
+ print $f <<EOF;
+ <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ </Project>
+ EOF
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VS2005Solution.pm postgresql_dev/src/tools/msvc/VS2005Solution.pm
*** postgresql/src/tools/msvc/VS2005Solution.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VS2005Solution.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,27 ----
+ package VS2005Solution;
+
+ #
+ # Package that encapsulates a Visual Studio 2005 solution file
+ #
+ # src/tools/msvc/VS2005Solution.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Solution);
+
+ sub new
+ {
+ my $classname = shift;
+ my $self = $classname->SUPER::_new(@_);
+ bless($self, $classname);
+
+ $self->{solutionFileVersion} = '9.00';
+ $self->{vcver} = '8.00';
+ $self->{visualStudioName} = 'Visual Studio 2005';
+
+ return $self;
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VS2008Solution.pm postgresql_dev/src/tools/msvc/VS2008Solution.pm
*** postgresql/src/tools/msvc/VS2008Solution.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VS2008Solution.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,27 ----
+ package VS2008Solution;
+
+ #
+ # Package that encapsulates a Visual Studio 2008 solution file
+ #
+ # src/tools/msvc/VS2008Solution.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Solution);
+
+ sub new
+ {
+ my $classname = shift;
+ my $self = $classname->SUPER::_new(@_);
+ bless($self, $classname);
+
+ $self->{solutionFileVersion} = '10.00';
+ $self->{vcver} = '9.00';
+ $self->{visualStudioName} = 'Visual Studio 2008';
+
+ return $self;
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VS2010Solution.pm postgresql_dev/src/tools/msvc/VS2010Solution.pm
*** postgresql/src/tools/msvc/VS2010Solution.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VS2010Solution.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,27 ----
+ package VS2010Solution;
+
+ #
+ # Package that encapsulates a Visual Studio 2010 solution file
+ #
+ # src/tools/msvc/VS2010Solution.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Solution);
+
+ sub new
+ {
+ my $classname = shift;
+ my $self = $classname->SUPER::_new(@_);
+ bless($self, $classname);
+
+ $self->{solutionFileVersion} = '11.00';
+ $self->{vcver} = '10.00';
+ $self->{visualStudioName} = 'Visual Studio 2010';
+
+ return $self;
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VSObjectFactory.pm postgresql_dev/src/tools/msvc/VSObjectFactory.pm
*** postgresql/src/tools/msvc/VSObjectFactory.pm Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/VSObjectFactory.pm Tue Jun 7 05:10:41 2011
***************
*** 0 ****
--- 1,126 ----
+ package VSObjectFactory;
+
+ #
+ # Package that creates Visual Studio wrapper objects for msvc build
+ #
+ # src/tools/msvc/VSObjectFactory.pm
+ #
+
+ use Carp;
+ use strict;
+ use warnings;
+
+ use Exporter;
+ use Project;
+ use Solution;
+ use VC2005Project;
+ use VC2008Project;
+ use VC2010Project;
+ use VS2005Solution;
+ use VS2008Solution;
+ use VS2010Solution;
+
+ our (@ISA, @EXPORT_OK);
+ @ISA = qw(Exporter);
+ @EXPORT_OK = qw(CreateSolution CreateProject DetermineVisualStudioVersion);
+
+ sub CreateSolution
+ {
+ my $visualStudioVersion = shift;
+
+ if (!defined($visualStudioVersion))
+ {
+ $visualStudioVersion = DetermineVisualStudioVersion();
+ }
+
+ if ($visualStudioVersion eq '8.00')
+ {
+ return new VS2005Solution(@_);
+ }
+ elsif ($visualStudioVersion eq '9.00')
+ {
+ return new VS2008Solution(@_);
+ }
+ elsif ($visualStudioVersion eq '10.00')
+ {
+ return new VS2010Solution(@_);
+ }
+ else
+ {
+ croak "The requested Visual Studio version is not supported.";
+ }
+ }
+
+ sub CreateProject
+ {
+ my $visualStudioVersion = shift;
+
+ if (!defined($visualStudioVersion))
+ {
+ $visualStudioVersion = DetermineVisualStudioVersion();
+ }
+
+ if ($visualStudioVersion eq '8.00')
+ {
+ return new VC2005Project(@_);
+ }
+ elsif ($visualStudioVersion eq '9.00')
+ {
+ return new VC2008Project(@_);
+ }
+ elsif ($visualStudioVersion eq '10.00')
+ {
+ return new VC2010Project(@_);
+ }
+ else
+ {
+ croak "The requested Visual Studio version is not supported.";
+ }
+ }
+
+ sub DetermineVisualStudioVersion
+ {
+ my $nmakeVersion = shift;
+
+ if (!defined($nmakeVersion))
+ {
+
+ # Determine version of nmake command, to set proper verison of visual studio
+ # we use nmake as it has existed for a long time and still exists in visual studio 2010
+ open(P,"nmake /? 2>&1 |")
+ || croak "Unable to determine Visual Studio version: The nmake command wasn't found.";
+ while(<P>)
+ {
+ chomp;
+ if (/(\d+)\.(\d+)\.\d+(\.\d+)?$/)
+ {
+ return _GetVisualStudioVersion($1, $2);
+ }
+ }
+ close(P);
+ }
+ elsif($nmakeVersion =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/)
+ {
+ return _GetVisualStudioVersion($1, $2);
+ }
+ croak "Unable to determine Visual Studio version: The nmake version could not be determined.";
+ }
+
+ sub _GetVisualStudioVersion
+ {
+ my($major, $minor) = @_;
+ if ($major > 10)
+ {
+ carp
+ "The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
+ return '10.00';
+ }
+ elsif ($major < 6)
+ {
+ croak
+ "Unable to determine Visual Studio version: Visual Studio versions before 6.0 aren't supported.";
+ }
+ return "$major.$minor";
+ }
+
+ 1;
diff -Napcdr -x .git postgresql/src/tools/msvc/build.pl postgresql_dev/src/tools/msvc/build.pl
*** postgresql/src/tools/msvc/build.pl Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/build.pl Tue Jun 7 05:10:39 2011
*************** our $config;
*** 33,39 ****
require "config_default.pl";
require "config.pl" if (-f "src/tools/msvc/config.pl");
! Mkvcbuild::mkvcbuild($config);
# check what sort of build we are doing
--- 33,39 ----
require "config_default.pl";
require "config.pl" if (-f "src/tools/msvc/config.pl");
! my $vcver = Mkvcbuild::mkvcbuild($config);
# check what sort of build we are doing
*************** elsif ($ARGV[0] ne "RELEASE")
*** 50,56 ****
# ... and do it
! if ($buildwhat)
{
system("vcbuild $buildwhat.vcproj $bconf");
}
--- 50,60 ----
# ... and do it
! if ($buildwhat and $vcver eq '10.00')
! {
! system("msbuild $buildwhat.vcxproj /verbosity:detailed /p:Configuration=$bconf");
! }
! elsif ($buildwhat)
{
system("vcbuild $buildwhat.vcproj $bconf");
}
diff -Napcdr -x .git postgresql/src/tools/msvc/builddoc.pl postgresql_dev/src/tools/msvc/builddoc.pl
*** postgresql/src/tools/msvc/builddoc.pl Tue Jun 7 05:07:51 2011
--- postgresql_dev/src/tools/msvc/builddoc.pl Tue Jun 7 05:10:39 2011
*************** $cmd =
*** 69,76 ****
."| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
print "Running collateindex...\n";
! $cmd ="perl \"$docroot/$dsssl/bin/collateindex.pl\" -f -g -i bookindex "
! ."-o bookindex.sgml HTML.index";
system($cmd);
die "collateindex" if $?;
mkdir "html";
--- 69,76 ----
."| findstr /V \"DTDDECL catalog entries are not supported\" ";
system($cmd); # die "openjade" if $?;
print "Running collateindex...\n";
! $cmd =
! "perl \"$docroot/$dsssl/bin/collateindex.pl\" -f -g -i bookindex "."-o bookindex.sgml HTML.index";
system($cmd);
die "collateindex" if $?;
mkdir "html";
diff -Napcdr -x .git postgresql/src/tools/msvc/clean.bat postgresql_dev/src/tools/msvc/clean.bat
*** postgresql/src/tools/msvc/clean.bat Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/clean.bat Tue Jun 7 05:08:23 2011
*************** if exist ..\msvc if exist ..\..\..\src c
*** 10,17 ****
--- 10,21 ----
if exist debug rd /s /q debug
if exist release rd /s /q release
for %%f in (*.vcproj) do del %%f
+ for %%f in (*.vcxproj) do del %%f
+ for %%f in (*.vcxproj.user) do del %%f
if exist pgsql.sln del /q pgsql.sln
if exist pgsql.sln.cache del /q pgsql.sln.cache
+ if exist pgsql.sdf del /q pgsql.sdf
+ if exist pgsql.suo del /q /a:H pgsql.suo
del /s /q src\bin\win32ver.rc 2> NUL
del /s /q src\interfaces\win32ver.rc 2> NUL
if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
diff -Napcdr -x .git postgresql/src/tools/msvc/pgbison.bat postgresql_dev/src/tools/msvc/pgbison.bat
*** postgresql/src/tools/msvc/pgbison.bat Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/pgbison.bat Thu Jan 1 00:00:00 1970
***************
*** 1,51 ****
- @echo off
- REM src/tools/msvc/pgbison.bat
-
- IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
- perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
- CALL bldenv.bat
- del bldenv.bat
- :nobuildenv
-
- SET BV=
- for /F "tokens=4 usebackq" %%f in (`bison -V`) do if "!BV!"=="" SET BV=%%f
- if "%BV%"=="" goto novarexp
- if %BV% EQU 1.875 goto bisonok
- if %BV% GEQ 2.2 goto bisonok
- goto nobison
- :bisonok
-
- if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\backend\parser\gram.h
- if "%1" == "src\backend\bootstrap\bootparse.y" call :generate %1 src\backend\bootstrap\bootparse.c
- if "%1" == "src\backend\replication\repl_gram.y" call :generate %1 src\backend\replication\repl_gram.c
- if "%1" == "src\pl\plpgsql\src\gram.y" call :generate %1 src\pl\plpgsql\src\pl_gram.c src\pl\plpgsql\src\pl_gram.h
- if "%1" == "src\test\isolation\specparse.y" call :generate %1 src\test\isolation\specparse.c
- if "%1" == "src\interfaces\ecpg\preproc\preproc.y" call :generate %1 src\interfaces\ecpg\preproc\preproc.c src\interfaces\ecpg\preproc\preproc.h
- if "%1" == "contrib\cube\cubeparse.y" call :generate %1 contrib\cube\cubeparse.c
- if "%1" == "contrib\seg\segparse.y" call :generate %1 contrib\seg\segparse.c
-
- echo Unknown bison input: %1
- exit 1
-
- :generate
- SET fn=%1
- SET cf=%2
- bison.exe -d %fn% -o %cf%
- if errorlevel 1 exit 1
- SET hf=%cf:~0,-2%.h
- if not "%hf%"=="%3" (
- copy /y %hf% %3
- if errorlevel 1 exit 1
- del %hf%
- )
- exit 0
-
-
- :novarexp
- echo pgbison must be called with cmd /V:ON /C pgbison to work!
- exit 1
-
- :nobison
- echo WARNING! Bison install not found, or unsupported Bison version.
- echo Attempting to build without.
- exit 0
--- 0 ----
diff -Napcdr -x .git postgresql/src/tools/msvc/pgbison.pl postgresql_dev/src/tools/msvc/pgbison.pl
*** postgresql/src/tools/msvc/pgbison.pl Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/pgbison.pl Tue Jun 7 05:10:39 2011
***************
*** 0 ****
--- 1,92 ----
+ #!/usr/bin/perl
+
+ use strict;
+ use warnings;
+
+ require 'src/tools/msvc/buildenv.pl' if (-e 'src/tools/msvc/buildenv.pl');
+
+ checkBison();
+ my $inputFile = $ARGV[0];
+
+ unless (defined($inputFile))
+ {
+ die "Bison input file is missing.\n";
+ }
+ elsif ($inputFile eq 'src\backend\parser\gram.y')
+ {
+ generate($inputFile, 'src\backend\parser\gram.c', 'src\backend\parser\gram.h');
+ }
+ elsif ($inputFile eq 'src\backend\bootstrap\bootparse.y')
+ {
+ generate($inputFile, 'src\backend\bootstrap\bootparse.c');
+ }
+ elsif ($inputFile eq 'src\backend\replication\repl_gram.y')
+ {
+ generate($inputFile, 'src\backend\replication\repl_gram.c');
+ }
+ elsif ($inputFile eq 'src\pl\plpgsql\src\gram.y')
+ {
+ generate($inputFile, 'src\pl\plpgsql\src\pl_gram.c', 'src\pl\plpgsql\src\pl_gram.h');
+ }
+ elsif ($inputFile eq 'src\test\isolation\specparse.y')
+ {
+ generate($inputFile, 'src\test\isolation\specparse.c');
+ }
+ elsif ($inputFile eq 'src\interfaces\ecpg\preproc\preproc.y')
+ {
+ generate(
+ $inputFile,
+ 'src\interfaces\ecpg\preproc\preproc.c',
+ 'src\interfaces\ecpg\preproc\preproc.h'
+ );
+ }
+ elsif ($inputFile eq 'contrib\cube\cubeparse.y')
+ {
+ generate($inputFile, 'contrib\cube\cubeparse.c');
+ }
+ elsif ($inputFile eq 'contrib\seg\segparse.y')
+ {
+ generate($inputFile, 'contrib\seg\segparse.c');
+ }
+ else
+ {
+ die "Unknown bison input: $inputFile\n";
+ }
+
+ sub generate
+ {
+ my($input, $output1, $output2) = @_;
+ system("bison -d \"$input\" -o \"$output1\"") == 0
+ || die "ERROR! bison -d \"$input\" -o \"$output1\" failed: $?\n";
+
+ (my $headerFile = $output1) =~ s/\.c$/.h/;
+
+ if (defined($output2) && $headerFile ne $output2)
+ {
+ system("copy /y \"$headerFile\" \"$output2\"") == 0
+ || die "ERROR! copy /y \"$headerFile\" \"$output2\" failed: $?\n";
+ unlink($headerFile);
+ }
+ }
+
+ sub checkBison
+ {
+ open(P,'bison -V 2>&1 |')
+ || die "WARNING! Bison install not found. Attempting to build without.\n";
+ while(<P>)
+ {
+ chomp;
+ if (/(\d+)\.(\d+)(\.\d+)?$/)
+ {
+ my $bisonVersion = "$1.$2";
+ unless ($bisonVersion == 1.875 || $bisonVersion >= 2.2)
+ {
+ die "WARNING! Unsupported Bison version. Attempting to build without.\n";
+ }
+ return;
+ }
+ }
+ close(P);
+ die
+ "WARNING! Bison install not found or unable to determine Bison version. Attempting to build without.\n";
+ }
diff -Napcdr -x .git postgresql/src/tools/msvc/pgflex.bat postgresql_dev/src/tools/msvc/pgflex.bat
*** postgresql/src/tools/msvc/pgflex.bat Tue Jun 7 05:05:52 2011
--- postgresql_dev/src/tools/msvc/pgflex.bat Thu Jan 1 00:00:00 1970
***************
*** 1,45 ****
- @echo off
- REM src/tools/msvc/pgflex.bat
-
- REM silence flex bleatings about file path style
- SET CYGWIN=nodosfilewarning
-
- IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
- perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
- CALL bldenv.bat
- del bldenv.bat
- :nobuildenv
-
- flex -V > NUL
- if errorlevel 1 goto noflex
-
- if "%1" == "src\backend\parser\scan.l" call :generate %1 src\backend\parser\scan.c -CF
- if "%1" == "src\backend\bootstrap\bootscanner.l" call :generate %1 src\backend\bootstrap\bootscanner.c
- if "%1" == "src\backend\utils\misc\guc-file.l" call :generate %1 src\backend\utils\misc\guc-file.c
- if "%1" == "src\backend\replication\repl_scanner.l" call :generate %1 src\backend\replication\repl_scanner.c
- if "%1" == "src\test\isolation\specscanner.l" call :generate %1 src\test\isolation\specscanner.c
- if "%1" == "src\interfaces\ecpg\preproc\pgc.l" call :generate %1 src\interfaces\ecpg\preproc\pgc.c
- if "%1" == "src\bin\psql\psqlscan.l" call :generate %1 src\bin\psql\psqlscan.c
- if "%1" == "contrib\cube\cubescan.l" call :generate %1 contrib\cube\cubescan.c
- if "%1" == "contrib\seg\segscan.l" call :generate %1 contrib\seg\segscan.c
-
- echo Unknown flex input: %1
- exit 1
-
- REM For non-reentrant scanners we need to fix up the yywrap macro definition
- REM to keep the MS compiler happy.
- REM For reentrant scanners (like the core scanner) we do not
- REM need to (and must not) change the yywrap definition.
- :generate
- flex %3 -o%2 %1
- if errorlevel 1 exit %errorlevel%
- perl -n -e "exit 1 if /^\%%option\s+reentrant/;" %1
- if errorlevel 1 exit 0
- perl -pi.bak -e "s/yywrap\(n\)/yywrap()/;" %2
- if errorlevel 1 exit %errorlevel%
- del %2.bak
- exit 0
-
- :noflex
- echo WARNING! flex install not found, attempting to build without
- exit 0
--- 0 ----
diff -Napcdr -x .git postgresql/src/tools/msvc/pgflex.pl postgresql_dev/src/tools/msvc/pgflex.pl
*** postgresql/src/tools/msvc/pgflex.pl Thu Jan 1 00:00:00 1970
--- postgresql_dev/src/tools/msvc/pgflex.pl Tue Jun 7 05:10:39 2011
***************
*** 0 ****
--- 1,137 ----
+ #!/usr/bin/perl
+
+ use strict;
+ use warnings;
+
+ require 'src/tools/msvc/buildenv.pl' if (-e 'src/tools/msvc/buildenv.pl');
+
+ checkFlex();
+ my $inputFile = $ARGV[0];
+
+ unless (defined($inputFile))
+ {
+ die "Flex input file is missing.\n";
+ }
+ elsif ($inputFile eq 'src\backend\parser\scan.l')
+ {
+ generate($inputFile, 'src\backend\parser\scan.c', '-CF ');
+ }
+ elsif ($inputFile eq 'src\backend\bootstrap\bootscanner.l')
+ {
+ generate($inputFile, 'src\backend\bootstrap\bootscanner.c');
+ }
+ elsif ($inputFile eq 'src\backend\utils\misc\guc-file.l')
+ {
+ generate($inputFile, 'src\backend\utils\misc\guc-file.c');
+ }
+ elsif ($inputFile eq 'src\backend\replication\repl_scanner.l')
+ {
+ generate($inputFile, 'src\backend\replication\repl_scanner.c');
+ }
+ elsif ($inputFile eq 'src\test\isolation\specscanner.l')
+ {
+ generate($inputFile, 'src\test\isolation\specscanner.c');
+ }
+ elsif ($inputFile eq 'src\interfaces\ecpg\preproc\pgc.l')
+ {
+ generate($inputFile, 'src\interfaces\ecpg\preproc\pgc.c');
+ }
+ elsif ($inputFile eq 'src\bin\psql\psqlscan.l')
+ {
+ generate($inputFile, 'src\bin\psql\psqlscan.c');
+ }
+ elsif ($inputFile eq 'contrib\cube\cubescan.l')
+ {
+ generate($inputFile, 'contrib\cube\cubescan.c');
+ }
+ elsif ($inputFile eq 'contrib\seg\segscan.l')
+ {
+ generate($inputFile, 'contrib\seg\segscan.c');
+ }
+ else
+ {
+ die "Unknown flex input: $inputFile\n";
+ }
+
+ sub generate
+ {
+ my($input, $output, $flags) = @_;
+
+ $flags = '' unless defined($flags);
+
+ my $errorlevel = system("flex $flags-o\"$output\" \"$input\"");
+ if ($errorlevel == 1)
+ {
+ exit $errorlevel;
+ }
+
+ # For non-reentrant scanners we need to fix up the yywrap macro definition
+ # to keep the MS compiler happy.
+ # For reentrant scanners (like the core scanner) we do not
+ # need to (and must not) change the yywrap definition.
+ if (is_reentrant($input))
+ {
+ exit 0;
+ }
+ fix_yywrap($output);
+ exit 0;
+ }
+
+ sub is_reentrant
+ {
+ my $input = shift;
+ open(INFILE, "<$input");
+ while (<INFILE>)
+ {
+ if (/^\%option\s+reentrant/)
+ {
+ close(INFILE);
+ return 1;
+ }
+ }
+ close(INFILE);
+ return 0;
+ }
+
+ sub fix_yywrap
+ {
+ my $output = shift;
+ my $backup = $output . '.bak';
+ rename($output, $backup);
+ eval {
+ open(INFILE, "<$backup");
+ open(OUTFILE, ">$output");
+ while (<INFILE>)
+ {
+ s/yywrap\(n\)/yywrap()/;
+ print OUTFILE;
+ }
+ close(OUTFILE);
+ close(INFILE);
+ };
+ exit 1 if $@;
+
+ unlink($backup);
+ }
+
+ sub checkFlex
+ {
+ open(P,'flex -V 2>&1 |')
+ || die "WARNING! Flex install not found. Attempting to build without.\n";
+ while(<P>)
+ {
+ chomp;
+ if (/(\d+)\.(\d+)\.(\d+)$/)
+ {
+ my $flexVersion = "$1.$2";
+ if ($flexVersion < 2.5 || ($flexVersion == 2.5 && $3 < 31))
+ {
+ die "WARNING! Unsupported Flex version. Attempting to build without.\n";
+ }
+ return;
+ }
+ }
+ close(P);
+ die
+ "WARNING! Flex install not found or unable to determine Flex version. Attempting to build without.\n";
+ }
Hi Brar,
Thanks for sharing your work compiling Postgres with VS2010. I see that
there's a patch file you created to fix the files that need fixing to do so,
but I don't know how to apply this patch. What's the exe that runs this
patch? Will it ask me where the source folder root is when I run it?
Thanks for your help!
Mike
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Visual-Studio-2010-Windows-SDK-7-1-support-tp3325421p4929680.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.
thready wrote:
[...]
I don't know how to apply this patch. What's the exe that runs this
patch? Will it ask me where the source folder root is when I run it?
As the archives seem to be unreachable at the moment I'm copying text
from the following message which I would otherwise ask you to read:
http://archives.postgresql.org/message-id/4E2813EC.2050505@gmx.de
<CITATION>
In short (for the records): download and install msysgit from
http://code.google.com/p/msysgit/downloads/list
Open git bash and cd into an empty directory like:
cd c:
mkdir pgdev
cd pgdev
Clone the postgresql repository:
git clone git://git.postgresql.org/git/postgresql.git
cd postgresql
Copy the patch (the part with the strange perl-like text of the
message) from
http://archives.postgresql.org/message-id/4E14FD1A.8080703@gmx.de and
save it to a file (like VS2010v9.patch) which you put into the directory
which contains your newly created repository (c:\pgdev).
Apply the Patch:
patch -Ec -p 1 -i ../VS2010v9.patch
(which doesn't seem to apply cleanly anymore which will break things for
you - but I currently have no time to fix it)
Put bison and flex into your path like:
echo "\$ENV{PATH}=\$ENV{PATH} . ';C:\Program Files (x86)\Git\bin';" >
src/tools/msvc/buildenv.pl
(you might have to adopt the path)
Open a Visual Studio 2010 command prompt and cd into the src/tools/msvc
directory of your repository like:
cd C:\pgdev\postgresql\src\tools\msvc
Start the build:
build.bat
</CITATION>
Please use the commitfest app
(https://commitfest.postgresql.org/action/patch_view?id=523) to find out
about the current state of the patch and to get the latest version.
If you have problems applying the patch when copied from the archives
(v10 -
http://archives.postgresql.org/message-id/4E837B20.4020502@gmx.de),
please drop me a line and I'll send you the latest version off list.
Regards,
Brar