Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 404b912

Browse files
committed
Improve perl script in MSVC to build binaries
This commit includes two improvements for build.pl in src/tools/msvc/: - Fix two warnings related to $ARGV[0] being uninitialized, something that happens when calling build.pl (or build.bat) without arguments to compile all the components with a release quality. - If calling the script with more than two arguments, exit immediately and show a new help output. build.pl was not failing in this case before this commit, and the extra arguments were just ignored, but the new behavior helps in understanding how to run the script without looking at the documentation for the Windows builds. Reported-by: Ranier Vilela Author: Michael Paquier Reviewed-by: Juan José Santamaría Flecha, David Zhang Discussion: https://postgr.es/m/CAEudQAo38dfR_0Ugt2OHy4mq-6Hz93XPSBAGEUV67RhKdgp8Zg@mail.gmail.com
1 parent fe2e206 commit 404b912

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

src/tools/msvc/build.pl

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# -*-perl-*- hey - emacs - this is a perl file
2-
2+
#
3+
# Script that provides 'make' functionality for msvc builds.
4+
#
35
# src/tools/msvc/build.pl
4-
6+
#
57
use strict;
68
use warnings;
79

@@ -12,10 +14,22 @@
1214

1315
use Mkvcbuild;
1416

17+
sub usage
18+
{
19+
die( "Usage: build.pl [ [ <configuration> ] <component> ]\n"
20+
. "Options are case-insensitive.\n"
21+
. " configuration: Release | Debug. This sets the configuration\n"
22+
. " to build. Default is Release.\n"
23+
. " component: name of component to build. An empty value means\n"
24+
. " to build all components.\n");
25+
}
26+
1527
chdir('../../..') if (-d '../msvc' && -d '../../../src');
1628
die 'Must run from root or msvc directory'
1729
unless (-d 'src/tools/msvc' && -d 'src');
1830

31+
usage() unless scalar(@ARGV) <= 2;
32+
1933
# buildenv.pl is for specifying the build environment settings
2034
# it should contain lines like:
2135
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
@@ -37,17 +51,20 @@
3751
my $vcver = Mkvcbuild::mkvcbuild($config);
3852

3953
# check what sort of build we are doing
40-
4154
my $bconf = $ENV{CONFIG} || "Release";
4255
my $msbflags = $ENV{MSBFLAGS} || "";
4356
my $buildwhat = $ARGV[1] || "";
44-
if (uc($ARGV[0]) eq 'DEBUG')
45-
{
46-
$bconf = "Debug";
47-
}
48-
elsif (uc($ARGV[0]) ne "RELEASE")
57+
58+
if (defined($ARGV[0]))
4959
{
50-
$buildwhat = $ARGV[0] || "";
60+
if (uc($ARGV[0]) eq 'DEBUG')
61+
{
62+
$bconf = "Debug";
63+
}
64+
elsif (uc($ARGV[0]) ne "RELEASE")
65+
{
66+
$buildwhat = $ARGV[0] || "";
67+
}
5168
}
5269

5370
# ... and do it

0 commit comments

Comments
 (0)