Skip to content

Instantly share code, notes, and snippets.

@hcarty
Last active December 15, 2015 03:59
Show Gist options
  • Save hcarty/5198467 to your computer and use it in GitHub Desktop.
Save hcarty/5198467 to your computer and use it in GitHub Desktop.
ocamlbuild plugin - support rpath and "-static" when linking
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