Last active
December 15, 2015 03:59
-
-
Save hcarty/5198467 to your computer and use it in GitHub Desktop.
ocamlbuild plugin - support rpath and "-static" when linking
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
/path/to/library1 | |
/path/to/library2 |
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
open Ocamlbuild_plugin | |
let rpaths = string_list_of_file "link.rpath" | |
let static_flags = S [A "-cclib"; A "-static"] | |
let () = dispatch begin function | |
| After_rules -> | |
List.iter ( | |
fun path -> | |
let rpath_flags = S [A "-cclib"; A ("-Wl,-rpath," ^ path)] in | |
flag ["ocaml"; "link"; "program"; "rpath"] rpath_flags; | |
flag ["ocaml"; "link"; "library"; "rpath"] rpath_flags; | |
) rpaths; | |
flag ["ocaml"; "link"; "program"; "static"] static_flags; | |
| _ -> () | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment