Ignore:
Timestamp:
01/05/2011 17:34:15 (13 months ago)
Author:
jamesog
Message:

Refine CPU detection code in BoxPlatform? to allow use of multiple processors on systems other than Darwin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/infrastructure/BoxPlatform.pm.in

    r2561 r2951  
    8383        $install_into_dir = '@sbindir_expanded@'; 
    8484 
     85        # see how many processors there are, and set make flags accordingly 
     86        if($build_os eq 'Darwin' || $build_os =~ /(Free|Net|Open)BSD/) 
     87        { 
     88                $cpus = `sysctl -n hw.ncpu`; 
     89        } 
     90        elsif($build_os eq 'Linux') 
     91        { 
     92                $cpus = `grep -c ^processor /proc/cpuinfo`; 
     93        } 
     94        elsif($build_os eq 'SunOS') 
     95        { 
     96                $cpus = `psrinfo -p`; 
     97        } 
     98 
     99        chomp $cpus; 
     100        if($cpus > 1) 
     101        { 
     102                print STDERR "$cpus processors detected, will set make to perform concurrent jobs\n"; 
     103                $sub_make_options = ' -j '.($cpus + 1); 
     104        } 
     105                 
    85106        # if it's Darwin, 
    86107        if($build_os eq 'Darwin') 
    87108        { 
    88                 # see how many processors there are, and set make flags accordingly 
    89                 my $cpus = `sysctl hw.ncpu`; 
    90                 if($cpus =~ m/hw.ncpu:\s(\d+)/ && $1 > 1) 
    91                 { 
    92                         print STDERR "$1 processors detected, will set make to perform concurrent jobs\n"; 
    93                         $sub_make_options = ' -j '.($1 + 1); 
    94                 } 
    95                  
    96109                # test for fink installation 
    97110                if(-d '/sw/include' && -d '/sw/lib') 
Note: See TracChangeset for help on using the changeset viewer.