On Mon, Sep 5, 2016 at 9:18 AM, Noah Misch <n...@leadboat.com> wrote:
> On Wed, Apr 27, 2016 at 08:15:05AM +0000, Christian Ullrich wrote:
>> * From: Michael Paquier [mailto:michael.paqu...@gmail.com]
>>
>> > On Wed, Apr 27, 2016 at 4:06 PM, Christian Ullrich <ch...@chrullrich.net>
>> > wrote:
>>
>> > > * From: Michael Paquier [mailto:michael.paqu...@gmail.com]
>>
>> > >> vcbuild also supports /m. Wouldn't it make sense to have a environment
>> > >> variable flag for it as well? vcbuild has been replaced by msbuild in
>> > >> VS2010 but I would think that in back-branches this would have value
>> > >> for users still compiling with VS2008 or older, and those are still
>> > >> supported things.
>> > >
>> > > Good point, but I have no installation of 2008 around, so I cannot test
>> > > it. Perhaps there is someone around who could do that (just add the
>> > > $msbflags as the first argument to vcbuild)?
>> >
>> > I forgot that I have actually one! Bumping my Win7 VM CPU from 1 to 2,
>> > and using VS2008 command prompt with vcbuild /m I am not seeing
>> > issues. Moving symbols.out would be the main issue, but I am not
>> > noticing problems related to that.
>>
>> OK then, hopefully last round attached.
>
> Every vcbuild and msbuild invocation ought to recognize this variable, so
> please update the two places involving ecpg_regression.proj.  Apart from that,
> the patch looks good.

Good catch. I did not notice those during my lookups of those patches.
Not my intention to bump into Christian's feet, but here are updated
patches.

Actually, is that worth adding for clean.bat? I doubt that many people
would care if MSBFLAGS is not supported in it. The cleanup script is
not the bottleneck, the build script is. I added it in the patch 0001
attached but I doubt that's worth it to be honest.
-- 
Michael
From aaf028d2fab130d908a4efcd3c6316b4e2c3fdd7 Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@otacoo.com>
Date: Mon, 5 Sep 2016 14:36:31 +0900
Subject: [PATCH 1/2] Support passing arbitrary arguments to MSBuild/VCBuild.

This is particularly useful to pass /m, to perform a parallel build.
---
 doc/src/sgml/install-windows.sgml | 11 ++++++++++-
 src/tools/msvc/build.pl           |  7 ++++---
 src/tools/msvc/clean.bat          |  2 +-
 src/tools/msvc/vcregress.pl       |  3 ++-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
index 8cd189c..f656c66 100644
--- a/doc/src/sgml/install-windows.sgml
+++ b/doc/src/sgml/install-windows.sgml
@@ -145,6 +145,14 @@ $ENV{PATH}=$ENV{PATH} . ';c:\some\where\bison\bin';
 </programlisting>
  </para>
 
+ <para>
+  To pass additional command line arguments to the Visual Studio build
+  command (msbuild or vcbuild):
+<programlisting>
+$ENV{MSBFLAGS}="/m";
+</programlisting>
+ </para>
+
  <sect2>
   <title>Requirements</title>
   <para>
@@ -401,7 +409,8 @@ $ENV{CONFIG}="Debug";
    all generated files. You can also run it with the
    <parameter>dist</parameter> parameter, in which case it will behave like
    <userinput>make distclean</userinput> and remove the flex/bison output files
-   as well.
+   as well. Additional flags can be passed to this script for commands of
+   msbuild and vcbuild using the environment variable <literal>MSBFLAGS</>.
   </para>
 
   <para>
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
index 007e3c7..5273977 100644
--- a/src/tools/msvc/build.pl
+++ b/src/tools/msvc/build.pl
@@ -38,6 +38,7 @@ my $vcver = Mkvcbuild::mkvcbuild($config);
 # check what sort of build we are doing
 
 my $bconf     = $ENV{CONFIG} || "Release";
+my $msbflags  = $ENV{MSBFLAGS} || "";
 my $buildwhat = $ARGV[1]     || "";
 if (uc($ARGV[0]) eq 'DEBUG')
 {
@@ -53,16 +54,16 @@ elsif (uc($ARGV[0]) ne "RELEASE")
 if ($buildwhat and $vcver >= 10.00)
 {
 	system(
-		"msbuild $buildwhat.vcxproj /verbosity:normal /p:Configuration=$bconf"
+		"msbuild $buildwhat.vcxproj $msbflags /verbosity:normal /p:Configuration=$bconf"
 	);
 }
 elsif ($buildwhat)
 {
-	system("vcbuild $buildwhat.vcproj $bconf");
+	system("vcbuild $msbflags $buildwhat.vcproj $bconf");
 }
 else
 {
-	system("msbuild pgsql.sln /verbosity:normal /p:Configuration=$bconf");
+	system("msbuild pgsql.sln $msbflags /verbosity:normal /p:Configuration=$bconf");
 }
 
 # report status
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index 469b8a2..e21e37f 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -107,6 +107,6 @@ REM for /r %%f in (*.sql) do if exist %%f.in del %%f
 cd %D%
 
 REM Clean up ecpg regression test files
-msbuild /NoLogo ecpg_regression.proj /t:clean /v:q
+msbuild %MSBFLAGS% /NoLogo ecpg_regression.proj /t:clean /v:q
 
 goto :eof
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index b4f9464..bcf2267 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -138,8 +138,9 @@ sub check
 
 sub ecpgcheck
 {
+	my $msbflags  = $ENV{MSBFLAGS} || "";
 	chdir $startdir;
-	system("msbuild ecpg_regression.proj /p:config=$Config");
+	system("msbuild ecpg_regression.proj $msbflags /p:config=$Config");
 	my $status = $? >> 8;
 	exit $status if $status;
 	InstallTemp();
-- 
2.9.3

From 03674527c26c1baf3a7dcc2032b8495d9f532b22 Mon Sep 17 00:00:00 2001
From: Christian Ullrich <ch...@chrullrich.net>
Date: Tue, 26 Apr 2016 14:52:53 +0200
Subject: [PATCH 2/2] Make gendef.pl work in MSVC parallel build

gendef.pl now puts the temporary output file into the target directory instead of the source tree root, to avoid collisions.
---
 src/tools/msvc/gendef.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl
index 8ccaab3..4bd05fa 100644
--- a/src/tools/msvc/gendef.pl
+++ b/src/tools/msvc/gendef.pl
@@ -4,6 +4,7 @@ use warnings;
 use strict;
 use 5.8.0;
 use List::Util qw(max);
+use File::Spec::Functions qw(splitpath catpath);
 
 #
 # Script that generates a .DEF file for all objects in a directory
@@ -14,9 +15,11 @@ use List::Util qw(max);
 sub dumpsyms
 {
 	my ($objfile, $symfile) = @_;
-	system("dumpbin /symbols /out:symbols.out $_ >NUL")
+	my ($symvol, $symdirs, $symbase) = splitpath($symfile);
+	my $tmpfile = catpath($symvol, $symdirs, "symbols.out");
+	system("dumpbin /symbols /out:$tmpfile $_ >NUL")
 	  && die "Could not call dumpbin";
-	rename("symbols.out", $symfile);
+	rename($tmpfile, $symfile);
 }
 
 # Given a symbol file path, loops over its contents
-- 
2.9.3

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to