Revision
90264
Author
jmr@macports.org
Date
2012-02-28 04:56:58 -0800 (Tue, 28 Feb 2012)

Log Message

pypy: work around excessive compiler memory usage (#33256)

Modified Paths

Diff

Modified: trunk/dports/lang/pypy/Portfile (90263 => 90264)


--- trunk/dports/lang/pypy/Portfile	2012-02-28 11:40:50 UTC (rev 90263)
+++ trunk/dports/lang/pypy/Portfile	2012-02-28 12:56:58 UTC (rev 90264)
@@ -44,6 +44,25 @@
     build.cmd       ${prefix}/bin/python2.7
 #}
 
+# a lot of memory is used before the C compiler even runs, so limit build.jobs
+# according to available memory more tightly than the default
+if {![catch {sysctl hw.memsize} memsize]} {
+    if {$build_arch == "x86_64" || $build_arch == "ppc64"} {
+        incr memsize -4000000000
+    } else {
+        incr memsize -2000000000
+    }
+    if {$memsize <= 0} {
+        build.jobs 1
+    } elseif {${build.jobs} > $memsize / 1000000000 + 1} {
+        build.jobs [expr $memsize / 1000000000 + 1]
+    }
+}
+# memory usage bug in gcc 4.2 on x86_64
+if {${configure.compiler} == "gcc-4.2" && $build_arch == "x86_64"} {
+    configure.compiler llvm-gcc-4.2
+}
+
 platform darwin {
     # use arch -foo if available
     if {${os.major} >= 9} {