Merge pull request #695 from rgrinberg/dune-pass-ocamlc
Pass ocamlc explicitly to configurator using DUNE_CONFIGURATOR
This commit is contained in:
commit
f1f60c4081
|
@ -419,14 +419,18 @@ module Pkg_config = struct
|
|||
end
|
||||
|
||||
let main ?(args=[]) ~name f =
|
||||
let ocamlc = ref None in
|
||||
let ocamlc = ref (
|
||||
match Sys.getenv "DUNE_CONFIGURATOR" with
|
||||
| s -> Some s
|
||||
| exception Not_found ->
|
||||
die "Configurator scripts must be ran with jbuilder. \
|
||||
To manually run a script, use $ jbuilder exec."
|
||||
) in
|
||||
let verbose = ref false in
|
||||
let dest_dir = ref None in
|
||||
let args =
|
||||
Arg.align
|
||||
([ "-ocamlc", Arg.String (fun s -> ocamlc := Some s),
|
||||
"PATH ocamlc command to use"
|
||||
; "-verbose", Arg.Set verbose,
|
||||
([ "-verbose", Arg.Set verbose,
|
||||
" be verbose"
|
||||
; "-dest-dir", Arg.String (fun s -> dest_dir := Some s),
|
||||
"DIR save temporary files to this directory"
|
||||
|
|
|
@ -303,6 +303,7 @@ let create ~(kind : Kind.t) ~path ~env ~name ~merlin ~targets () =
|
|||
"lib")
|
||||
; extend_var "MANPATH"
|
||||
(Config.local_install_man_dir ~context:name)
|
||||
; "DUNE_CONFIGURATOR", (Path.to_string ocamlc)
|
||||
]
|
||||
in
|
||||
Env.extend env ~vars:(Env.Map.of_list_exn vars)
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
module Configurator = Configurator.V1
|
||||
|
||||
let () =
|
||||
begin match Sys.getenv_opt "DUNE_CONFIGURATOR" with
|
||||
| None -> failwith "DUNE_CONFIGURATOR is not passed"
|
||||
| Some _ -> print_endline "DUNE_CONFIGURATOR is present"
|
||||
end;
|
||||
Configurator.main ~name:"config" (fun t ->
|
||||
match Configurator.ocaml_config_var t "version" with
|
||||
| None -> failwith "version is absent"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Show that config values are present
|
||||
$ jbuilder exec config/run.exe
|
||||
DUNE_CONFIGURATOR is present
|
||||
version is present
|
||||
|
||||
We're able to compile C program sucessfully
|
||||
|
|
Loading…
Reference in New Issue