diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-09-04 00:35:33 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-02 15:31:04 -0500 |
| commit | 6bc0c4aa3b82a0ccd3144530b81a5cd922dc1bb3 (patch) | |
| tree | 3d4aa74cee4c142903763e2f6b452a63ba4f4938 | |
| parent | 9c51c824182a1b3180cecdd86b5af6c9dbc958ab (diff) | |
| download | nimterop-6bc0c4aa3b82a0ccd3144530b81a5cd922dc1bb3.tar.gz nimterop-6bc0c4aa3b82a0ccd3144530b81a5cd922dc1bb3.zip | |
OSX support for getHeader, handle symlinks
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | nimterop/build.nim | 14 | ||||
| -rw-r--r-- | nimterop/getters.nim | 6 | ||||
| -rw-r--r-- | nimterop/toast.nim | 2 | ||||
| -rw-r--r-- | tests/getheader.nims | 2 |
5 files changed, 20 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index 564c34d..d866260 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ install: - | curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh sh init.sh -y - - export PATH=$HOME/.nimble/bin:$PATH + - export PATH="$HOME/.nimble/bin:/usr/local/opt/gettext/bin:$PATH" script: - set -e diff --git a/nimterop/build.nim b/nimterop/build.nim index dfeb2d4..0585d36 100644 --- a/nimterop/build.nim +++ b/nimterop/build.nim @@ -205,7 +205,8 @@ proc findFile*(file: string|Regex, dir: string, recurse = true, first = false): var 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 fn = f.extractFilename() when file is string: @@ -343,8 +344,9 @@ proc getGccLibPaths*(mode = "c"): seq[string] = var nul = when defined(Windows): "nul" else: "/dev/null" 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(): if "LIBRARY_PATH=" in line: @@ -355,6 +357,12 @@ proc getGccLibPaths*(mode = "c"): seq[string] = if path notin result: result.add path break + elif '\t' in line: + var + path = line.strip() + path.normalizePath() + if path notin result: + result.add path proc getStdPath(header: string): string = 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 findExe("aclocal").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: cfgCommon() else: diff --git a/nimterop/getters.nim b/nimterop/getters.nim index 04ed5cf..f1559db 100644 --- a/nimterop/getters.nim +++ b/nimterop/getters.nim @@ -403,3 +403,9 @@ proc loadPlugin*(gState: State, sourcePath: string) = gState.onSymbol = cast[OnSymbol](lib.symAddr("onSymbol")) doAssert gState.onSymbol != nil, "onSymbol() load failed from " & pdll + +proc expandSymlinkAbs*(path: string): string = + try: + result = path.expandSymlink().absolutePath(path.parentDir()) + except: + result = path diff --git a/nimterop/toast.nim b/nimterop/toast.nim index 6e38670..b66a3c6 100644 --- a/nimterop/toast.nim +++ b/nimterop/toast.nim @@ -145,7 +145,7 @@ proc main( if gState.pnim: printNimHeader() for src in source: - gState.process(src, astTable) + gState.process(src.expandSymlinkAbs(), astTable) when isMainModule: import cligen diff --git a/tests/getheader.nims b/tests/getheader.nims index 57584a6..6d0f73a 100644 --- a/tests/getheader.nims +++ b/tests/getheader.nims @@ -20,7 +20,7 @@ var rcmd = " -r lzma.nim" exp = "liblzma version = " -when defined(linux): +when defined(posix): testCall(cmd & rcmd, "No build files found", 1) # stdlib |
