summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius.storm-olsen@nokia.com>2012-04-06 22:26:03 -0500
committerQt by Nokia <qt-info@nokia.com>2012-04-20 18:51:36 +0200
commite400f9d6a6767538d10026e71d6f90e2513150f6 (patch)
treecee8f78f6279271a798c62ad4a768615798c45e1
parent3dffd4e71035fc9a8433045a1dcfd1b9425793e7 (diff)
Add --dry-run option to build script
The --dry-run option (-n for short) also allows levels of dry-run, where the first level just shows what the build script itself will do. However if you -n 2, then it will recurse the dry-run to the make as well, so you can get a full dry-run of everything. Change-Id: I3a3c8a844411219e7afe6a570bc9ef6718ba472f Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
-rwxr-xr-xbuild37
1 files changed, 24 insertions, 13 deletions
diff --git a/build b/build
index 07f60fd3..8154ef0e 100755
--- a/build
+++ b/build
@@ -64,6 +64,7 @@ sub parse_arguments
'jobs' => -1,
'force_qmake' => 0,
'build-submodules' => [],
+ 'dry-run' => 0,
);
GetOptionsFromArray(\@args,
@@ -71,6 +72,7 @@ sub parse_arguments
'continue' => \$self->{'continue'},
'jobs|j:1' => \$self->{'jobs'},
'force-qmake' => \$self->{'force_qmake'},
+ 'dry-run|n:1' => \$self->{'dry-run'},
'help|?' => sub { pod2usage(1); },
) || pod2usage(2);
@@ -86,8 +88,8 @@ sub exe
print "+ @cmd\n" unless ($self->{quiet});
- if (system(@cmd) != 0) {
- confess "@cmd exited with status $CHILD_ERROR";
+ if ($self->{'dry-run'} != 1) {
+ confess "@cmd exited with status $CHILD_ERROR" if (system(@cmd) != 0);
}
return 0;
@@ -179,23 +181,32 @@ sub detect_configuration
$exe = $self->which("jom.exe") if (defined $exe && $self->which("jom.exe"));
$exe = $self->which("mingw32-make.exe") if (!defined $exe);
- # Use the /MP compiler option, if using nmake, to use all CPU threads when compiling
- if ($exe =~ 'nmake') {
- my $cl = $ENV{'CL'};
- if (defined $cl) {
- $cl .= ' /MP';
- } else {
- $cl = '/MP';
+ if (defined $exe) {
+ $self->{'MAKE'} = "\"$exe\"";
+
+ if ($exe =~ 'nmake') {
+ # Use the /MP compiler option if using nmake, to use all CPU threads when compiling
+ my $cl = $ENV{'CL'};
+ if (defined $cl) {
+ $cl .= ' /MP';
+ } else {
+ $cl = '/MP';
+ }
+ $ENV{'CL'} = $cl;
+ # Remove the -j option, since nmake cannot handle it.
+ $self->{'MAKEOPTS'} = "";
}
- $ENV{'CL'} = $cl;
- }
- $self->{'MAKE'} = "\"$exe\"" if (defined $exe);
- $self->{'MAKEOPTS'} = "" if (defined $exe && $exe =~ /nmake/);
+ if ($exe =~ 'nmake|jom' && $self->{'dry-run'} > 1) {
+ $self->{'MAKEOPTS'} = "/N $self->{'MAKEOPTS'}";
+ }
+ }
# Tools needed for building QtWebKit/Windows (Bison, Flex, gperf, iconv)
my $abs_path = abs_path('gnuwin32/bin');
unshift @PATH, "$abs_path";
+ } else {
+ $self->{'MAKEOPTS'} = "--dry-run $self->{'MAKEOPTS'}" if ($self->{'dry-run'} > 1);
}
}