On Mon, May 04, 2020 at 03:42:20PM +0200, Juan José Santamaría Flecha wrote:
> +1, seems like the way to go to me.

Attached is a patch for that and I have gone with a simple solution,
with some bonus comments about the way things happen.  Here are the
patterns I tested for build.pl and the commands it generates, making
sure that we have the same commands with HEAD and the patch:
1) perl build.pl
msbuild pgsql.sln /verbosity:normal  /p:Configuration=Release
2) perl build.pl debug
msbuild pgsql.sln /verbosity:normal  /p:Configuration=Debug
3) perl build.pl release
msbuild pgsql.sln /verbosity:normal  /p:Configuration=Release
4) perl build.pl foo
msbuild foo.vcxproj /verbosity:normal  /p:Configuration=Release
5) perl build.pl debug foo
msbuild foo.vcxproj /verbosity:normal  /p:Configuration=Debug
6) perl build.pl release foo
msbuild foo.vcxproj /verbosity:normal  /p:Configuration=Release

The two warnings show up only in the first case, of course.
--
Michael
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
index de50554e7e..782c9f4f26 100644
--- a/src/tools/msvc/build.pl
+++ b/src/tools/msvc/build.pl
@@ -1,7 +1,9 @@
 # -*-perl-*- hey - emacs - this is a perl file
-
+#
+# Script that provides 'make' functionality for msvc builds.
+#
 # src/tools/msvc/build.pl
-
+#
 use strict;
 use warnings;
 
@@ -36,18 +38,36 @@ do "./src/tools/msvc/config.pl" if (-f "src/tools/msvc/config.pl");
 
 my $vcver = Mkvcbuild::mkvcbuild($config);
 
-# check what sort of build we are doing
+# Check what sort of build we are doing.  Several patterns are
+# supported here depending on how many arguments this script is called
+# with:
+# - No arguments provided imply that all components should be built
+#   with a release configuration.
+# - A first optional, case-insensitive, argument can be provided:
+# -- "Release" to trigger a build for all components with a release
+#    configuration.
+# -- "Debug" to trigger a build for all components with a debug
+#    build.
+# -- Specifying any other value will create a build with a release
+#    configuration for the component specified as argument.
+# - A second optional argument can be provided to define a component
+#   to build.  This can be used with the first argument to build one
+#   component at a time with a debug or release configuration.
 
 my $bconf     = $ENV{CONFIG}   || "Release";
 my $msbflags  = $ENV{MSBFLAGS} || "";
 my $buildwhat = $ARGV[1]       || "";
-if (uc($ARGV[0]) eq 'DEBUG')
+
+if (defined($ARGV[0]))
 {
-	$bconf = "Debug";
-}
-elsif (uc($ARGV[0]) ne "RELEASE")
-{
-	$buildwhat = $ARGV[0] || "";
+	if (uc($ARGV[0]) eq 'DEBUG')
+	{
+		$bconf = "Debug";
+	}
+	elsif (uc($ARGV[0]) ne "RELEASE")
+	{
+		$buildwhat = $ARGV[0] || "";
+	}
 }
 
 # ... and do it

Attachment: signature.asc
Description: PGP signature

Reply via email to