compile with findlib < 1.4

This commit is contained in:
Jeremie Dimino 2013-08-07 12:10:10 -04:00
parent 5b5839c039
commit 893cd5f327
3 changed files with 21 additions and 8 deletions

View File

@ -30,16 +30,25 @@ let () =
(* Use -linkpkg for creating toplevels *)
flag ["ocaml"; "link"; "toplevel"] & A"-linkpkg";
(* Optcomp *)
flag ["ocaml"; "compile"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"];
flag ["ocaml"; "ocamldep"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"];
flag ["ocaml"; "doc"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"];
dep ["ocaml"; "ocamldep"; "pa_optcomp"] ["syntax/pa_optcomp.cmo"];
let env = BaseEnvLight.load () in
let path = BaseEnvLight.var_get "compiler_libs" env in
let stdlib = BaseEnvLight.var_get "standard_library" env in
let findlib_version = BaseEnvLight.var_get "findlib_version" env in
let findlib_version =
Scanf.sscanf findlib_version "%d.%d" (Printf.sprintf "findlib_version=(%d, %d)")
in
(* Optcomp *)
let args =
S[A"-ppopt"; A"syntax/pa_optcomp.cmo";
A"-ppopt"; A"-let"; A"-ppopt"; A findlib_version]
in
flag ["ocaml"; "compile"; "pa_optcomp"] args;
flag ["ocaml"; "ocamldep"; "pa_optcomp"] args;
flag ["ocaml"; "doc"; "pa_optcomp"] args;
dep ["ocaml"; "ocamldep"; "pa_optcomp"] ["syntax/pa_optcomp.cmo"];
(* Add directories for compiler-libraries: *)
let paths = List.filter Sys.file_exists [path; path / "typing"; path / "parsing"; path / "utils"] in
let paths = List.map (fun path -> S [A "-I"; A path]) paths in

View File

@ -600,11 +600,13 @@ let () =
let topfind_log, set_topfind_log = S.create ~eq:(fun _ _ -> false) []
#if findlib_version >= (1, 4)
let () =
let real_log = !Topfind.log in
Topfind.log := fun str ->
set_topfind_log (str :: S.value topfind_log);
if S.value topfind_verbose then real_log str
#endif
let () =
Hashtbl.add

View File

@ -48,7 +48,8 @@ val set_hide_reserved : bool -> unit
(** Modifies {!hide_reserved}. *)
val topfind_verbose : bool signal
(** If [false] (the default) messages from findlib are hidden. *)
(** If [false] (the default) messages from findlib are hidden. This is only effective
with findlib >= 1.4. *)
val get_topfind_verbose : unit -> bool
(** Returns the value of {!topfind_verbose}. *)
@ -57,7 +58,8 @@ val set_topfind_verbose : bool -> unit
(** Modifies {!topfind_verbose}. *)
val topfind_log : string list signal
(** List of messages logged by findlib since the beginning of the session. *)
(** List of messages logged by findlib since the beginning of the session. This
requires findlib >= 1.4. *)
val show_box : bool signal
(** If [true] (the default) the completion bar is displayed. *)