Merge pull request #649 from rgrinberg/PATH-x

Set the target's PATH when cross compiling
This commit is contained in:
Rudi Grinberg 2018-03-24 00:13:53 +08:00 committed by GitHub
commit 141e979611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -300,13 +300,20 @@ let create ~(kind : Kind.t) ~path ~env ~name ~merlin ~targets () =
(Path.relative
(Config.local_install_dir ~context:name)
"lib")
; extend_var "PATH"
(Config.local_install_bin_dir ~context:name)
; extend_var "MANPATH"
(Config.local_install_man_dir ~context:name)
]
in
Env.extend env ~vars:(Env.Map.of_list_exn vars)
|> Env.update ~var:"PATH" ~f:(fun _ ->
match host with
| None ->
let _key, path =
extend_var "PATH" (Config.local_install_bin_dir ~context:name) in
Some path
| Some host ->
Env.get host.env "PATH"
)
in
let stdlib_dir = Path.of_string (Ocaml_config.standard_library ocfg) in
let natdynlink_supported = Ocaml_config.natdynlink_supported ocfg in

View File

@ -77,3 +77,6 @@ let diff x y =
| Some _ -> None
| None -> vx)
|> make
let update t ~var ~f =
make (Map.update t.vars var ~f)

View File

@ -23,4 +23,7 @@ val add : t -> var:Var.t -> value:string -> t
val diff : t -> t -> t
val update : t -> var:string -> f:(string option -> string option) -> t
val sexp_of_t : t -> Sexp.t