Skip to content

Commit

Permalink
Adds --install-dir option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan Stark committed Feb 16, 2015
1 parent 84c5929 commit a6587c6
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions scripts/build.pl
Expand Up @@ -46,6 +46,7 @@
my @user_configs;
my $qt_src_dir = '';
my $qt_bld_dir = '';
my $qt_install_dir = '';
my $repeat = 1;
my $make_flags = '';
my $force_configure = 0;
Expand All @@ -69,6 +70,8 @@
$qt_src_dir = $1;
} elsif ($flag =~ m/--build-dir=(.*)/) {
$qt_bld_dir = $1;
} elsif ($flag =~ m/--install-dir=(.*)/) {
$qt_install_dir = $1;
} elsif ($flag =~ m/--repeat=(.*)/) {
$repeat = int($1);
} elsif ($flag =~ m/--make-flags=(.*)/) {
Expand Down Expand Up @@ -124,6 +127,7 @@
print "\t 'stress'. The default is to run all three.\n";
print "\t--source-dir=<dir> absolute path to Qthreads source.\n";
print "\t--build-dir=<dir> absolute path to target build directory.\n";
print "\t--install-dir=<dir> absolute path to target installation directory.\n";
print "\t--repeat=<n> run `make check` <n> times per configuration.\n";
print "\t--make-flags=<options> options to pass to make (e.g. '-j 4').\n";
print "\t--force-configure run `configure` again.\n";
Expand Down Expand Up @@ -185,12 +189,25 @@
exit(1);
}

if ($qt_install_dir eq '') {
} elsif (not $qt_install_dir =~ m/^\//) {
print "Specify full path for installation dir '$qt_install_dir'\n";
exit(1);
} else {
foreach my $name (@conf_names) {
$config{$name} = join(' ', "--prefix=$qt_install_dir/$name");
}
}

# Optionally print information about the configuration
if ($print_info) {
print "Configurations: @conf_names\n";
print "Source directory: $qt_src_dir\n";
print "Build directory: $qt_bld_dir\n";
}
if (not $qt_install_dir eq '') {
print "Install directory: $qt_install_dir\n";
}

# Run the test configurations
foreach my $conf_name (@conf_names) {
Expand All @@ -212,7 +229,7 @@
sub run_tests {
my $conf_name = $_[0];
my $test_dir = "$qt_bld_dir/$conf_name";

print "\n### Test: $conf_name\n" unless $quietly;
print "### Build directory: $test_dir\n" unless $quietly;

Expand All @@ -226,6 +243,9 @@ sub run_tests {
print "###\tConfiguring '$conf_name' ...\n" unless $quietly;
my $configure_log = "$test_dir/build.configure.log";
my_system("mkdir -p $test_dir") if (not -e $test_dir);
if (not $qt_install_dir eq '') {
my_system("mkdir -p $qt_install_dir/$conf_name") if (not -e "$qt_install_dir/$conf_name");
}
my_system("cd $test_dir && $qt_src_dir/configure $config{$conf_name} 2>&1 | tee $configure_log")
if ($force_configure || not -e "$test_dir/config.log");
print "### Log: $configure_log\n" unless $quietly;
Expand All @@ -236,6 +256,10 @@ sub run_tests {
my $build_command = "cd $test_dir";
$build_command .= " && make clean > /dev/null" if ($force_clean);
$build_command .= " && make $make_flags 2>&1 | tee $build_log";
if (not $qt_install_dir eq '') {
print "###\tInstalling '$conf_name' ...\n" unless $quietly;
$build_command .= " && make $make_flags install 2>&1 | tee $build_log";
}
my_system($build_command);
if (not $dry_run) {
my $build_warnings = qx/awk '\/warning:\/' $build_log/;
Expand All @@ -251,7 +275,6 @@ sub run_tests {
}
}


# Build testsuite
my %failcounts;
my $failing_tests = 0;
Expand Down

0 comments on commit a6587c6

Please sign in to comment.