[52390] trunk/base/src/port1.0/portbuild.tcl

jmr at macports.org jmr at macports.org
Mon Jun 15 09:14:59 PDT 2009


Revision: 52390
          http://trac.macports.org/changeset/52390
Author:   jmr at macports.org
Date:     2009-06-15 09:14:58 -0700 (Mon, 15 Jun 2009)
Log Message:
-----------
map 0 to the number of CPU cores when initialising build.jobs

Modified Paths:
--------------
    trunk/base/src/port1.0/portbuild.tcl

Modified: trunk/base/src/port1.0/portbuild.tcl
===================================================================
--- trunk/base/src/port1.0/portbuild.tcl	2009-06-15 16:03:10 UTC (rev 52389)
+++ trunk/base/src/port1.0/portbuild.tcl	2009-06-15 16:14:58 UTC (rev 52390)
@@ -53,7 +53,7 @@
 default build.dir {${workpath}/${worksrcdir}}
 default build.cmd {[portbuild::build_getmaketype]}
 default build.nice {${buildnicevalue}}
-default build.jobs {${buildmakejobs}}
+default build.jobs {[portbuild::build_getjobs]}
 default build.pre_args {${build.target}}
 default build.target "all"
 default use_parallel_build yes
@@ -114,18 +114,9 @@
     return "[findBinary nice $portutil::autoconf::nice_path] -n $nice "
 }
 
-proc portbuild::build_getmakejobs {args} {
-    # check if port allows a parallel build
-    global use_parallel_build
-    if {![tbool use_parallel_build]} {
-        ui_debug "port disallows a parallel build"
-        return ""
-    }
-
-    if {![exists build.jobs] || !([string match "*make*" [option build.cmd]] || [string match "*scons*" [option build.cmd]])} {
-        return ""
-    }
-    set jobs [option build.jobs]
+proc portbuild::build_getjobs {args} {
+    global buildmakejobs
+    set jobs $buildmakejobs
     # if set to '0', use the number of cores for the number of jobs
     if {$jobs == 0} {
         if {[catch {set jobs [exec "/usr/sbin/sysctl" "-n" "hw.availcpu"]}]} {
@@ -135,9 +126,23 @@
         }
     }
     if {![string is integer -strict $jobs] || $jobs <= 1} {
+        set jobs 1
+    }
+    return $jobs
+}
+
+proc portbuild::build_getjobsarg {args} {
+    # check if port allows a parallel build
+    global use_parallel_build
+    if {![tbool use_parallel_build]} {
+        ui_debug "port disallows a parallel build"
         return ""
     }
-    return " -j$jobs"
+
+    if {![exists build.jobs] || !([string match "*make*" [option build.cmd]] || [string match "*scons*" [option build.cmd]])} {
+        return ""
+    }
+    return " -j[option build.jobs]"
 }
 
 proc portbuild::build_start {args} {
@@ -150,7 +155,7 @@
     global build.cmd
 
     set nice_prefix [build_getnicevalue]
-    set jobs_suffix [build_getmakejobs]
+    set jobs_suffix [build_getjobsarg]
 
     set realcmd ${build.cmd}
     set build.cmd "$nice_prefix${build.cmd}$jobs_suffix"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090615/d81dfe93/attachment.html>


More information about the macports-changes mailing list