build.sh: get number of CPUs on OSX too

The linux way (reading /proc/cpuinfo) doesn't work on OSX.
Merge pull request #294 from aktau/osx-ncpu

linux: build.sh: get number of CPUs on OSX too