diff options
author | Alex Parker <rockbox@aeparker.com> | 2011-09-01 14:25:05 +0000 |
---|---|---|
committer | Alex Parker <rockbox@aeparker.com> | 2011-09-01 14:25:05 +0000 |
commit | 0f1b77dae8b23844910c20442a86db9486f438aa (patch) | |
tree | 948b37cd9b632fa0b71740e93eb5f975d97d5c5a /tools/multigcc.pl | |
parent | 7eef2271548bfc203c5237d90cca7e9667ae760b (diff) | |
download | rockbox-0f1b77dae8b23844910c20442a86db9486f438aa.tar.gz rockbox-0f1b77dae8b23844910c20442a86db9486f438aa.zip |
Backport r30323/r30169 - perl use if/elsif/else so that it'll build with both new and old perl.v3.9.1-finalv3.9
git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_9@30406 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/multigcc.pl')
-rw-r--r--[-rwxr-xr-x] | tools/multigcc.pl | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl index 9be9978bd4..c272ebae08 100755..100644 --- a/tools/multigcc.pl +++ b/tools/multigcc.pl | |||
@@ -1,5 +1,4 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | use Switch; | ||
3 | use List::Util 'shuffle'; # standard from Perl 5.8 and later | 2 | use List::Util 'shuffle'; # standard from Perl 5.8 and later |
4 | 3 | ||
5 | my $tempfile = "multigcc.out"; | 4 | my $tempfile = "multigcc.out"; |
@@ -26,23 +25,22 @@ my $command = join " ", @params; | |||
26 | 25 | ||
27 | # count number of cores | 26 | # count number of cores |
28 | my $cores; | 27 | my $cores; |
29 | switch($^O) { | 28 | # Don't use given/when here - it's not compatible with old perl versions |
30 | case "darwin" { | 29 | if ($^O eq 'darwin') { |
31 | chomp($cores = `sysctl -n hw.ncpu`); | 30 | chomp($cores = `sysctl -n hw.ncpu`); |
32 | $cores = 1 if ($?); | 31 | $cores = 1 if ($?); |
33 | } | 32 | } |
34 | case "solaris" { | 33 | elsif ($^O eq 'solaris') { |
35 | $cores = scalar grep /on-line/i, `psrinfo`; | 34 | $cores = scalar grep /on-line/i, `psrinfo`; |
36 | $cores = 1 if ($?); | 35 | $cores = 1 if ($?); |
36 | } | ||
37 | else { | ||
38 | if (open CPUINFO, "</proc/cpuinfo") { | ||
39 | $cores = scalar grep /^processor/i, <CPUINFO>; | ||
40 | close CPUINFO; | ||
37 | } | 41 | } |
38 | else { | 42 | else { |
39 | if (open CPUINFO, "</proc/cpuinfo") { | 43 | $cores = 1; |
40 | $cores = scalar grep /^processor/i, <CPUINFO>; | ||
41 | close CPUINFO; | ||
42 | } | ||
43 | else { | ||
44 | $cores = 1; | ||
45 | } | ||
46 | } | 44 | } |
47 | } | 45 | } |
48 | 46 | ||