nim: unescape "\ " before splitting NIX_LDFLAGS

Ref #190126
This commit is contained in:
Emery Hemingway 2022-09-30 16:39:44 -05:00 committed by ehmry
parent c1184a3f8c
commit 1471e0c739

View file

@ -1,14 +1,3 @@
commit 164ba50fc74b980f77047080b2ae1ea099ae9b27
Author: Emery Hemingway <ehmry@posteo.net>
Date: Mon Sep 7 14:09:22 2020 +0200
Load libaries by absolute path on NixOS
If "nixbuild" is defined then choose dynamic runtime libraries by
searching $NIX_LDFLAGS at compile-time.
Fix #15194
diff --git a/lib/pure/dynlib.nim b/lib/pure/dynlib.nim
index f31ae94dd..debed9c07 100644
--- a/lib/pure/dynlib.nim
@ -37,7 +26,7 @@ index f31ae94dd..debed9c07 100644
+ # to enable this behavior by default.
+ #
+ var libDirs = split(getEnv("LD_LIBRARY_PATH"), ':')
+ for flag in split(getEnv("NIX_LDFLAGS")):
+ for flag in split(replace(getEnv("NIX_LDFLAGS"), "\\ ", " ")):
+ if flag.startsWith("-L"):
+ libDirs.add(flag[2..flag.high])
+ for lib in dest: