Skip to content

Commit

Permalink
Fix the OCaml initialization.
Browse files Browse the repository at this point in the history
If the field "build" exists in the .comp file, substitutions are activated. In particular [substitute_string] performs the association of variables (like "%PREFIX%"). However, the state [t] given as argument does not reflect the new version of OCaml, because [install_conf_ocaml] is called after.
Here we solve this by initializing the conf-ocaml.config before constructing the compiler.
  • Loading branch information
tuong committed Aug 8, 2012
1 parent d8b3e42 commit 5b45c16
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions src/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,8 @@ let print_compilers compilers repo =
Globals.msg " - %s\n" (OCaml_V.to_string v)
) new_compilers

let install_conf_ocaml () =
log "installing conf-ocaml";
let t = load_state () in
let install_conf_ocaml_config t =
let name = N.of_string Globals.default_package in
let version = V.of_string (Alias.to_string (File.Config.ocaml_version t.config)) in
let nv = NV.create name version in
(* .opam *)
let opam = File.OPAM.create nv in
File.OPAM.write (Path.G.opam t.global nv) opam;
(* description *)
let descr = File.Descr.create "Compiler configuration flags" in
File.Descr.write (Path.G.descr t.global nv) descr;
(* .config *)
let vars =
let map f l = List.map (fun (s,p) -> Variable.of_string s, S (f p)) l in
Expand All @@ -293,7 +283,21 @@ let install_conf_ocaml () =
] in

let config = File.Dot_config.create vars in
File.Dot_config.write (Path.C.config t.compiler name) config;
File.Dot_config.write (Path.C.config t.compiler name) config

let install_conf_ocaml () =
log "installing conf-ocaml";
let t = load_state () in
let name = N.of_string Globals.default_package in
let version = V.of_string (Alias.to_string (File.Config.ocaml_version t.config)) in
let nv = NV.create name version in
(* .opam *)
let opam = File.OPAM.create nv in
File.OPAM.write (Path.G.opam t.global nv) opam;
(* description *)
let descr = File.Descr.create "Compiler configuration flags" in
File.Descr.write (Path.G.descr t.global nv) descr;
install_conf_ocaml_config t;
(* installed *)
let installed_p = Path.C.installed t.compiler in
let installed = File.Installed.safe_read installed_p in
Expand Down Expand Up @@ -596,6 +600,15 @@ let init_ocaml f_exists alias (default_allowed, ocaml_version) =
let patches = List.map Stdlib_filename.basename patches in
List.iter Run.patch patches);
let err =
let t =
{ t with
compiler = alias_p;
installed =
let name = N.of_string Globals.default_package in
let version = V.of_string (Alias.to_string alias) in
let nv = NV.create name version in
NV.Set.add nv NV.Set.empty } in
install_conf_ocaml_config t;
if File.Comp.configure comp @ File.Comp.make comp <> [] then
Dirname.exec build_dir
[ ( "./configure" :: File.Comp.configure comp )
Expand Down

0 comments on commit 5b45c16

Please sign in to comment.