summaryrefslogtreecommitdiff
path: root/tools/multigcc.pl
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2011-08-16 19:26:24 +0000
committerThomas Jarosch <tomj@simonv.com>2011-08-16 19:26:24 +0000
commit121b26e62fb0bb045dc7926b0b5cdfc4d2d2a0d4 (patch)
tree6fc264d2ae53b01da0c84cc7371711860b1c23a8 /tools/multigcc.pl
parent2e154df92fd86ab90f300a52561a5a192f6c7b96 (diff)
downloadrockbox-121b26e62fb0bb045dc7926b0b5cdfc4d2d2a0d4.zip
rockbox-121b26e62fb0bb045dc7926b0b5cdfc4d2d2a0d4.tar.gz
rockbox-121b26e62fb0bb045dc7926b0b5cdfc4d2d2a0d4.tar.bz2
rockbox-121b26e62fb0bb045dc7926b0b5cdfc4d2d2a0d4.tar.xz
perl magic: Use if/elsif/else instead of given/when (FS #12188)
Unbreaks the maemo build. Patch by Nick Peskett with a small comment added as suggested by Dominik Riebeling. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30323 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/multigcc.pl')
-rwxr-xr-xtools/multigcc.pl32
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index e263638..c272eba 100755
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -1,5 +1,4 @@
#!/usr/bin/perl
-use feature "switch";
use List::Util 'shuffle'; # standard from Perl 5.8 and later
my $tempfile = "multigcc.out";
@@ -26,23 +25,22 @@ my $command = join " ", @params;
# count number of cores
my $cores;
-given ($^O) {
- when ("darwin") {
- chomp($cores = `sysctl -n hw.ncpu`);
- $cores = 1 if ($?);
- }
- when ("solaris") {
- $cores = scalar grep /on-line/i, `psrinfo`;
- $cores = 1 if ($?);
+# Don't use given/when here - it's not compatible with old perl versions
+if ($^O eq 'darwin') {
+ chomp($cores = `sysctl -n hw.ncpu`);
+ $cores = 1 if ($?);
+}
+elsif ($^O eq 'solaris') {
+ $cores = scalar grep /on-line/i, `psrinfo`;
+ $cores = 1 if ($?);
+}
+else {
+ if (open CPUINFO, "</proc/cpuinfo") {
+ $cores = scalar grep /^processor/i, <CPUINFO>;
+ close CPUINFO;
}
- default {
- if (open CPUINFO, "</proc/cpuinfo") {
- $cores = scalar grep /^processor/i, <CPUINFO>;
- close CPUINFO;
- }
- else {
- $cores = 1;
- }
+ else {
+ $cores = 1;
}
}