Cuberite Forum
FreeBSD, missing compilation dependencies - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Discussion (https://forum.cuberite.org/forum-5.html)
+--- Thread: FreeBSD, missing compilation dependencies (/thread-2332.html)

Pages: 1 2


RE: FreeBSD, missing compilation dependencies - DrMasik - 02-10-2016

(02-09-2016, 08:36 PM)LogicParrot Wrote:
(02-09-2016, 02:10 AM)DrMasik Wrote: If you needed number of CPU threads use:
Code:
sysctl hw.ncpu | awk '{print $2}'

Thanks, but I'd need a cross-platform way to do this.

Code:
#!/bin/sh

osName=`uname`

if [ "${osName}" = "FreeBSD" ]; then
  ncpu=`sysctl hw.ncpu | awk '{print $2}'`;
elif [ "${osName}" = "Linux" ]; then
  ncpu=`nproc`;
else
  wCount=`whereis nproc | awk '{print $2}' | wc -m`;

  if [ ${wCount} -lt 2 ]; then
    ncpu=2;
  else
    ncpu=`nproc`;
  fi
fi

echo ${ncpu}



RE: FreeBSD, missing compilation dependencies - LogicParrot - 02-11-2016

Thanks Smile
I'll open a PR soon.