From e1172e82e2def9b03ffe47e696a6aafeb182f0d6 Mon Sep 17 00:00:00 2001 From: PHO Date: Fri, 16 Mar 2012 12:44:18 +0900 Subject: [PATCH] build-hc-pkg (detect_number_of_cpus): support for Linux --- build-hc-pkg | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build-hc-pkg b/build-hc-pkg index 0c9069e..6e0e1fa 100755 --- a/build-hc-pkg +++ b/build-hc-pkg @@ -12,7 +12,13 @@ function detect_platform_type () { } function detect_number_of_cpus () { - if ! sysctl -n hw.ncpu 2>/dev/null; then + if sysctl -n "hw.ncpu" 2>/dev/null; then + # This works for most BSDs. + : + elif grep -qF processor /proc/cpuinfo; then + # Linux sucks... + grep -cF processor /proc/cpuinfo + else echo "WARNING: I don't know how to detect the number of processors on this platform." >&2 echo "WARNING: GHC will be built using only 1 processor. Expect some slowdown." >&2 echo 1 -- 2.40.0