Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include support for rpath and static linking flags in ocamlbuild #5963

Closed
vicuna opened this issue Mar 27, 2013 · 1 comment
Closed

Include support for rpath and static linking flags in ocamlbuild #5963

vicuna opened this issue Mar 27, 2013 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Mar 27, 2013

Original bug ID: 5963
Reporter: @hcarty
Status: resolved (set by @damiendoligez on 2017-03-01T16:10:22Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 4.00.1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Monitored by: thelema @hcarty

Bug description

These are rather straightforward to support with command line flags or a myocamlbuild.ml plugin. It would be nice to have more robust support in the ocamlbuild tool itself though. For example, the sample plugin I've included only supports a single 'link.rpath' file. It would be nice to have the name of the file come from the matching executable target (foo.rpath -> foo.native).

Steps to reproduce

An example myocamlbuild.ml which:

  1. Creates an 'rpath' tag and reads link path information from "link.rpath"
  2. Creates a 'static' tag for fully statically linked executables

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

@vicuna
Copy link
Author

vicuna commented Mar 1, 2017

Comment author: @damiendoligez

ocamlbuild is now a separate project that lives on GitHub.
PR transferred to ocaml/ocamlbuild#199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant