Some small compatibility fixes for FreeBSD (#190)

This commit is contained in:
BarrOff 2020-04-21 06:41:16 +02:00 • committed by GitHub
commit 82ca3bd37b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -358,7 +358,7 @@ proc findFile*(file: string, dir: string, recurse = true, first = false, regex =
"nimgrep --filenames --oneline --nocolor $1 \"$2\" $3"
elif defined(linux):
"find $3 $1 -regextype egrep -regex $2"
elif defined(osx):
elif defined(osx) or defined(FreeBSD):
"find -E $3 $1 -regex $2"
recursive = ""
@ -754,7 +754,7 @@ proc getNumProcs(): string =
getEnv("NUMBER_OF_PROCESSORS").strip()
elif defined(linux):
execAction("nproc").output.strip()
elif defined(macosx):
elif defined(macosx) or defined(FreeBSD):
execAction("sysctl -n hw.ncpu").output.strip()
else:
"1"
@ -830,7 +830,7 @@ proc buildLibrary(lname, outdir, conFlags, cmakeFlags, makeFlags: string): strin
proc getDynlibExt(): string =
when defined(windows):
result = ".dll"
elif defined(linux):
elif defined(linux) or defined(FreeBSD):
result = ".so[0-9.]*"
elif defined(macosx):
result = ".dylib[0-9.]*"

View file

@ -82,7 +82,7 @@ proc getFileDate(fullpath: string): string =
&"cmd /c for %a in ({fullpath.sanitizePath}) do echo %~ta"
elif defined(Linux):
&"stat -c %y {fullpath.sanitizePath}"
elif defined(OSX):
elif defined(OSX) or defined(FreeBSD):
&"stat -f %m {fullpath.sanitizePath}"
(result, ret) = execAction(cmd)