diff options
author | bptato <nincsnevem662@gmail.com> | 2023-11-21 10:49:57 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-11-21 10:49:57 +0100 |
commit | f5d31c6ae463b9e149c8e7b9222b9be9cba089e8 (patch) | |
tree | 6d55ef8fdaa9b3f783127520b227102add830de0 /src/bindings | |
parent | cf948921164d7d8a156de8b9d1b256da0d3e1ce7 (diff) | |
download | chawan-f5d31c6ae463b9e149c8e7b9222b9be9cba089e8.tar.gz |
bindings: find termcap on FreeBSD
pkg-config does not find termcap (or really, ncurses) here, so we have to find it ourselves.
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/termcap.nim | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bindings/termcap.nim b/src/bindings/termcap.nim index 02962a67..5a98ccc0 100644 --- a/src/bindings/termcap.nim +++ b/src/bindings/termcap.nim @@ -1,9 +1,20 @@ -const termlib = (func(): string = - let libs = ["terminfo", "mytinfo", "termlib", "termcap", "tinfo", "ncurses", "curses"] +import os +const termlib = (proc(): string = + const libs = [ + "terminfo", "mytinfo", "termlib", "termcap", "tinfo", "ncurses", "curses" + ] for lib in libs: let res = staticExec("pkg-config --libs --silence-errors " & lib) if res != "": return res + # Apparently on some systems pkg-config will fail to locate ncurses. + const dirs = [ + "/lib", "/usr/lib", "/usr/local/lib" + ] + for lib in libs: + for dir in dirs: + if fileExists(dir & "/lib" & lib & ".a"): + return "-l" & lib )() when termlib != "": {.passl: termlib.} |