Created
May 31, 2020 15:13
-
-
Save roobie/8dc7e505081031602cc3da51b05c5f3d to your computer and use it in GitHub Desktop.
default-ldflags-with-runpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def *default-ldflags* "-s") | |
(def zlib {:path "/abc/zlib"}) | |
(def libuv {:path "/abc/libuv"}) | |
(defn default-ldflags-with-runpath [&keys collections] | |
(var to-join @[]) | |
(each key (keys collections) | |
(let [prefix (string "/" key) | |
libs (in collections key) | |
extra (join-pkg-paths ":" prefix libs)] | |
(set to-join (array/concat to-join extra)))) | |
(string *default-ldflags* | |
" " | |
"-Wl,--enable-new-dtags" | |
" " | |
"-Wl,-rpath=" (string/join to-join ":"))) | |
(print (default-ldflags-with-runpath :lib [zlib] :lib64 [libuv])) | |
(print (default-ldflags-with-runpath :lib64 [libuv])) | |
(print (default-ldflags-with-runpath :lib [zlib])) | |
# Output | |
# -s -Wl,--enable-new-dtags -Wl,-rpath=/abc/zlib/lib:/abc/libuv/lib64 | |
# -s -Wl,--enable-new-dtags -Wl,-rpath=/abc/libuv/lib64 | |
# -s -Wl,--enable-new-dtags -Wl,-rpath=/abc/zlib/lib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment