From: Pierre C. <Ba...@us...> - 2012-04-25 21:21:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via f089f8fedd909a0c41a4fe75fc52e2584b31f7f1 (commit) from 52ee072e134d531d77ee2de21fc7824ce8bde751 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f089f8fedd909a0c41a4fe75fc52e2584b31f7f1 Author: chicco <cha...@cr...> Date: Wed Apr 25 23:21:04 2012 +0200 [krobot_ax12_control] small tool to control ax12 ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index 9472d20..08eb04c 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -220,6 +220,14 @@ Executable "krobot-can-display" MainIs: krobot_can_display.ml BuildDepends: krobot.can, lwt.syntax, sexplib, sexplib.syntax, cairo.lablgtk2, lwt.glib +Executable "krobot-ax12-control" + Path: src/tools + Build$: flag(gtk) + Install$: flag(gtk) + CompiledObject: best + MainIs: krobot_ax12_control.ml + BuildDepends: krobot.can, lwt.syntax + # +-------------------------------------------------------------------+ # | Examples | # +-------------------------------------------------------------------+ diff --git a/info/control2011/_tags b/info/control2011/_tags index 7a89fb3..b45f0f4 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,7 +2,7 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: fb711b43f944541635b3a5ea56a5681e) +# DO NOT EDIT (digest: 3852a61af000802215e40b6ad6830d71) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -17,8 +17,8 @@ "_darcs": -traverse "_darcs": not_hygienic # Library krobot -"src/lib": include -<src/lib/krobot.{cma,cmxa}>: use_libkrobot +"src/lib/krobot.cmxs": use_krobot +<src/lib/krobot.{cma,cmxa}>: use_libkrobot_stubs <src/lib/*.ml{,i}>: pkg_lwt.unix <src/lib/*.ml{,i}>: pkg_lwt.syntax <src/lib/*.ml{,i}>: pkg_lwt.react @@ -26,8 +26,8 @@ "src/lib/krobot_message_stubs.c": pkg_lwt.syntax "src/lib/krobot_message_stubs.c": pkg_lwt.react # Library krobot-can -"src/can": include -<src/can/krobot-can.{cma,cmxa}>: use_libkrobot-can +"src/can/krobot-can.cmxs": use_krobot-can +<src/can/krobot-can.{cma,cmxa}>: use_libkrobot-can_stubs <src/can/*.ml{,i}>: use_krobot <src/can/*.ml{,i}>: pkg_sexplib.syntax <src/can/*.ml{,i}>: pkg_sexplib @@ -62,10 +62,6 @@ <src/tools/krobot_can_display.{native,byte}>: pkg_lwt.glib <src/tools/krobot_can_display.{native,byte}>: pkg_cairo.lablgtk2 <src/tools/krobot_can_display.{native,byte}>: pkg_bitstring -<src/tools/*.ml{,i}>: use_krobot-can -<src/tools/*.ml{,i}>: pkg_sexplib.syntax -<src/tools/*.ml{,i}>: pkg_sexplib -<src/tools/*.ml{,i}>: pkg_bitstring # Executable krobot-calibrate-sharps <src/tools/krobot_calibrate_sharps.{native,byte}>: use_krobot <src/tools/krobot_calibrate_sharps.{native,byte}>: pkg_lwt.unix @@ -86,6 +82,19 @@ <src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix <src/tools/krobot_simulator.{native,byte}>: pkg_lwt.syntax <src/tools/krobot_simulator.{native,byte}>: pkg_lwt.react +# Executable krobot-ax12-control +<src/tools/krobot_ax12_control.{native,byte}>: use_krobot-can +<src/tools/krobot_ax12_control.{native,byte}>: use_krobot +<src/tools/krobot_ax12_control.{native,byte}>: pkg_sexplib.syntax +<src/tools/krobot_ax12_control.{native,byte}>: pkg_sexplib +<src/tools/krobot_ax12_control.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_ax12_control.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_ax12_control.{native,byte}>: pkg_lwt.react +<src/tools/krobot_ax12_control.{native,byte}>: pkg_bitstring +<src/tools/*.ml{,i}>: use_krobot-can +<src/tools/*.ml{,i}>: pkg_sexplib.syntax +<src/tools/*.ml{,i}>: pkg_sexplib +<src/tools/*.ml{,i}>: pkg_bitstring # Executable krobot-viewer <src/tools/krobot_viewer.{native,byte}>: use_krobot <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.unix diff --git a/info/control2011/myocamlbuild.ml b/info/control2011/myocamlbuild.ml index 2cfed59..e871f21 100644 --- a/info/control2011/myocamlbuild.ml +++ b/info/control2011/myocamlbuild.ml @@ -1,5 +1,5 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 4d333a06e10a6d542b31a757ed455f80) *) +(* DO NOT EDIT (digest: 5747542e19b7f9cfea0dfefe92aa4aee) *) module OASISGettext = struct # 21 "/media/data/ocaml/oasis/src/oasis/OASISGettext.ml" @@ -330,19 +330,24 @@ module MyOCamlbuildBase = struct open Ocamlbuild_plugin + module OC = Ocamlbuild_pack.Ocaml_compiler type dir = string type file = string type name = string type tag = string -# 55 "/media/data/ocaml/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 56 "/media/data/ocaml/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" type t = { lib_ocaml: (name * dir list) list; lib_c: (name * dir * file list) list; flags: (tag list * (spec OASISExpr.choices)) list; + (* Replace the 'dir: include' from _tags by a precise interdepends in + * directory. + *) + includes: (dir * dir list) list; } let env_filename = @@ -355,6 +360,12 @@ module MyOCamlbuildBase = struct (fun dispatch -> dispatch e) lst + let tag_libstubs nm = + "use_lib"^nm^"_stubs" + + let nm_libstubs nm = + nm^"_stubs" + let dispatch t e = let env = BaseEnvLight.load @@ -382,40 +393,123 @@ module MyOCamlbuildBase = struct Options.ext_dll, "ext_dll"; ] + | Before_rules -> + (* TODO: move this into its own file and conditionnaly include it, if + * needed. + *) + (* OCaml cmxs rules: cmxs available in ocamlopt but not ocamlbuild. + Copied from ocaml_specific.ml in ocamlbuild sources. *) + let has_native_dynlink = + try + bool_of_string (BaseEnvLight.var_get "native_dynlink" env) + with Not_found -> + false + in + if has_native_dynlink && String.sub Sys.ocaml_version 0 4 = "3.11" then + begin + let ext_lib = !Options.ext_lib in + let ext_obj = !Options.ext_obj in + let ext_dll = !Options.ext_dll in + let x_o = "%"-.-ext_obj in + let x_a = "%"-.-ext_lib in + let x_dll = "%"-.-ext_dll in + let x_p_o = "%.p"-.-ext_obj in + let x_p_a = "%.p"-.-ext_lib in + let x_p_dll = "%.p"-.-ext_dll in + + rule "ocaml: mldylib & p.cmx* & p.o* -> p.cmxs & p.so" + ~tags:["ocaml"; "native"; "profile"; "shared"; "library"] + ~prods:["%.p.cmxs"; x_p_dll] + ~dep:"%.mldylib" + (OC.native_profile_shared_library_link_mldylib + "%.mldylib" "%.p.cmxs"); + + rule "ocaml: mldylib & cmx* & o* -> cmxs & so" + ~tags:["ocaml"; "native"; "shared"; "library"] + ~prods:["%.cmxs"; x_dll] + ~dep:"%.mldylib" + (OC.native_shared_library_link_mldylib + "%.mldylib" "%.cmxs"); + + rule "ocaml: p.cmx & p.o -> p.cmxs & p.so" + ~tags:["ocaml"; "native"; "profile"; "shared"; "library"] + ~prods:["%.p.cmxs"; x_p_dll] + ~deps:["%.p.cmx"; x_p_o] + (OC.native_shared_library_link ~tags:["profile"] + "%.p.cmx" "%.p.cmxs"); + + rule "ocaml: p.cmxa & p.a -> p.cmxs & p.so" + ~tags:["ocaml"; "native"; "profile"; "shared"; "library"] + ~prods:["%.p.cmxs"; x_p_dll] + ~deps:["%.p.cmxa"; x_p_a] + (OC.native_shared_library_link ~tags:["profile"; "linkall"] + "%.p.cmxa" "%.p.cmxs"); + + rule "ocaml: cmx & o -> cmxs" + ~tags:["ocaml"; "native"; "shared"; "library"] + ~prods:["%.cmxs"] + ~deps:["%.cmx"; x_o] + (OC.native_shared_library_link "%.cmx" "%.cmxs"); + + rule "ocaml: cmx & o -> cmxs & so" + ~tags:["ocaml"; "native"; "shared"; "library"] + ~prods:["%.cmxs"; x_dll] + ~deps:["%.cmx"; x_o] + (OC.native_shared_library_link "%.cmx" "%.cmxs"); + + rule "ocaml: cmxa & a -> cmxs & so" + ~tags:["ocaml"; "native"; "shared"; "library"] + ~prods:["%.cmxs"; x_dll] + ~deps:["%.cmxa"; x_a] + (OC.native_shared_library_link ~tags:["linkall"] + "%.cmxa" "%.cmxs"); + end + | After_rules -> (* Declare OCaml libraries *) List.iter (function - | lib, [] -> - ocaml_lib lib; - | lib, dir :: tl -> - ocaml_lib ~dir:dir lib; + | nm, [] -> + ocaml_lib nm + | nm, dir :: tl -> + ocaml_lib ~dir:dir (dir^"/"^nm); List.iter (fun dir -> - flag - ["ocaml"; "use_"^lib; "compile"] - (S[A"-I"; P dir])) + List.iter + (fun str -> + flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) + ["compile"; "infer_interface"; "doc"]) tl) t.lib_ocaml; + (* Declare directories dependencies, replace "include" in _tags. *) + List.iter + (fun (dir, include_dirs) -> + Pathname.define_context dir include_dirs) + t.includes; + (* Declare C libraries *) List.iter (fun (lib, dir, headers) -> (* Handle C part of library *) - flag ["link"; "library"; "ocaml"; "byte"; "use_lib"^lib] - (S[A"-dllib"; A("-l"^lib); A"-cclib"; A("-l"^lib)]); + flag ["link"; "library"; "ocaml"; "byte"; tag_libstubs lib] + (S[A"-dllib"; A("-l"^(nm_libstubs lib)); A"-cclib"; + A("-l"^(nm_libstubs lib))]); - flag ["link"; "library"; "ocaml"; "native"; "use_lib"^lib] - (S[A"-cclib"; A("-l"^lib)]); + flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib] + (S[A"-cclib"; A("-l"^(nm_libstubs lib))]); - flag ["link"; "program"; "ocaml"; "byte"; "use_lib"^lib] - (S[A"-dllib"; A("dll"^lib)]); + flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib] + (S[A"-dllib"; A("dll"^(nm_libstubs lib))]); (* When ocaml link something that use the C library, then one need that file to be up to date. *) - dep ["link"; "ocaml"; "use_lib"^lib] - [dir/"lib"^lib^"."^(!Options.ext_lib)]; + dep ["link"; "ocaml"; "program"; tag_libstubs lib] + [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; + + dep ["compile"; "ocaml"; "program"; tag_libstubs lib] + [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; (* TODO: be more specific about what depends on headers *) (* Depends on .h files *) @@ -453,15 +547,22 @@ open Ocamlbuild_plugin;; let package_default = { MyOCamlbuildBase.lib_ocaml = - [("src/lib/krobot", ["src/lib"]); ("src/can/krobot-can", ["src/can"])]; + [("krobot", ["src/lib"]); ("krobot-can", ["src/can"])]; lib_c = [("krobot", "src/lib", []); ("krobot-can", "src/can", [])]; flags = []; + includes = + [ + ("src/tools", ["src/can"; "src/lib"]); + ("src/driver", ["src/can"]); + ("src/can", ["src/lib"]); + ("examples", ["src/can"]) + ]; } ;; let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; -# 465 "myocamlbuild.ml" +# 566 "myocamlbuild.ml" (* OASIS_STOP *) open Ocamlbuild_plugin diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index 8a23328..e2a975d 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,9 +1,9 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 300912e61b966bc3109c698735347ca1) *) +(* DO NOT EDIT (digest: ebf28739fe9d63028b7611d27a835a73) *) (* - Regenerated by OASIS v0.2.1~alpha1 + Regenerated by OASIS v0.3.0~rc3 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) @@ -90,6 +90,8 @@ end module OASISUtils = struct # 21 "/media/data/ocaml/oasis/src/oasis/OASISUtils.ml" + open OASISGettext + module MapString = Map.Make(String) let map_string_of_assoc assoc = @@ -224,6 +226,19 @@ module OASISUtils = struct let failwithf fmt = Printf.ksprintf failwith fmt + let file_exists fn = + let dirname = Filename.dirname fn in + let basename = Filename.basename fn in + if Sys.file_exists dirname then + if basename = Filename.current_dir_name then + true + else + List.mem + basename + (Array.to_list (Sys.readdir dirname)) + else + false + end module PropList = struct @@ -237,18 +252,23 @@ module PropList = struct exception No_printer of name exception Unknown_field of name * name - let string_of_exception = - function - | Not_set (nm, Some rsn) -> - Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn - | Not_set (nm, None) -> - Printf.sprintf (f_ "Field '%s' is not set") nm - | No_printer nm -> - Printf.sprintf (f_ "No default printer for value %s") nm - | Unknown_field (nm, schm) -> - Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm - | e -> - raise e + let () = + Printexc.register_printer + (function + | Not_set (nm, Some rsn) -> + Some + (Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn) + | Not_set (nm, None) -> + Some + (Printf.sprintf (f_ "Field '%s' is not set") nm) + | No_printer nm -> + Some + (Printf.sprintf (f_ "No default printer for value %s") nm) + | Unknown_field (nm, schm) -> + Some + (Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm) + | _ -> + None) module Data = struct @@ -262,7 +282,7 @@ module PropList = struct let clear t = Hashtbl.clear t -# 66 "/media/data/ocaml/oasis/src/oasis/PropList.ml" +# 71 "/media/data/ocaml/oasis/src/oasis/PropList.ml" end module Schema = @@ -535,20 +555,6 @@ module OASISMessage = struct let error ~ctxt fmt = generic_message ~ctxt `Error fmt - - let string_of_exception e = - try - PropList.string_of_exception e - with - | Failure s -> - s - | e -> - Printexc.to_string e - - (* TODO - let register_exn_printer f = - *) - end module OASISVersion = struct @@ -981,6 +987,7 @@ module OASISTypes = struct type library = { lib_modules: string list; + lib_pack: bool; lib_internal_modules: string list; lib_findlib_parent: findlib_name option; lib_findlib_name: findlib_name option; @@ -1176,7 +1183,8 @@ module OASISUnixPath = struct end module OASISSection = struct -# 1 "/media/data/ocaml/oasis/src/oasis/OASISSection.ml" +# 21 "/media/data/ocaml/oasis/src/oasis/OASISSection.ml" + open OASISTypes let section_kind_common = @@ -1259,7 +1267,7 @@ module OASISExecutable = struct if not is_native_exec && not exec.exec_custom && bs.bs_c_sources <> [] then - Some (dir^"/dll"^cs.cs_name^(ext_dll ())) + Some (dir^"/dll"^cs.cs_name^"_stubs"^(ext_dll ())) else None @@ -1274,40 +1282,116 @@ module OASISLibrary = struct type library_name = name - let generated_unix_files ~ctxt (cs, bs, lib) - source_file_exists is_native ext_lib ext_dll = + (* Look for a module file, considering capitalization or not. *) + let find_module source_file_exists (cs, bs, lib) modul = + let possible_base_fn = + List.map + (OASISUnixPath.concat bs.bs_path) + [modul; + OASISUnixPath.uncapitalize_file modul; + OASISUnixPath.capitalize_file modul] + in + (* TODO: we should be able to be able to determine the source for every + * files. Hence we should introduce a Module(source: fn) for the fields + * Modules and InternalModules + *) + List.fold_left + (fun acc base_fn -> + match acc with + | `No_sources _ -> + begin + let file_found = + List.fold_left + (fun acc ext -> + if source_file_exists (base_fn^ext) then + (base_fn^ext) :: acc + else + acc) + [] + [".ml"; ".mli"; ".mll"; ".mly"] + in + match file_found with + | [] -> + acc + | lst -> + `Sources (base_fn, lst) + end + | `Sources _ -> + acc) + (`No_sources possible_base_fn) + possible_base_fn + + let source_unix_files ~ctxt (cs, bs, lib) source_file_exists = + List.fold_left + (fun acc modul -> + match find_module source_file_exists (cs, bs, lib) modul with + | `Sources (base_fn, lst) -> + (base_fn, lst) :: acc + | `No_sources _ -> + OASISMessage.warning + ~ctxt + (f_ "Cannot find source file matching \ + module '%s' in library %s") + modul cs.cs_name; + acc) + [] + (lib.lib_modules @ lib.lib_internal_modules) + + let generated_unix_files + ~ctxt + ~is_native + ~has_native_dynlink + ~ext_lib + ~ext_dll + ~source_file_exists + (cs, bs, lib) = + + let find_modules lst ext = + let find_module modul = + match find_module source_file_exists (cs, bs, lib) modul with + | `Sources (base_fn, _) -> + [base_fn] + | `No_sources lst -> + OASISMessage.warning + ~ctxt + (f_ "Cannot find source file matching \ + module '%s' in library %s") + modul cs.cs_name; + lst + in + List.map + (fun nm -> + List.map + (fun base_fn -> base_fn ^"."^ext) + (find_module nm)) + lst + in + (* The headers that should be compiled along *) let headers = - List.fold_left - (fun hdrs modul -> - try - let base_fn = - List.find - (fun fn -> - source_file_exists (fn^".ml") || - source_file_exists (fn^".mli") || - source_file_exists (fn^".mll") || - source_file_exists (fn^".mly")) - (List.map - (OASISUnixPath.concat bs.bs_path) - [modul; - OASISUnixPath.uncapitalize_file modul; - OASISUnixPath.capitalize_file modul]) - in - [base_fn^".cmi"] :: hdrs - with Not_found -> - OASISMessage.warning - ~ctxt - (f_ "Cannot find source file matching \ - module '%s' in library %s") - modul cs.cs_name; - (List.map (OASISUnixPath.concat bs.bs_path) - [modul^".cmi"; - OASISUnixPath.uncapitalize_file modul ^ ".cmi"; - OASISUnixPath.capitalize_file modul ^ ".cmi"]) - :: hdrs) + if lib.lib_pack then [] - lib.lib_modules + else + find_modules + lib.lib_modules + "cmi" + in + + (* The .cmx that be compiled along *) + let cmxs = + let should_be_built = + (not lib.lib_pack) && (* Do not install .cmx packed submodules *) + match bs.bs_compiled_object with + | Native -> true + | Best -> is_native + | Byte -> false + in + if should_be_built then + find_modules + (lib.lib_modules @ lib.lib_internal_modules) + "cmx" + else + [] in let acc_nopath = @@ -1316,16 +1400,27 @@ module OASISLibrary = struct (* Compute what libraries should be built *) let acc_nopath = + (* Add the packed header file if required *) + let add_pack_header acc = + if lib.lib_pack then + [cs.cs_name^".cmi"] :: acc + else + acc + in let byte acc = - [cs.cs_name^".cma"] :: acc + add_pack_header ([cs.cs_name^".cma"] :: acc) in let native acc = - [cs.cs_name^".cmxa"] :: [cs.cs_name^(ext_lib ())] :: acc + let acc = [cs.cs_name^".cmxa"] :: [cs.cs_name^ext_lib] :: acc in + add_pack_header + (if has_native_dynlink then + [cs.cs_name^".cmxs"] :: acc + else acc) in match bs.bs_compiled_object with | Native -> byte (native acc_nopath) - | Best when is_native () -> + | Best when is_native -> byte (native acc_nopath) | Byte | Best -> byte acc_nopath @@ -1335,9 +1430,9 @@ module OASISLibrary = struct let acc_nopath = if bs.bs_c_sources <> [] then begin - ["lib"^cs.cs_name^(ext_lib ())] + ["lib"^cs.cs_name^"_stubs"^ext_lib] :: - ["dll"^cs.cs_name^(ext_dll ())] + ["dll"^cs.cs_name^"_stubs"^ext_dll] :: acc_nopath end @@ -1351,7 +1446,7 @@ module OASISLibrary = struct (List.rev_map (OASISUnixPath.concat bs.bs_path)) acc_nopath) - headers + (headers @ cmxs) type group_t = @@ -1707,8 +1802,6 @@ module BaseMessage = struct let error fmt = error ~ctxt:!default fmt - let string_of_exception = string_of_exception - end module BaseFilePath = struct @@ -1884,9 +1977,9 @@ module BaseEnv = struct let default = [ - OFileLoad, lazy (MapString.find name !env_from_file); + OFileLoad, (fun () -> MapString.find name !env_from_file); ODefault, dflt; - OGetEnv, lazy (Sys.getenv name); + OGetEnv, (fun () -> Sys.getenv name); ] in @@ -1905,11 +1998,11 @@ module BaseEnv = struct let var_get_low lst = let errors, res = List.fold_left - (fun (errors, res) (_, v) -> + (fun (errors, res) (o, v) -> if res = None then begin try - errors, Some (Lazy.force v) + errors, Some (v ()) with | Not_found -> errors, res @@ -1923,12 +2016,7 @@ module BaseEnv = struct ([], None) (List.sort (fun (o1, _) (o2, _) -> - if o1 < o2 then - 1 - else if o1 = o2 then - 0 - else - -1) + Pervasives.compare o2 o1) lst) in match res, errors with @@ -1950,7 +2038,7 @@ module BaseEnv = struct FieldRO.create ~schema ~name - ~parse:(fun ?(context=ODefault) s -> [context, lazy s]) + ~parse:(fun ?(context=ODefault) s -> [context, fun () -> s]) ~print:var_get_low ~default ~update:(fun ?context x old_x -> x @ old_x) @@ -1972,7 +2060,8 @@ module BaseEnv = struct dflt = if Schema.mem schema name then begin - Schema.set schema env ~context:ODefault name (Lazy.force dflt); + (* TODO: look suspsicious, we want to memorize dflt not dflt () *) + Schema.set schema env ~context:ODefault name (dflt ()); fun () -> var_get name end else @@ -1998,7 +2087,7 @@ module BaseEnv = struct ~cli:CLIAuto ~arg_help:"Print even non-printable variable. (debug)" "print_hidden" - (lazy "false") + (fun () -> "false") let var_all () = List.rev @@ -2018,7 +2107,6 @@ module BaseEnv = struct env_from_file := BaseEnvLight.load ?allow_empty ?filename () let unload () = - (* TODO: reset lazy values *) env_from_file := MapString.empty; Data.clear env @@ -2026,8 +2114,13 @@ module BaseEnv = struct let chn = open_out_bin filename in - Schema.iter - (fun nm def _ -> + let output nm value = + Printf.fprintf chn "%s=%S\n" nm value + in + let mp_todo = + (* Dump data from schema *) + Schema.fold + (fun mp_todo nm def _ -> if def.dump then begin try @@ -2037,11 +2130,18 @@ module BaseEnv = struct env nm in - Printf.fprintf chn "%s = %S\n" nm value + output nm value with Not_set _ -> () - end) - schema; + end; + MapString.remove nm mp_todo) + !env_from_file + schema + in + (* Dump data defined outside of schema *) + MapString.iter output mp_todo; + + (* End of the dump *) close_out chn let print () = @@ -2173,23 +2273,21 @@ module BaseEnv = struct Printf.sprintf (f_ "%s %s%s") arg_hlp hlp default_value ] | CLIEnable -> - [ - arg_concat "--enable-" arg_name, - Arg.Unit (fun () -> var_set "true"), - Printf.sprintf (f_ " %s%s") hlp - (if default_value = " [true]" then - (s_ " [default]") - else - ""); - - arg_concat "--disable-" arg_name, - Arg.Unit (fun () -> var_set "false"), - Printf.sprintf (f_ " %s%s") hlp - (if default_value = " [false]" then - (s_ " [default]") - else - ""); - ] + let dflt = + if default_value = " [true]" then + s_ " [default: enabled]" + else + s_ " [default: disabled]" + in + [ + arg_concat "--enable-" arg_name, + Arg.Unit (fun () -> var_set "true"), + Printf.sprintf (f_ " %s%s") hlp dflt; + + arg_concat "--disable-" arg_name, + Arg.Unit (fun () -> var_set "false"), + Printf.sprintf (f_ " %s%s") hlp dflt + ] | CLIUser lst -> lst in @@ -2301,7 +2399,7 @@ module BaseFileUtil = struct ((combined_paths paths) * exts) in List.find - Sys.file_exists + OASISUtils.file_exists alternatives let which prg = @@ -2364,7 +2462,7 @@ module BaseFileUtil = struct let tgt = fix_dir tgt in - if Sys.file_exists tgt then + if OASISUtils.file_exists tgt then begin if not (Sys.is_directory tgt) then OASISUtils.failwithf @@ -2375,7 +2473,7 @@ module BaseFileUtil = struct else begin mkdir_parent f (Filename.dirname tgt); - if not (Sys.file_exists tgt) then + if not (OASISUtils.file_exists tgt) then begin f tgt; mkdir tgt @@ -2429,7 +2527,7 @@ module BaseFileUtil = struct end else begin - if Sys.file_exists fn then + if OASISUtils.file_exists fn then [fn] else [] @@ -2475,24 +2573,24 @@ module BaseCheck = struct let prog_best prg prg_lst = var_redefine prg - (lazy - (let alternate = - List.fold_left - (fun res e -> - match res with - | Some _ -> - res - | None -> - try - Some (BaseFileUtil.which e) - with Not_found -> - None) - None - prg_lst - in - match alternate with - | Some prg -> prg - | None -> raise Not_found)) + (fun () -> + let alternate = + List.fold_left + (fun res e -> + match res with + | Some _ -> + res + | None -> + try + Some (BaseFileUtil.which e) + with Not_found -> + None) + None + prg_lst + in + match alternate with + | Some prg -> prg + | None -> raise Not_found) let prog prg = prog_best prg [prg] @@ -2515,33 +2613,33 @@ module BaseCheck = struct var_redefine ~hide:true var - (lazy - (let version_str = - match fversion () with - | "[Distributed with OCaml]" -> - begin - try - (var_get "ocaml_version") - with Not_found -> - warning - (f_ "Variable ocaml_version not defined, fallback \ - to default"); - Sys.ocaml_version - end - | res -> - res - in - let version = - OASISVersion.version_of_string version_str - in - if OASISVersion.comparator_apply version cmp then - version_str - else - failwithf - (f_ "Cannot satisfy version constraint on %s: %s (version: %s)") - var_prefix - (OASISVersion.string_of_comparator cmp) - version_str)) + (fun () -> + let version_str = + match fversion () with + | "[Distributed with OCaml]" -> + begin + try + (var_get "ocaml_version") + with Not_found -> + warning + (f_ "Variable ocaml_version not defined, fallback \ + to default"); + Sys.ocaml_version + end + | res -> + res + in + let version = + OASISVersion.version_of_string version_str + in + if OASISVersion.comparator_apply version cmp then + version_str + else + failwithf + (f_ "Cannot satisfy version constraint on %s: %s (version: %s)") + var_prefix + (OASISVersion.string_of_comparator cmp) + version_str) () let package_version pkg = @@ -2572,7 +2670,7 @@ module BaseCheck = struct let vl = var_redefine var - (lazy (findlib_dir pkg)) + (fun () -> findlib_dir pkg) () in ( @@ -2648,18 +2746,23 @@ module BaseOCamlcConfig = struct mp in + let cache = + lazy + (var_protect + (Marshal.to_string + (split_field + SMap.empty + (BaseExec.run_read_output + (ocamlc ()) ["-config"])) + [])) + in var_redefine "ocamlc_config_map" ~hide:true ~dump:false - (lazy - (var_protect - (Marshal.to_string - (split_field - SMap.empty - (BaseExec.run_read_output - (ocamlc ()) ["-config"])) - []))) + (fun () -> + (* TODO: update if ocamlc change !!! *) + Lazy.force cache) let var_define nm = (* Extract data from ocamlc -config *) @@ -2683,20 +2786,20 @@ module BaseOCamlcConfig = struct in var_redefine nm - (lazy - (try - let map = - avlbl_config_get () - in - let value = - SMap.find nm_config map - in - value_config value - with Not_found -> - failwithf - (f_ "Cannot find field '%s' in '%s -config' output") - nm - (ocamlc ()))) + (fun () -> + try + let map = + avlbl_config_get () + in + let value = + SMap.find nm_config map + in + value_config value + with Not_found -> + failwithf + (f_ "Cannot find field '%s' in '%s -config' output") + nm + (ocamlc ())) end @@ -2730,13 +2833,13 @@ module BaseStandardVar = struct var_define ~short_desc:(fun () -> s_ "Package name") "pkg_name" - (lazy (pkg_get ()).name) + (fun () -> (pkg_get ()).name) let pkg_version = var_define ~short_desc:(fun () -> s_ "Package version") "pkg_version" - (lazy + (fun () -> (OASISVersion.string_of_version (pkg_get ()).version)) let c = BaseOCamlcConfig.var_define @@ -2785,174 +2888,216 @@ module BaseStandardVar = struct let prefix = p "prefix" (fun () -> s_ "Install architecture-independent files dir") - (lazy - (match os_type () with - | "Win32" -> - let program_files = - Sys.getenv "PROGRAMFILES" - in - program_files/(pkg_name ()) - | _ -> - "/usr/local")) + (fun () -> + match os_type () with + | "Win32" -> + let program_files = + Sys.getenv "PROGRAMFILES" + in + program_files/(pkg_name ()) + | _ -> + "/usr/local") let exec_prefix = p "exec_prefix" (fun () -> s_ "Install architecture-dependent files in dir") - (lazy "$prefix") + (fun () -> "$prefix") let bindir = p "bindir" (fun () -> s_ "User executables") - (lazy ("$exec_prefix"/"bin")) + (fun () -> "$exec_prefix"/"bin") let sbindir = p "sbindir" (fun () -> s_ "System admin executables") - (lazy ("$exec_prefix"/"sbin")) + (fun () -> "$exec_prefix"/"sbin") let libexecdir = p "libexecdir" (fun () -> s_ "Program executables") - (lazy ("$exec_prefix"/"libexec")) + (fun () -> "$exec_prefix"/"libexec") let sysconfdir = p "sysconfdir" (fun () -> s_ "Read-only single-machine data") - (lazy ("$prefix"/"etc")) + (fun () -> "$prefix"/"etc") let sharedstatedir = p "sharedstatedir" (fun () -> s_ "Modifiable architecture-independent data") - (lazy ("$prefix"/"com")) + (fun () -> "$prefix"/"com") let localstatedir = p "localstatedir" (fun () -> s_ "Modifiable single-machine data") - (lazy ("$prefix"/"var")) + (fun () -> "$prefix"/"var") let libdir = p "libdir" (fun () -> s_ "Object code libraries") - (lazy ("$exec_prefix"/"lib")) + (fun () -> "$exec_prefix"/"lib") let datarootdir = p "datarootdir" (fun () -> s_ "Read-only arch-independent data root") - (lazy ("$prefix"/"share")) + (fun () -> "$prefix"/"share") let datadir = p "datadir" (fun () -> s_ "Read-only architecture-independent data") - (lazy ("$datarootdir")) + (fun () -> "$datarootdir") let infodir = p "infodir" (fun () -> s_ "Info documentation") - (lazy ("$datarootdir"/"info")) + (fun () -> "$datarootdir"/"info") let localedir = p "localedir" (fun () -> s_ "Locale-dependent data") - (lazy ("$datarootdir"/"locale")) + (fun () -> "$datarootdir"/"locale") let mandir = p "mandir" (fun () -> s_ "Man documentation") - (lazy ("$datarootdir"/"man")) + (fun () -> "$datarootdir"/"man") let docdir = p "docdir" (fun () -> s_ "Documentation root") - (lazy ("$datarootdir"/"doc"/"$pkg_name")) + (fun () -> "$datarootdir"/"doc"/"$pkg_name") let htmldir = p "htmldir" (fun () -> s_ "HTML documentation") - (lazy ("$docdir")) + (fun () -> "$docdir") let dvidir = p "dvidir" (fun () -> s_ "DVI documentation") - (lazy ("$docdir")) + (fun () -> "$docdir") let pdfdir = p "pdfdir" (fun () -> s_ "PDF documentation") - (lazy ("$docdir")) + (fun () -> "$docdir") let psdir = p "psdir" (fun () -> s_ "PS documentation") - (lazy ("$docdir")) + (fun () -> "$docdir") let destdir = p "destdir" (fun () -> s_ "Prepend a path when installing package") - (lazy - (raise - (PropList.Not_set - ("destdir", - Some (s_ "undefined by construct"))))) + (fun () -> + raise + (PropList.Not_set + ("destdir", + Some (s_ "undefined by construct")))) let findlib_version = var_define "findlib_version" - (lazy - (BaseCheck.package_version "findlib")) + (fun () -> + BaseCheck.package_version "findlib") let is_native = var_define "is_native" - (lazy - (try - let _s : string = - ocamlopt () - in - "true" - with PropList.Not_set _ -> - let _s : string = - ocamlc () - in - "false")) + (fun () -> + try + let _s : string = + ocamlopt () + in + "true" + with PropList.Not_set _ -> + let _s : string = + ocamlc () + in + "false") let ext_program = var_define "suffix_program" - (lazy - (match os_type () with - | "Win32" -> ".exe" - | _ -> "" - )) + (fun () -> + match os_type () with + | "Win32" -> ".exe" + | _ -> "") let rm = var_define ~short_desc:(fun () -> s_ "Remove a file.") "rm" - (lazy - (match os_type () with - | "Win32" -> "del" - | _ -> "rm -f")) + (fun () -> + match os_type () with + | "Win32" -> "del" + | _ -> "rm -f") let rmdir = var_define ~short_desc:(fun () -> s_ "Remove a directory.") "rmdir" - (lazy - (match os_type () with - | "Win32" -> "rd" - | _ -> "rm -rf")) + (fun () -> + match os_type () with + | "Win32" -> "rd" + | _ -> "rm -rf") let debug = var_define - ~short_desc:(fun () -> s_ "Compile with ocaml debug flag on.") + ~short_desc:(fun () -> s_ "Turn ocaml debug flag on") + ~cli:CLIEnable "debug" - (lazy "true") + (fun () -> "true") let profile = var_define - ~short_desc:(fun () -> s_ "Compile with ocaml profile flag on.") + ~short_desc:(fun () -> s_ "Turn ocaml profile flag on") + ~cli:CLIEnable "profile" - (lazy "false") + (fun () -> "false") + + let tests = + var_define + ~short_desc:(fun () -> + s_ "Compile tests executable and library and run them") + ~cli:CLIEnable + "tests" + (fun () -> "false") + + let docs = + var_define + ~short_desc:(fun () -> s_ "Create documentations") + ~cli:CLIEnable + "docs" + (fun () -> "true") + + let native_dynlink = + var_define + ~short_desc:(fun () -> s_ "Compiler support generation of .cmxs.") + ~cli:CLINone + "native_dynlink" + (fun () -> + let res = + if bool_of_string (is_native ()) then + begin + let ocamlfind = ocamlfind () in + try + let fn = + BaseExec.run_read_one_line + ocamlfind + ["query"; "-predicates"; "native"; "dynlink"; + "-format"; "%d/%a"] + in + Sys.file_exists fn + with _ -> + false + end + else + false + in + string_of_bool res) let init pkg = rpkg := Some pkg @@ -3041,7 +3186,7 @@ module BaseLog = struct begin let acc = try - Scanf.bscanf scbuf "%S %S@\n" + Scanf.bscanf scbuf "%S %S\n" (fun e d -> let t = e, d @@ -3161,7 +3306,7 @@ module BaseBuilt = struct let registered = List.fold_left (fun registered fn -> - if Sys.file_exists fn then + if OASISUtils.file_exists fn then begin BaseLog.register (to_log_event_file t nm) @@ -3193,7 +3338,7 @@ module BaseBuilt = struct let fold t nm f acc = List.fold_left (fun acc (_, fn) -> - if Sys.file_exists fn then + if OASISUtils.file_exists fn then begin f acc fn end @@ -3256,13 +3401,13 @@ module BaseBuilt = struct let unix_lst = OASISLibrary.generated_unix_files ~ctxt:!BaseContext.default + ~source_file_exists:(fun fn -> + OASISUtils.file_exists (BaseFilePath.of_unix fn)) + ~is_native:(bool_of_string (is_native ())) + ~has_native_dynlink:(bool_of_string (native_dynlink ())) + ~ext_lib:(ext_lib ()) + ~ext_dll:(ext_dll ()) (cs, bs, lib) - (fun fn -> - Sys.file_exists (BaseFilePath.of_unix fn)) - (fun () -> - bool_of_string (is_native ())) - ext_lib - ext_dll in let evs = [BLib, @@ -3336,31 +3481,32 @@ module BaseDynVar = struct List.iter (function | Executable (cs, bs, exec) -> - var_ignore - (var_redefine - (* We don't save this variable *) - ~dump:false - ~short_desc:(fun () -> - Printf.sprintf - (f_ "Filename of executable '%s'") - cs.cs_name) - cs.cs_name - (lazy - (let fn_opt = - fold - BExec cs.cs_name - (fun _ fn -> Some fn) - None - in - match fn_opt with - | Some fn -> fn - | None -> - raise - (PropList.Not_set - (cs.cs_name, - Some (Printf.sprintf - (f_ "Executable '%s' not yet built.") - cs.cs_name)))))) + if var_choose bs.bs_build then + var_ignore + (var_redefine + (* We don't save this variable *) + ~dump:false + ~short_desc:(fun () -> + Printf.sprintf + (f_ "Filename of executable '%s'") + cs.cs_name) + cs.cs_name + (fun () -> + let fn_opt = + fold + BExec cs.cs_name + (fun _ fn -> Some fn) + None + in + match fn_opt with + | Some fn -> fn + | None -> + raise + (PropList.Not_set + (cs.cs_name, + Some (Printf.sprintf + (f_ "Executable '%s' not yet built.") + cs.cs_name))))) | Library _ | Flag _ | Test _ | SrcRepo _ | Doc _ -> ()) @@ -3497,20 +3643,24 @@ module BaseSetup = struct type t = { - configure: std_args_fun; - build: std_args_fun; - doc: ((doc, unit) section_args_fun) list; - test: ((test, float) section_args_fun) list; - install: std_args_fun; - uninstall: std_args_fun; - clean: std_args_fun list; - clean_doc: (doc, unit) section_args_fun list; - clean_test: (test, unit) section_args_fun list; - distclean: std_args_fun list; - distclean_doc: (doc, unit) section_args_fun list; - distclean_test: (test, unit) section_args_fun list; - package: package; - version: string; + configure: std_args_fun; + build: std_args_fun; + doc: ((doc, unit) section_args_fun) list; + test: ((test, float) section_args_fun) list; + install: std_args_fun; + uninstall: std_args_fun; + clean: std_args_fun list; + clean_doc: (doc, unit) section_args_fun list; + clean_test: (test, unit) section_args_fun list; + distclean: std_args_fun list; + distclean_doc: (doc, unit) section_args_fun list; + distclean_test: (test, unit) section_args_fun list; + package: package; + oasis_fn: string option; + oasis_version: string; + oasis_digest: Digest.t option; + oasis_exec: string option; + oasis_setup_args: string list; } (* Associate a plugin function with data from package *) @@ -3541,13 +3691,30 @@ module BaseSetup = struct (* Run configure *) BaseCustom.hook t.package.conf_custom - (t.configure t.package) - args; + (fun () -> + (* Reload if preconf has changed it *) + begin + try + unload (); + load (); + with _ -> + () + end; + + (* Run plugin's configure *) + t.configure t.package args; + + (* Dump to allow postconf to change it *) + dump ()) + (); (* Reload environment *) unload (); load (); + (* Save environment *) + print (); + (* Replace data in file *) BaseFileAB.replace t.package.files_ab @@ -3558,42 +3725,52 @@ module BaseSetup = struct args let doc t args = - BaseDoc.doc - (join_plugin_sections - (function - | Doc (cs, e) -> - Some - (lookup_plugin_section - "documentation" - (s_ "build") - cs.cs_name - t.doc, - cs, - e) - | _ -> - None) - t.package.sections) - t.package - args + if bool_of_string (BaseStandardVar.docs ()) then + BaseDoc.doc + (join_plugin_sections + (function + | Doc (cs, e) -> + Some + (lookup_plugin_section + "documentation" + (s_ "build") + cs.cs_name + t.doc, + cs, + e) + | _ -> + None) + t.package.sections) + t.package + args + else + BaseMessage.warning + "Docs are turned off, consider enabling with \ + 'ocaml setup.ml -configure --enable-docs'" let test t args = - BaseTest.test - (join_plugin_sections - (function - | Test (cs, e) -> - Some - (lookup_plugin_section - "test" - (s_ "run") - cs.cs_name - t.test, - cs, - e) - | _ -> - None) - t.package.sections) - t.package - args + if bool_of_string (BaseStandardVar.tests ()) then + BaseTest.test + (join_plugin_sections + (function + | Test (cs, e) -> + Some + (lookup_plugin_section + "test" + (s_ "run") + cs.cs_name + t.test, + cs, + e) + | _ -> + None) + t.package.sections) + t.package + args + else + BaseMessage.warning + "Tests are turned off, consider enabling with \ + 'ocaml setup.ml -configure --enable-tests'" let all t args = let rno_doc = @@ -3761,7 +3938,134 @@ module BaseSetup = struct clean, distclean let version t _ = - print_endline t.version + print_endline t.oasis_version + + let update_setup_ml, no_update_setup_ml_cli = + let b = ref true in + b, + ("-no-update-setup-ml", + Arg.Clear b, + s_ " Don't try to update setup.ml, even if _oasis has changed.") + + let update_setup_ml t = + let oasis_fn = + match t.oasis_fn with + | Some fn -> fn + | None -> "_oasis" + in + let oasis_exec = + match t.oasis_exec with + | Some fn -> fn + | None -> "oasis" + in + let ocaml = + Sys.executable_name + in + let setup_ml, args = + match Array.to_list Sys.argv with + | setup_ml :: args -> + setup_ml, args + | [] -> + failwith + (s_ "Expecting non-empty command line arguments.") + in + let ocaml, setup_ml = + if Sys.executable_name = Sys.argv.(0) then + (* We are not running in standard mode, probably the script + * is precompiled. + *) + "ocaml", "setup.ml" + else + ocaml, setup_ml + in + let no_update_setup_ml_cli, _, _ = no_update_setup_ml_cli in + let do_update () = + let oasis_exec_version = + BaseExec.run_read_one_line + ~f_exit_code: + (function + | 0 -> + () + | 1 -> + failwithf + (f_ "Executable '%s' is probably an old version \ + of oasis (< 0.3.0), please update to version \ + v%s.") + oasis_exec t.oasis_version + | 127 -> + failwithf + (f_ "Cannot find executable '%s', please install \ + oasis v%s.") + oasis_exec t.oasis_version + | n -> + failwithf + (f_ "Command '%s version' exited with code %d.") + oasis_exec n) + oasis_exec ["version"] + in + if OASISVersion.comparator_apply + (OASISVersion.version_of_string oasis_exec_version) + (OASISVersion.VGreaterEqual + (OASISVersion.version_of_string t.oasis_version)) then + begin + (* We have a version >= for the executable oasis, proceed with + * update. + *) + (* TODO: delegate this check to 'oasis setup'. *) + if Sys.os_type = "Win32" then + failwithf + (f_ "It is not possible to update the running script \ + setup.ml on Windows. Please update setup.ml by \ + running '%s'.") + (String.concat " " (oasis_exec :: "setup" :: t.oasis_setup_args)) + else + begin + BaseExec.run + ~f_exit_code: + (function + | 0 -> + () + | n -> + failwithf + (f_ "Unable to update setup.ml using '%s', \ + please fix the problem and retry.") + oasis_exec) + oasis_exec ("setup" :: t.oasis_setup_args); + BaseExec.run ocaml (setup_ml :: args) + end + end + else + failwithf + (f_ "The version of '%s' (v%s) doesn't match the version of \ + oasis used to generate the %s file. Please install at \ + least oasis v%s.") + oasis_exec oasis_exec_version setup_ml t.oasis_version + in + + if !update_setup_ml then + begin + try + match t.oasis_digest with + | Some dgst -> + if Sys.file_exists oasis_fn && dgst <> Digest.file "_oasis" then + begin + do_update (); + true + end + else + false + | None -> + false + with e -> + error + (f_ "Error when updating setup.ml. If you want to avoid this error, \ + you can bypass the update of %s by running '%s %s %s %s'") + setup_ml ocaml setup_ml no_update_setup_ml_cli + (String.concat " " args); + raise e + end + else + false let setup t = let catch_exn = @@ -3847,6 +4151,8 @@ module BaseSetup = struct "-no-catch-exn", Arg.Clear catch_exn, s_ " Don't catch exception, useful for debugging."; + + no_update_setup_ml_cli; ] @ (BaseContext.args ())) (failwithf (f_ "Don't know what to do with '%s'")) @@ -3867,13 +4173,14 @@ module BaseSetup = struct ~cli:CLIEnable ?short_desc (OASISUtils.varname_of_string cs.cs_name) - (lazy (string_of_bool - (var_choose - ~name:(Printf.sprintf - (f_ "default value of flag %s") - cs.cs_name) - ~printer:string_of_bool - choices)))) + (fun () -> + string_of_bool + (var_choose + ~name:(Printf.sprintf + (f_ "default value of flag %s") + cs.cs_name) + ~printer:string_of_bool + choices))) in match hlp with | Some hlp -> @@ -3889,71 +4196,15 @@ module BaseSetup = struct BaseDynVar.init t.package; - !act_ref t (Array.of_list (List.rev !extra_args_ref)) + if not (update_setup_ml t) then + !act_ref t (Array.of_list (List.rev !extra_args_ref)) with e when !catch_exn -> - error "%s" (string_of_exception e); + error "%s" (Printexc.to_string e); exit 1 end -module BaseDev = struct -# 21 "/media/data/ocaml/oasis/src/base/BaseDev.ml" - - - - open OASISGettext - open BaseMessage - - type t = - { - oasis_cmd: string; - } - - let update_and_run t = - (* Command line to run setup-dev *) - let oasis_args = - "setup-dev" :: "-run" :: - Sys.executable_name :: - (Array.to_list Sys.argv) - in - - let exit_on_child_error = - function - | 0 -> () - | 2 -> - (* Bad CLI arguments *) - error - (f_ "The command '%s %s' exit with code 2. It often means that we \ - don't use the right command-line arguments, rerun \ - 'oasis setup-dev'.") - t.oasis_cmd - (String.concat " " oasis_args) - - | 127 -> - (* Cannot find OASIS *) - error - (f_ "Cannot find executable '%s', check where 'oasis' is located \ - and rerun 'oasis setup-dev'") - t.oasis_cmd - - | i -> - exit i - in - - let () = - (* Run OASIS to generate a temporary setup.ml - *) - BaseExec.run - ~f_exit_code:exit_on_child_error - t.oasis_cmd - oasis_args - in - - () - -end - module InternalConfigurePlugin = struct # 21 "/media/data/ocaml/oasis/src/plugins/internal/InternalConfigurePlugin.ml" @@ -3997,7 +4248,7 @@ module InternalConfigurePlugin = struct in let warn_exception e = - warning "%s" (string_of_exception e) + warning "%s" (Printexc.to_string e) in (* Check tools *) @@ -4150,13 +4401,28 @@ module InternalConfigurePlugin = struct ()) pkg.sections; - (* Save and print environment *) - if SetString.empty = !errors then - begin - dump (); - print () - end - else + (* Check if we need native dynlink (presence of libraries that compile to + * native) + *) + begin + let has_cmxa = + List.exists + (function + | Library (_, bs, _) -> + var_choose bs.bs_build && + (bs.bs_compiled_object = Native || + (bs.bs_compiled_object = Best && + bool_of_string (BaseStandardVar.is_native ()))) + | _ -> ... [truncated message content] |