OSX support for getHeader, handle symlinks
This commit is contained in:
parent
9c51c82418
commit
6bc0c4aa3b
5 changed files with 20 additions and 6 deletions
|
|
@ -25,7 +25,7 @@ install:
|
||||||
- |
|
- |
|
||||||
curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh
|
curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh
|
||||||
sh init.sh -y
|
sh init.sh -y
|
||||||
- export PATH=$HOME/.nimble/bin:$PATH
|
- export PATH="$HOME/.nimble/bin:/usr/local/opt/gettext/bin:$PATH"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- set -e
|
- set -e
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,8 @@ proc findFile*(file: string|Regex, dir: string, recurse = true, first = false):
|
||||||
var
|
var
|
||||||
rm: RegexMatch
|
rm: RegexMatch
|
||||||
|
|
||||||
for f in walkDirRec(dir, followFilter = if recurse: {pcDir} else: {}):
|
for f in walkDirRec(dir, yieldFilter = {pcFile, pcLinkToFile},
|
||||||
|
followFilter = if recurse: {pcDir} else: {}):
|
||||||
let
|
let
|
||||||
fn = f.extractFilename()
|
fn = f.extractFilename()
|
||||||
when file is string:
|
when file is string:
|
||||||
|
|
@ -343,8 +344,9 @@ proc getGccLibPaths*(mode = "c"): seq[string] =
|
||||||
var
|
var
|
||||||
nul = when defined(Windows): "nul" else: "/dev/null"
|
nul = when defined(Windows): "nul" else: "/dev/null"
|
||||||
mmode = if mode == "cpp": "c++" else: mode
|
mmode = if mode == "cpp": "c++" else: mode
|
||||||
|
linker = when defined(OSX): "-Xlinker" else: ""
|
||||||
|
|
||||||
(outp, _) = gorgeEx(&"""{getEnv("CC", "gcc")} -v -x{mmode} {nul}""")
|
(outp, _) = gorgeEx(&"""{getEnv("CC", "gcc")} {linker} -v -x{mmode} {nul}""")
|
||||||
|
|
||||||
for line in outp.splitLines():
|
for line in outp.splitLines():
|
||||||
if "LIBRARY_PATH=" in line:
|
if "LIBRARY_PATH=" in line:
|
||||||
|
|
@ -355,6 +357,12 @@ proc getGccLibPaths*(mode = "c"): seq[string] =
|
||||||
if path notin result:
|
if path notin result:
|
||||||
result.add path
|
result.add path
|
||||||
break
|
break
|
||||||
|
elif '\t' in line:
|
||||||
|
var
|
||||||
|
path = line.strip()
|
||||||
|
path.normalizePath()
|
||||||
|
if path notin result:
|
||||||
|
result.add path
|
||||||
|
|
||||||
proc getStdPath(header: string): string =
|
proc getStdPath(header: string): string =
|
||||||
for inc in getGccPaths():
|
for inc in getGccPaths():
|
||||||
|
|
@ -461,7 +469,7 @@ proc buildLibrary(lname, outdir, conFlags, cmakeFlags, makeFlags: string): strin
|
||||||
if fileExists(outdir / "autogen.sh") or fileExists(outdir / "build" / "autogen.sh"):
|
if fileExists(outdir / "autogen.sh") or fileExists(outdir / "build" / "autogen.sh"):
|
||||||
if findExe("aclocal").len != 0:
|
if findExe("aclocal").len != 0:
|
||||||
if findExe("autoconf").len != 0:
|
if findExe("autoconf").len != 0:
|
||||||
if findExe("libtoolize").len != 0:
|
if findExe("libtoolize").len != 0 or findExe("glibtoolize").len != 0:
|
||||||
if findExe("autopoint").len != 0:
|
if findExe("autopoint").len != 0:
|
||||||
cfgCommon()
|
cfgCommon()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -403,3 +403,9 @@ proc loadPlugin*(gState: State, sourcePath: string) =
|
||||||
|
|
||||||
gState.onSymbol = cast[OnSymbol](lib.symAddr("onSymbol"))
|
gState.onSymbol = cast[OnSymbol](lib.symAddr("onSymbol"))
|
||||||
doAssert gState.onSymbol != nil, "onSymbol() load failed from " & pdll
|
doAssert gState.onSymbol != nil, "onSymbol() load failed from " & pdll
|
||||||
|
|
||||||
|
proc expandSymlinkAbs*(path: string): string =
|
||||||
|
try:
|
||||||
|
result = path.expandSymlink().absolutePath(path.parentDir())
|
||||||
|
except:
|
||||||
|
result = path
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ proc main(
|
||||||
if gState.pnim:
|
if gState.pnim:
|
||||||
printNimHeader()
|
printNimHeader()
|
||||||
for src in source:
|
for src in source:
|
||||||
gState.process(src, astTable)
|
gState.process(src.expandSymlinkAbs(), astTable)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import cligen
|
import cligen
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var
|
||||||
rcmd = " -r lzma.nim"
|
rcmd = " -r lzma.nim"
|
||||||
exp = "liblzma version = "
|
exp = "liblzma version = "
|
||||||
|
|
||||||
when defined(linux):
|
when defined(posix):
|
||||||
testCall(cmd & rcmd, "No build files found", 1)
|
testCall(cmd & rcmd, "No build files found", 1)
|
||||||
|
|
||||||
# stdlib
|
# stdlib
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue