Skip to content

Commit

Permalink
Merge pull request #649 from rgrinberg/PATH-x
Browse files Browse the repository at this point in the history
Set the target's PATH when cross compiling
  • Loading branch information
rgrinberg committed Mar 23, 2018
2 parents fae5e78 + 8859a64 commit 141e979
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions src/env.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 141e979

Please sign in to comment.