summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Glondu <steph@glondu.net>2015-05-04 08:42:31 -0300
committerStephane Glondu <steph@glondu.net>2015-05-04 08:42:31 -0300
commit181ca3491497dcc1798e199c2d36a7e00abbd0ea (patch)
tree2ad301f45f71d5bf3438386eb4fd0bcfdf5db066
parent0a68670790bed062c369a920f0f2a3087ed716ba (diff)
Imported Upstream version 1.3
-rw-r--r--META4
-rw-r--r--Makefile2
-rw-r--r--_oasis17
-rw-r--r--myocamlbuild.ml172
-rw-r--r--setup.ml1693
5 files changed, 855 insertions, 1033 deletions
diff --git a/META b/META
index a072deb..07349d2 100644
--- a/META
+++ b/META
@@ -1,6 +1,6 @@
# OASIS_START
-# DO NOT EDIT (digest: 5091eca77532839fb5e7c1d1aabd8775)
-version = "1.2"
+# DO NOT EDIT (digest: 74c7101d85ba97c754cd5b80df8b4dd1)
+version = "1.3"
description = "Benchmark running times of code."
requires = "unix"
archive(byte) = "benchmark.cma"
diff --git a/Makefile b/Makefile
index 1a4ba55..d040ace 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ all byte native setup.log: configure
configure: setup.data
setup.data: setup.ml
- ocaml $< -configure
+ ocaml $< -configure --enable-examples --enable-tests
setup.ml: _oasis
oasis setup
diff --git a/_oasis b/_oasis
index f59e396..c4f5fd4 100644
--- a/_oasis
+++ b/_oasis
@@ -1,7 +1,7 @@
# -*-conf-*-
OASISFormat: 0.3
Name: benchmark
-Version: 1.2
+Version: 1.3
Synopsis: Benchmark running times of code.
Authors: Christophe Troestler <Christophe.Troestler@umons.ac.be>
License: LGPL-3.0 with OCaml linking exception
@@ -11,6 +11,10 @@ Description: This module provides a set of tools to measure the running times
Plugins: META (0.2)
Homepage: http://ocaml-benchmark.forge.ocamlcore.org/
+Flag examples
+ Description: Whether to compile the examples.
+ Default: false
+
Library benchmark
Path: .
BuildTools: ocamlbuild
@@ -27,6 +31,7 @@ Document API
# Examples
Executable ar_ba
+ Build$: flag(examples)
Path: examples/
MainIs: ar_ba.ml
BuildTools: ocamlbuild
@@ -35,6 +40,7 @@ Executable ar_ba
Install: false
Executable composition
+ Build$: flag(examples)
Path: examples/
MainIs: composition.ml
BuildTools: ocamlbuild
@@ -43,6 +49,7 @@ Executable composition
Install: false
Executable iter
+ Build$: flag(examples)
Path: examples/
MainIs: iter.ml
BuildTools: ocamlbuild
@@ -51,6 +58,7 @@ Executable iter
Install: false
Executable let_try
+ Build$: flag(examples)
Path: examples/
MainIs: let_try.ml
BuildTools: ocamlbuild
@@ -59,6 +67,7 @@ Executable let_try
Install: false
Executable loops
+ Build$: flag(examples)
Path: examples/
MainIs: loops.ml
BuildTools: ocamlbuild
@@ -67,6 +76,7 @@ Executable loops
Install: false
Executable match_array
+ Build$: flag(examples)
Path: examples/
MainIs: match_array.ml
BuildTools: ocamlbuild
@@ -75,6 +85,7 @@ Executable match_array
Install: false
Executable numbers
+ Build$: flag(examples)
Path: examples/
MainIs: numbers.ml
BuildTools: ocamlbuild
@@ -83,6 +94,7 @@ Executable numbers
Install: false
Executable regexps
+ Build$: flag(examples)
Path: examples/
MainIs: regexps.ml
BuildTools: ocamlbuild
@@ -91,6 +103,7 @@ Executable regexps
Install: false
Executable try_if
+ Build$: flag(examples)
Path: examples/
MainIs: try_if.ml
BuildTools: ocamlbuild
@@ -99,6 +112,7 @@ Executable try_if
Install: false
Executable func_record
+ Build$: flag(examples)
Path: examples/
MainIs: func_record.ml
BuildTools: ocamlbuild
@@ -108,6 +122,7 @@ Executable func_record
# Tests
Executable long_run
+ Build$: flag(tests)
Path: tests
MainIs: long_run.ml
BuildTools: ocamlbuild
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 3c293a2..a646114 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -1,39 +1,39 @@
(* OASIS_START *)
-(* DO NOT EDIT (digest: 282550349f2b5c0ab26b3edf4513879a) *)
+(* DO NOT EDIT (digest: 5eab8ed07dfb4303dc64c4c33706fe5e) *)
module OASISGettext = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISGettext.ml"
-
+(* # 21 "src/oasis/OASISGettext.ml" *)
+
let ns_ str =
str
-
+
let s_ str =
str
-
+
let f_ (str : ('a, 'b, 'c, 'd) format4) =
str
-
+
let fn_ fmt1 fmt2 n =
if n = 1 then
fmt1^^""
else
fmt2^^""
-
+
let init =
[]
-
+
end
module OASISExpr = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISExpr.ml"
-
-
-
+(* # 21 "src/oasis/OASISExpr.ml" *)
+
+
+
open OASISGettext
-
+
type test = string
-
+
type flag = string
-
+
type t =
| EBool of bool
| ENot of t
@@ -42,31 +42,31 @@ module OASISExpr = struct
| EFlag of flag
| ETest of test * string
-
+
type 'a choices = (t * 'a) list
-
+
let eval var_get t =
let rec eval' =
function
| EBool b ->
b
-
+
| ENot e ->
not (eval' e)
-
+
| EAnd (e1, e2) ->
(eval' e1) && (eval' e2)
-
+
| EOr (e1, e2) ->
(eval' e1) || (eval' e2)
-
+
| EFlag nm ->
let v =
var_get nm
in
assert(v = "true" || v = "false");
(v = "true")
-
+
| ETest (nm, vl) ->
let v =
var_get nm
@@ -74,7 +74,7 @@ module OASISExpr = struct
(v = vl)
in
eval' t
-
+
let choose ?printer ?name var_get lst =
let rec choose_aux =
function
@@ -110,23 +110,23 @@ module OASISExpr = struct
str_lst)
in
choose_aux (List.rev lst)
-
+
end
# 117 "myocamlbuild.ml"
module BaseEnvLight = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseEnvLight.ml"
-
+(* # 21 "src/base/BaseEnvLight.ml" *)
+
module MapString = Map.Make(String)
-
+
type t = string MapString.t
-
+
let default_filename =
Filename.concat
(Sys.getcwd ())
"setup.data"
-
+
let load ?(allow_empty=false) ?(filename=default_filename) () =
if Sys.file_exists filename then
begin
@@ -183,7 +183,7 @@ module BaseEnvLight = struct
"Unable to load environment, the file '%s' doesn't exist."
filename)
end
-
+
let var_get name env =
let rec var_expand str =
let buff =
@@ -204,7 +204,7 @@ module BaseEnvLight = struct
Buffer.contents buff
in
var_expand (MapString.find name env)
-
+
let var_choose lst env =
OASISExpr.choose
(fun nm -> var_get nm env)
@@ -214,8 +214,8 @@ end
# 215 "myocamlbuild.ml"
module MyOCamlbuildFindlib = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml"
-
+(* # 21 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
+
(** OCamlbuild extension, copied from
* http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
* by N. Pouillard and others
@@ -225,48 +225,46 @@ module MyOCamlbuildFindlib = struct
* Modified by Sylvain Le Gall
*)
open Ocamlbuild_plugin
-
+
(* these functions are not really officially exported *)
let run_and_read =
Ocamlbuild_pack.My_unix.run_and_read
-
+
let blank_sep_strings =
Ocamlbuild_pack.Lexers.blank_sep_strings
-
+
let split s ch =
- let buf = Buffer.create 13 in
- let x = ref [] in
- let flush () =
- x := (Buffer.contents buf) :: !x;
- Buffer.clear buf
+ let x =
+ ref []
+ in
+ let rec go s =
+ let pos =
+ String.index s ch
+ in
+ x := (String.before s pos)::!x;
+ go (String.after s (pos + 1))
in
- String.iter
- (fun c ->
- if c = ch then
- flush ()
- else
- Buffer.add_char buf c)
- s;
- flush ();
- List.rev !x
-
+ try
+ go s
+ with Not_found -> !x
+
let split_nl s = split s '\n'
-
+
let before_space s =
try
String.before s (String.index s ' ')
with Not_found -> s
-
+
(* this lists all supported packages *)
let find_packages () =
List.map before_space (split_nl & run_and_read "ocamlfind list")
-
+
(* this is supposed to list available syntaxes, but I don't know how to do it. *)
let find_syntaxes () = ["camlp4o"; "camlp4r"]
-
+
(* ocamlfind command *)
let ocamlfind x = S[A"ocamlfind"; x]
-
+
let dispatch =
function
| Before_options ->
@@ -296,7 +294,7 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg];
end
(find_packages ());
-
+
(* Like -package but for extensions syntax. Morover -syntax is useless
* when linking. *)
List.iter begin fun syntax ->
@@ -305,7 +303,7 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
end (find_syntaxes ());
-
+
(* The default "thread" tag is not compatible with ocamlfind.
* Indeed, the default rules add the "threads.cma" or "threads.cmxa"
* options when using this tag. When using the "-linkpkg" option with
@@ -318,31 +316,31 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"])
-
+
| _ ->
()
-
+
end
module MyOCamlbuildBase = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
-
+(* # 21 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
+
(** Base functions for writing myocamlbuild.ml
@author Sylvain Le Gall
*)
-
-
-
+
+
+
open Ocamlbuild_plugin
module OC = Ocamlbuild_pack.Ocaml_compiler
-
+
type dir = string
type file = string
type name = string
type tag = string
-
-# 56 "/home/trch/software/OCaml/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
-
+
+(* # 56 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
+
type t =
{
lib_ocaml: (name * dir list) list;
@@ -353,23 +351,23 @@ module MyOCamlbuildBase = struct
*)
includes: (dir * dir list) list;
}
-
+
let env_filename =
Pathname.basename
BaseEnvLight.default_filename
-
+
let dispatch_combine lst =
fun e ->
List.iter
(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
@@ -396,7 +394,7 @@ module MyOCamlbuildBase = struct
Options.ext_lib, "ext_lib";
Options.ext_dll, "ext_dll";
]
-
+
| After_rules ->
(* Declare OCaml libraries *)
List.iter
@@ -413,13 +411,13 @@ module MyOCamlbuildBase = struct
["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) ->
@@ -427,33 +425,33 @@ module MyOCamlbuildBase = struct
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"; tag_libstubs lib]
(S[A"-cclib"; A("-l"^(nm_libstubs 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"; "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 *)
dep ["compile"; "c"]
headers;
-
+
(* Setup search path for lib *)
flag ["link"; "ocaml"; "use_"^lib]
(S[A"-I"; P(dir)]);
)
t.lib_c;
-
+
(* Add flags *)
List.iter
(fun (tags, cond_specs) ->
@@ -464,18 +462,18 @@ module MyOCamlbuildBase = struct
t.flags
| _ ->
()
-
+
let dispatch_default t =
dispatch_combine
[
dispatch t;
MyOCamlbuildFindlib.dispatch;
]
-
+
end
-# 478 "myocamlbuild.ml"
+# 476 "myocamlbuild.ml"
open Ocamlbuild_plugin;;
let package_default =
{
@@ -488,6 +486,6 @@ let package_default =
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
-# 492 "myocamlbuild.ml"
+# 490 "myocamlbuild.ml"
(* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;;
diff --git a/setup.ml b/setup.ml
index 9f1a7e1..e18726f 100644
--- a/setup.ml
+++ b/setup.ml
@@ -1,46 +1,48 @@
-(* setup.ml generated for the first time by OASIS v0.3.1 *)
+let () =
+ try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
+ with Not_found -> ();;
(* OASIS_START *)
-(* DO NOT EDIT (digest: 5c20147364c940360580987b43a4fd25) *)
+(* DO NOT EDIT (digest: 1cc62ef077a105a2b3cdd44d970685cc) *)
(*
- Regenerated by OASIS v0.3.1
+ Regenerated by OASIS v0.3.0
Visit http://oasis.forge.ocamlcore.org for more information and
documentation about functions used in this file.
*)
module OASISGettext = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISGettext.ml"
-
+(* # 21 "src/oasis/OASISGettext.ml" *)
+
let ns_ str =
str
-
+
let s_ str =
str
-
+
let f_ (str : ('a, 'b, 'c, 'd) format4) =
str
-
+
let fn_ fmt1 fmt2 n =
if n = 1 then
fmt1^^""
else
fmt2^^""
-
+
let init =
[]
-
+
end
module OASISContext = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISContext.ml"
-
+(* # 21 "src/oasis/OASISContext.ml" *)
+
open OASISGettext
-
+
type level =
[ `Debug
| `Info
| `Warning
| `Error]
-
+
type t =
{
quiet: bool;
@@ -50,7 +52,7 @@ module OASISContext = struct
ignore_unknown_fields: bool;
printf: level -> string -> unit;
}
-
+
let printf lvl str =
let beg =
match lvl with
@@ -60,7 +62,7 @@ module OASISContext = struct
| `Debug -> s_ "D: "
in
prerr_endline (beg^str)
-
+
let default =
ref
{
@@ -71,38 +73,38 @@ module OASISContext = struct
ignore_unknown_fields = false;
printf = printf;
}
-
+
let quiet =
{!default with quiet = true}
-
-
+
+
let args () =
["-quiet",
Arg.Unit (fun () -> default := {!default with quiet = true}),
(s_ " Run quietly");
-
+
"-info",
Arg.Unit (fun () -> default := {!default with info = true}),
(s_ " Display information message");
-
-
+
+
"-debug",
Arg.Unit (fun () -> default := {!default with debug = true}),
(s_ " Output debug message")]
end
module OASISString = struct
-# 1 "/home/trch/software/OCaml/oasis/src/oasis/OASISString.ml"
-
-
-
+(* # 1 "src/oasis/OASISString.ml" *)
+
+
+
(** Various string utilities.
Mostly inspired by extlib and batteries ExtString and BatString libraries.
-
+
@author Sylvain Le Gall
*)
-
+
let nsplitf str f =
if str = "" then
[]
@@ -122,13 +124,13 @@ module OASISString = struct
done;
push ();
List.rev !lst
-
+
(** [nsplit c s] Split the string [s] at char [c]. It doesn't include the
separator.
*)
let nsplit str c =
nsplitf str ((=) c)
-
+
let find ~what ?(offset=0) str =
let what_idx = ref 0 in
let str_idx = ref offset in
@@ -144,21 +146,21 @@ module OASISString = struct
raise Not_found
else
!str_idx - !what_idx
-
+
let sub_start str len =
let str_len = String.length str in
if len >= str_len then
""
else
String.sub str len (str_len - len)
-
+
let sub_end ?(offset=0) str len =
let str_len = String.length str in
if len >= str_len then
""
else
String.sub str 0 (str_len - len)
-
+
let starts_with ~what ?(offset=0) str =
let what_idx = ref 0 in
let str_idx = ref offset in
@@ -176,13 +178,13 @@ module OASISString = struct
true
else
false
-
+
let strip_starts_with ~what str =
if starts_with ~what str then
sub_start str (String.length what)
else
raise Not_found
-
+
let ends_with ~what ?(offset=0) str =
let what_idx = ref ((String.length what) - 1) in
let str_idx = ref ((String.length str) - 1) in
@@ -200,63 +202,63 @@ module OASISString = struct
true
else
false
-
+
let strip_ends_with ~what str =
if ends_with ~what str then
sub_end str (String.length what)
else
raise Not_found
-
+
let replace_chars f s =
let buf = String.make (String.length s) 'X' in
for i = 0 to String.length s - 1 do
buf.[i] <- f s.[i]
done;
buf
-
+
end
module OASISUtils = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISUtils.ml"
-
+(* # 21 "src/oasis/OASISUtils.ml" *)
+
open OASISGettext
-
+
module MapString = Map.Make(String)
-
+
let map_string_of_assoc assoc =
List.fold_left
(fun acc (k, v) -> MapString.add k v acc)
MapString.empty
assoc
-
+
module SetString = Set.Make(String)
-
+
let set_string_add_list st lst =
List.fold_left
(fun acc e -> SetString.add e acc)
st
lst
-
+
let set_string_of_list =
set_string_add_list
SetString.empty
-
-
+
+
let compare_csl s1 s2 =
String.compare (String.lowercase s1) (String.lowercase s2)
-
+
module HashStringCsl =
Hashtbl.Make
(struct
type t = string
-
+
let equal s1 s2 =
(String.lowercase s1) = (String.lowercase s2)
-
+
let hash s =
Hashtbl.hash (String.lowercase s)
end)
-
+
let varname_of_string ?(hyphen='_') s =
if String.length s = 0 then
begin
@@ -286,7 +288,7 @@ module OASISUtils = struct
in
String.lowercase buf
end
-
+
let varname_concat ?(hyphen='_') p s =
let what = String.make 1 hyphen in
let p =
@@ -302,26 +304,26 @@ module OASISUtils = struct
s
in
p^what^s
-
-
+
+
let is_varname str =
str = varname_of_string str
-
+
let failwithf fmt = Printf.ksprintf failwith fmt
-
+
end
module PropList = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/PropList.ml"
-
+(* # 21 "src/oasis/PropList.ml" *)
+
open OASISGettext
-
+
type name = string
-
+
exception Not_set of name * string option
exception No_printer of name
exception Unknown_field of name * name
-
+
let () =
Printexc.register_printer
(function
@@ -339,25 +341,25 @@ module PropList = struct
(Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm)
| _ ->
None)
-
+
module Data =
struct
-
+
type t =
(name, unit -> unit) Hashtbl.t
-
+
let create () =
Hashtbl.create 13
-
+
let clear t =
Hashtbl.clear t
-
-# 71 "/home/trch/software/OCaml/oasis/src/oasis/PropList.ml"
+
+(* # 71 "src/oasis/PropList.ml" *)
end
-
+
module Schema =
struct
-
+
type ('ctxt, 'extra) value =
{
get: Data.t -> string;
@@ -365,7 +367,7 @@ module PropList = struct
help: (unit -> string) option;
extra: 'extra;
}
-
+
type ('ctxt, 'extra) t =
{
name: name;
@@ -373,7 +375,7 @@ module PropList = struct
order: name Queue.t;
name_norm: string -> string;
}
-
+
let create ?(case_insensitive=false) nm =
{
name = nm;
@@ -385,12 +387,12 @@ module PropList = struct
else
fun s -> s);
}
-
+
let add t nm set get extra help =
let key =
t.name_norm nm
in
-
+
if Hashtbl.mem t.fields key then
failwith
(Printf.sprintf
@@ -406,25 +408,25 @@ module PropList = struct
extra = extra;
};
Queue.add nm t.order
-
+
let mem t nm =
Hashtbl.mem t.fields nm
-
+
let find t nm =
try
Hashtbl.find t.fields (t.name_norm nm)
with Not_found ->
raise (Unknown_field (nm, t.name))
-
+
let get t data nm =
(find t nm).get data
-
+
let set t data nm ?context x =
(find t nm).set
data
?context
x
-
+
let fold f acc t =
Queue.fold
(fun acc k ->
@@ -434,20 +436,20 @@ module PropList = struct
f acc k v.extra v.help)
acc
t.order
-
+
let iter f t =
fold
(fun () -> f)
()
t
-
+
let name t =
t.name
end
-
+
module Field =
struct
-
+
type ('ctxt, 'value, 'extra) t =
{
set: Data.t -> ?context:'ctxt -> 'value -> unit;
@@ -457,33 +459,33 @@ module PropList = struct
help: (unit -> string) option;
extra: 'extra;
}
-
+
let new_id =
let last_id =
ref 0
in
fun () -> incr last_id; !last_id
-
+
let create ?schema ?name ?parse ?print ?default ?update ?help extra =
(* Default value container *)
let v =
ref None
in
-
+
(* If name is not given, create unique one *)
let nm =
match name with
| Some s -> s
| None -> Printf.sprintf "_anon_%d" (new_id ())
in
-
+
(* Last chance to get a value: the default *)
let default () =
match default with
| Some d -> d
| None -> raise (Not_set (nm, Some (s_ "no default value")))
in
-
+
(* Get data *)
let get data =
(* Get value *)
@@ -495,7 +497,7 @@ module PropList = struct
with Not_found ->
default ()
in
-
+
(* Set data *)
let set data ?context x =
let x =
@@ -515,7 +517,7 @@ module PropList = struct
nm
(fun () -> v := Some x)
in
-
+
(* Parse string value, if possible *)
let parse =
match parse with
@@ -529,12 +531,12 @@ module PropList = struct
nm
s)
in
-
+
(* Set data, from string *)
let sets data ?context s =
set ?context data (parse ?context s)
in
-
+
(* Output value as string, if possible *)
let print =
match print with
@@ -543,12 +545,12 @@ module PropList = struct
| None ->
fun _ -> raise (No_printer nm)
in
-
+
(* Get data, as a string *)
let gets data =
print (get data)
in
-
+
begin
match schema with
| Some t ->
@@ -556,7 +558,7 @@ module PropList = struct
| None ->
()
end;
-
+
{
set = set;
get = get;
@@ -565,40 +567,40 @@ module PropList = struct
help = help;
extra = extra;
}
-
+
let fset data t ?context x =
t.set data ?context x
-
+
let fget data t =
t.get data
-
+
let fsets data t ?context s =
t.sets data ?context s
-
+
let fgets data t =
t.gets data
-
+
end
-
+
module FieldRO =
struct
-
+
let create ?schema ?name ?parse ?print ?default ?update ?help extra =
let fld =
Field.create ?schema ?name ?parse ?print ?default ?update ?help extra
in
fun data -> Field.fget data fld
-
+
end
end
module OASISMessage = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISMessage.ml"
-
-
+(* # 21 "src/oasis/OASISMessage.ml" *)
+
+
open OASISGettext
open OASISContext
-
+
let generic_message ~ctxt lvl fmt =
let cond =
if ctxt.quiet then
@@ -616,32 +618,32 @@ module OASISMessage = struct
ctxt.printf lvl str
end)
fmt
-
+
let debug ~ctxt fmt =
generic_message ~ctxt `Debug fmt
-
+
let info ~ctxt fmt =
generic_message ~ctxt `Info fmt
-
+
let warning ~ctxt fmt =
generic_message ~ctxt `Warning fmt
-
+
let error ~ctxt fmt =
generic_message ~ctxt `Error fmt
-
+
end
module OASISVersion = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISVersion.ml"
-
+(* # 21 "src/oasis/OASISVersion.ml" *)
+
open OASISGettext
-
-
-
+
+
+
type s = string
-
+
type t = string
-
+
type comparator =
| VGreater of t
| VGreaterEqual of t
@@ -651,19 +653,19 @@ module OASISVersion = struct
| VOr of comparator * comparator
| VAnd of comparator * comparator
-
+
(* Range of allowed characters *)
let is_digit c =
'0' <= c && c <= '9'
-
+
let is_alpha c =
('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
-
+
let is_special =
function
| '.' | '+' | '-' | '~' -> true
| _ -> false
-
+
let rec version_compare v1 v2 =
if v1 <> "" || v2 <> "" then
begin
@@ -677,12 +679,12 @@ module OASISVersion = struct
else if is_alpha c then Char.code c
else (Char.code c) + 256
in
-
+
let len1 = String.length v1 in
let len2 = String.length v2 in
-
+
let p = ref 0 in
-
+
(** Compare ascii part *)
let compare_vascii () =
let cmp = ref 0 in
@@ -699,7 +701,7 @@ module OASISVersion = struct
else
!cmp
in
-
+
(** Compare digit part *)
let compare_digit () =
let extract_int v p =
@@ -721,7 +723,7 @@ module OASISVersion = struct
let i2, tl2 = extract_int v2 (ref !p) in
i1 - i2, tl1, tl2
in
-
+
match compare_vascii () with
| 0 ->
begin
@@ -743,12 +745,12 @@ module OASISVersion = struct
begin
0
end
-
-
+
+
let version_of_string str = str
-
+
let string_of_version t = t
-
+
let chop t =
try
let pos =
@@ -757,7 +759,7 @@ module OASISVersion = struct
String.sub t 0 pos
with Not_found ->
t
-
+
let rec comparator_apply v op =
match op with
| VGreater cv ->
@@ -774,7 +776,7 @@ module OASISVersion = struct
(comparator_apply v op1) || (comparator_apply v op2)
| VAnd (op1, op2) ->
(comparator_apply v op1) && (comparator_apply v op2)
-
+
let rec string_of_comparator =
function
| VGreater v -> "> "^(string_of_version v)
@@ -786,7 +788,7 @@ module OASISVersion = struct
(string_of_comparator c1)^" || "^(string_of_comparator c2)
| VAnd (c1, c2) ->
(string_of_comparator c1)^" && "^(string_of_comparator c2)
-
+
let rec varname_of_comparator =
let concat p v =
OASISUtils.varname_concat
@@ -804,31 +806,31 @@ module OASISVersion = struct
(varname_of_comparator c1)^"_or_"^(varname_of_comparator c2)
| VAnd (c1, c2) ->
(varname_of_comparator c1)^"_and_"^(varname_of_comparator c2)
-
+
let version_0_3_or_after t =
comparator_apply t (VGreaterEqual (string_of_version "0.3"))
-
+
end
module OASISLicense = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISLicense.ml"
-
+(* # 21 "src/oasis/OASISLicense.ml" *)
+
(** License for _oasis fields
@author Sylvain Le Gall
*)
-
-
-
+
+
+
type license = string
-
+
type license_exception = string
-
+
type license_version =
| Version of OASISVersion.t
| VersionOrLater of OASISVersion.t
| NoVersion
-
+
type license_dep_5_unit =
{
license: license;
@@ -836,31 +838,31 @@ module OASISLicense = struct
version: license_version;
}
-
+
type license_dep_5 =
| DEP5Unit of license_dep_5_unit
| DEP5Or of license_dep_5 list
| DEP5And of license_dep_5 list
-
+
type t =
| DEP5License of license_dep_5
| OtherLicense of string (* URL *)
-
+
end
module OASISExpr = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISExpr.ml"
-
-
-
+(* # 21 "src/oasis/OASISExpr.ml" *)
+
+
+
open OASISGettext
-
+
type test = string
-
+
type flag = string
-
+
type t =
| EBool of bool
| ENot of t
@@ -869,31 +871,31 @@ module OASISExpr = struct
| EFlag of flag
| ETest of test * string
-
+
type 'a choices = (t * 'a) list
-
+
let eval var_get t =
let rec eval' =
function
| EBool b ->
b
-
+
| ENot e ->
not (eval' e)
-
+
| EAnd (e1, e2) ->
(eval' e1) && (eval' e2)
-
+
| EOr (e1, e2) ->
(eval' e1) || (eval' e2)
-
+
| EFlag nm ->
let v =
var_get nm
in
assert(v = "true" || v = "false");
(v = "true")
-
+
| ETest (nm, vl) ->
let v =
var_get nm
@@ -901,7 +903,7 @@ module OASISExpr = struct
(v = vl)
in
eval' t
-
+
let choose ?printer ?name var_get lst =
let rec choose_aux =
function
@@ -937,15 +939,15 @@ module OASISExpr = struct
str_lst)
in
choose_aux (List.rev lst)
-
+
end
module OASISTypes = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISTypes.ml"
-
-
-
-
+(* # 21 "src/oasis/OASISTypes.ml" *)
+
+
+
+
type name = string
type package_name = string
type url = string
@@ -957,26 +959,26 @@ module OASISTypes = struct
type arg = string
type args = string list
type command_line = (prog * arg list)
-
+
type findlib_name = string
type findlib_full = string
-
+
type compiled_object =
| Byte
| Native
| Best
-
+
type dependency =
| FindlibPackage of findlib_full * OASISVersion.comparator option
| InternalLibrary of name
-
+
type tool =
| ExternalTool of name
| InternalExecutable of name
-
+
type vcs =
| Darcs
| Git
@@ -988,7 +990,7 @@ module OASISTypes = struct
| Monotone
| OtherVCS of url
-
+
type plugin_kind =
[ `Configure
| `Build
@@ -997,7 +999,7 @@ module OASISTypes = struct
| `Install
| `Extra
]
-
+
type plugin_data_purpose =
[ `Configure
| `Build
@@ -1011,24 +1013,24 @@ module OASISTypes = struct
| `Extra
| `Other of string
]
-
+
type 'a plugin = 'a * name * OASISVersion.t option
-
+
type all_plugin = plugin_kind plugin
-
+
type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list
-
-# 102 "/home/trch/software/OCaml/oasis/src/oasis/OASISTypes.ml"
-
+
+(* # 102 "src/oasis/OASISTypes.ml" *)
+
type 'a conditional = 'a OASISExpr.choices
-
+
type custom =
{
pre_command: (command_line option) conditional;
post_command: (command_line option) conditional;
}
-
+
type common_section =
{
cs_name: name;
@@ -1036,7 +1038,7 @@ module OASISTypes = struct
cs_plugin_data: plugin_data;
}
-
+
type build_section =
{
bs_build: bool conditional;
@@ -1055,7 +1057,7 @@ module OASISTypes = struct
bs_nativeopt: args conditional;
}
-
+
type library =
{
lib_modules: string list;
@@ -1065,26 +1067,19 @@ module OASISTypes = struct
lib_findlib_name: findlib_name option;
lib_findlib_containers: findlib_name list;
}
-
-
- type object_ =
- {
- obj_modules: string list;
- obj_findlib_fullname: findlib_name list option;
- }
-
+
type executable =
{
exec_custom: bool;
exec_main_is: unix_filename;
}
-
+
type flag =
{
flag_description: string option;
flag_default: bool conditional;
}
-
+
type source_repository =
{
src_repo_type: vcs;
@@ -1095,7 +1090,7 @@ module OASISTypes = struct
src_repo_tag: string option;
src_repo_subdir: unix_filename option;
}
-
+
type test =
{
test_type: [`Test] plugin;
@@ -1105,7 +1100,7 @@ module OASISTypes = struct
test_run: bool conditional;
test_tools: tool list;
}
-
+
type doc_format =
| HTML of unix_filename
| DocText
@@ -1115,7 +1110,7 @@ module OASISTypes = struct
| DVI
| OtherDoc
-
+
type doc =
{
doc_type: [`Doc] plugin;
@@ -1130,20 +1125,19 @@ module OASISTypes = struct
doc_data_files: (unix_filename * unix_filename option) list;
doc_build_tools: tool list;
}
-
+
type section =
| Library of common_section * build_section * library
- | Object of common_section * build_section * object_
| Executable of common_section * build_section * executable
| Flag of common_section * flag
| SrcRepo of common_section * source_repository
| Test of common_section * test
| Doc of common_section * doc
-
+
type section_kind =
- [ `Library | `Object | `Executable | `Flag | `SrcRepo | `Test | `Doc ]
-
+ [ `Library | `Executable | `Flag | `SrcRepo | `Test | `Doc ]
+
type package =
{
oasis_version: OASISVersion.t;
@@ -1160,45 +1154,45 @@ module OASISTypes = struct
synopsis: string;
description: string option;
categories: url list;
-
+
conf_type: [`Configure] plugin;
conf_custom: custom;
-
+
build_type: [`Build] plugin;
build_custom: custom;
-
+
install_type: [`Install] plugin;
install_custom: custom;
uninstall_custom: custom;
-
+
clean_custom: custom;
distclean_custom: custom;
-
+
files_ab: unix_filename list;
sections: section list;
plugins: [`Extra] plugin list;
schema_data: PropList.Data.t;
plugin_data: plugin_data;
}
-
+
end
module OASISUnixPath = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISUnixPath.ml"
-
+(* # 21 "src/oasis/OASISUnixPath.ml" *)
+
type unix_filename = string
type unix_dirname = string
-
+
type host_filename = string
type host_dirname = string
-
+
let current_dir_name = "."
-
+
let parent_dir_name = ".."
-
+
let is_current_dir fn =
fn = current_dir_name || fn = ""
-
+
let concat f1 f2 =
if is_current_dir f1 then
f2
@@ -1207,7 +1201,7 @@ module OASISUnixPath = struct
try OASISString.strip_ends_with ~what:"/" f1 with Not_found -> f1
in
f1'^"/"^f2
-
+
let make =
function
| hd :: tl ->
@@ -1217,13 +1211,13 @@ module OASISUnixPath = struct
tl
| [] ->
invalid_arg "OASISUnixPath.make"
-
+
let dirname f =
try
String.sub f 0 (String.rindex f '/')
with Not_found ->
current_dir_name
-
+
let basename f =
try
let pos_start =
@@ -1232,7 +1226,7 @@ module OASISUnixPath = struct
String.sub f pos_start ((String.length f) - pos_start)
with Not_found ->
f
-
+
let chop_extension f =
try
let last_dot =
@@ -1251,37 +1245,37 @@ module OASISUnixPath = struct
f
with Not_found ->
sub
-
+
with Not_found ->
f
-
+
let capitalize_file f =
let dir = dirname f in
let base = basename f in
concat dir (String.capitalize base)
-
+
let uncapitalize_file f =
let dir = dirname f in
let base = basename f in
concat dir (String.uncapitalize base)
-
+
end
module OASISHostPath = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISHostPath.ml"
-
-
+(* # 21 "src/oasis/OASISHostPath.ml" *)
+
+
open Filename
-
+
module Unix = OASISUnixPath
-
+
let make =
function
| [] ->
invalid_arg "OASISHostPath.make"
| hd :: tl ->
List.fold_left Filename.concat hd tl
-
+
let of_unix ufn =
if Sys.os_type = "Unix" then
ufn
@@ -1296,21 +1290,19 @@ module OASISHostPath = struct
else
p)
(OASISString.nsplit ufn '/'))
-
-
+
+
end
module OASISSection = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISSection.ml"
-
+(* # 21 "src/oasis/OASISSection.ml" *)
+
open OASISTypes
-
+
let section_kind_common =
function
| Library (cs, _, _) ->
`Library, cs
- | Object (cs, _, _) ->
- `Object, cs
| Executable (cs, _, _) ->
`Executable, cs
| Flag (cs, _) ->
@@ -1321,20 +1313,19 @@ module OASISSection = struct
`Test, cs
| Doc (cs, _) ->
`Doc, cs
-
+
let section_common sct =
snd (section_kind_common sct)
-
+
let section_common_set cs =
function
| Library (_, bs, lib) -> Library (cs, bs, lib)
- | Object (_, bs, obj) -> Object (cs, bs, obj)
| Executable (_, bs, exec) -> Executable (cs, bs, exec)
| Flag (_, flg) -> Flag (cs, flg)
| SrcRepo (_, src_repo) -> SrcRepo (cs, src_repo)
| Test (_, tst) -> Test (cs, tst)
| Doc (_, doc) -> Doc (cs, doc)
-
+
(** Key used to identify section
*)
let section_id sct =
@@ -1342,57 +1333,56 @@ module OASISSection = struct
section_kind_common sct
in
k, cs.cs_name
-
+
let string_of_section sct =
let k, nm =
section_id sct
in
(match k with
| `Library -> "library"
- | `Object -> "object"
| `Executable -> "executable"
| `Flag -> "flag"
| `SrcRepo -> "src repository"
| `Test -> "test"
| `Doc -> "doc")
^" "^nm
-
+
let section_find id scts =
List.find
(fun sct -> id = section_id sct)
scts
-
+
module CSection =
struct
type t = section
-
+
let id = section_id
-
+
let compare t1 t2 =
compare (id t1) (id t2)
let equal t1 t2 =
(id t1) = (id t2)
-
+
let hash t =
Hashtbl.hash (id t)
end
-
+
module MapSection = Map.Make(CSection)
module SetSection = Set.Make(CSection)
-
+
end
module OASISBuildSection = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISBuildSection.ml"
-
+(* # 21 "src/oasis/OASISBuildSection.ml" *)
+
end
module OASISExecutable = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISExecutable.ml"
-
+(* # 21 "src/oasis/OASISExecutable.ml" *)
+
open OASISTypes
-
+
let unix_exec_is (cs, bs, exec) is_native ext_dll suffix_program =
let dir =
OASISUnixPath.concat
@@ -1405,30 +1395,45 @@ module OASISExecutable = struct
| Best -> is_native ()
| Byte -> false
in
-
+
OASISUnixPath.concat
dir
(cs.cs_name^(suffix_program ())),
-
+
if not is_native_exec &&
not exec.exec_custom &&
bs.bs_c_sources <> [] then
Some (dir^"/dll"^cs.cs_name^"_stubs"^(ext_dll ()))
else
None
-
+
end
module OASISLibrary = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISLibrary.ml"
-
+(* # 21 "src/oasis/OASISLibrary.ml" *)
+
open OASISTypes
open OASISUtils
open OASISGettext
open OASISSection
-
+
+ type library_name = name
+ type findlib_part_name = name
+ type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t
+
+ exception InternalLibraryNotFound of library_name
+ exception FindlibPackageNotFound of findlib_name
+
+ type group_t =
+ | Container of findlib_name * group_t list
+ | Package of (findlib_name *
+ common_section *
+ build_section *
+ library *
+ group_t list)
+
(* Look for a module file, considering capitalization or not. *)
- let find_module source_file_exists bs modul =
+ let find_module source_file_exists (cs, bs, lib) modul =
let possible_base_fn =
List.map
(OASISUnixPath.concat bs.bs_path)
@@ -1465,11 +1470,11 @@ module OASISLibrary = struct
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 bs modul with
+ match find_module source_file_exists (cs, bs, lib) modul with
| `Sources (base_fn, lst) ->
(base_fn, lst) :: acc
| `No_sources _ ->
@@ -1481,7 +1486,7 @@ module OASISLibrary = struct
acc)
[]
(lib.lib_modules @ lib.lib_internal_modules)
-
+
let generated_unix_files
~ctxt
~is_native
@@ -1490,10 +1495,10 @@ module OASISLibrary = struct
~ext_dll
~source_file_exists
(cs, bs, lib) =
-
+
let find_modules lst ext =
let find_module modul =
- match find_module source_file_exists bs modul with
+ match find_module source_file_exists (cs, bs, lib) modul with
| `Sources (base_fn, _) ->
[base_fn]
| `No_sources lst ->
@@ -1511,7 +1516,7 @@ module OASISLibrary = struct
(find_module nm))
lst
in
-
+
(* The headers that should be compiled along *)
let headers =
if lib.lib_pack then
@@ -1521,7 +1526,7 @@ module OASISLibrary = struct
lib.lib_modules
"cmi"
in
-
+
(* The .cmx that be compiled along *)
let cmxs =
let should_be_built =
@@ -1538,11 +1543,11 @@ module OASISLibrary = struct
else
[]
in
-
+
let acc_nopath =
[]
in
-
+
(* Compute what libraries should be built *)
let acc_nopath =
(* Add the packed header file if required *)
@@ -1572,7 +1577,7 @@ module OASISLibrary = struct
| Byte | Best ->
byte acc_nopath
in
-
+
(* Add C library to be built *)
let acc_nopath =
if bs.bs_c_sources <> [] then
@@ -1586,7 +1591,7 @@ module OASISLibrary = struct
else
acc_nopath
in
-
+
(* All the files generated *)
List.rev_append
(List.rev_map
@@ -1594,105 +1599,12 @@ module OASISLibrary = struct
(OASISUnixPath.concat bs.bs_path))
acc_nopath)
(headers @ cmxs)
-
-end
-module OASISObject = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISObject.ml"
-
- open OASISTypes
- open OASISGettext
-
- let source_unix_files ~ctxt (cs, bs, obj) source_file_exists =
- List.fold_left
- (fun acc modul ->
- match OASISLibrary.find_module source_file_exists bs modul with
- | `Sources (base_fn, lst) ->
- (base_fn, lst) :: acc
- | `No_sources _ ->
- OASISMessage.warning
- ~ctxt
- (f_ "Cannot find source file matching \
- module '%s' in object %s")
- modul cs.cs_name;
- acc)
- []
- obj.obj_modules
-
-
- let generated_unix_files
- ~ctxt
- ~is_native
- ~source_file_exists
- (cs, bs, obj) =
-
- let find_module ext modul =
- match OASISLibrary.find_module source_file_exists bs modul with
- | `Sources (base_fn, _) -> [base_fn ^ ext]
- | `No_sources lst ->
- OASISMessage.warning
- ~ctxt
- (f_ "Cannot find source file matching \
- module '%s' in object %s")
- modul cs.cs_name ;
- lst
- in
-
- let header, byte, native, c_object, f =
- match obj.obj_modules with
- | [ m ] -> (find_module ".cmi" m,
- find_module ".cmo" m,
- find_module ".cmx" m,
- find_module ".o" m,
- fun x -> x)
- | _ -> ([cs.cs_name ^ ".cmi"],
- [cs.cs_name ^ ".cmo"],
- [cs.cs_name ^ ".cmx"],
- [cs.cs_name ^ ".o"],
- OASISUnixPath.concat bs.bs_path)
- in
- List.map (List.map f) (
- match bs.bs_compiled_object with
- | Native ->
- native :: c_object :: byte :: header :: []
- | Best when is_native ->
- native :: c_object :: byte :: header :: []
- | Byte | Best ->
- byte :: header :: [])
-
-end
-
-module OASISFindlib = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISFindlib.ml"
-
-
- open OASISTypes
- open OASISUtils
- open OASISGettext
- open OASISSection
-
- type library_name = name
- type findlib_part_name = name
- type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t
-
- exception InternalLibraryNotFound of library_name
- exception FindlibPackageNotFound of findlib_name
-
- type group_t =
- | Container of findlib_name * group_t list
- | Package of (findlib_name *
- common_section *
- build_section *
- [`Library of library | `Object of object_] *
- group_t list)
-
- type data = common_section *
- build_section *
- [`Library of library | `Object of object_]
+ type data = common_section * build_section * library
type tree =
| Node of (data option) * (tree MapString.t)
| Leaf of data
-
+
let findlib_mapping pkg =
(* Map from library name to either full findlib name or parts + parent. *)
let fndlb_parts_of_lib_name =
@@ -1730,30 +1642,13 @@ module OASISFindlib = struct
(`Solved fndlb_parts)
mp
end
-
- | Object (cs, _, obj) ->
- begin
- let obj_name = cs.cs_name in
- if MapString.mem obj_name mp then
- failwithf
- (f_ "The object name '%s' is used more than once.")
- obj_name;
- let findlib_full_name = match obj.obj_findlib_fullname with
- | Some ns -> String.concat "." ns
- | None -> obj_name
- in
- MapString.add
- obj_name
- (`Solved findlib_full_name)
- mp
- end
-
+
| Executable _ | Test _ | Flag _ | SrcRepo _ | Doc _ ->
mp)
MapString.empty
pkg.sections
in
-
+
(* Solve the above graph to be only library name to full findlib name. *)
let fndlb_name_of_lib_name =
let rec solve visited mp lib_name lib_name_child =
@@ -1798,7 +1693,7 @@ module OASISFindlib = struct
| `Unsolved _ -> assert false)
mp
in
-
+
(* Convert an internal library name to a findlib name. *)
let findlib_name_of_library_name lib_nm =
try
@@ -1806,7 +1701,7 @@ module OASISFindlib = struct
with Not_found ->
raise (InternalLibraryNotFound lib_nm)
in
-
+
(* Add a library to the tree.
*)
let add sct mp =
@@ -1863,7 +1758,7 @@ module OASISFindlib = struct
in
add_children (OASISString.nsplit fndlb_fullname '.') mp
in
-
+
let rec group_of_tree mp =
MapString.fold
(fun nm node acc ->
@@ -1879,25 +1774,23 @@ module OASISFindlib = struct
cur :: acc)
mp []
in
-
+
let group_mp =
List.fold_left
(fun mp ->
function
| Library (cs, bs, lib) ->
- add (cs, bs, `Library lib) mp
- | Object (cs, bs, obj) ->
- add (cs, bs, `Object obj) mp
+ add (cs, bs, lib) mp
| _ ->
mp)
MapString.empty
pkg.sections
in
-
+
let groups =
group_of_tree group_mp
in
-
+
let library_name_of_findlib_name =
Lazy.lazy_from_fun
(fun () ->
@@ -1913,16 +1806,16 @@ module OASISFindlib = struct
with Not_found ->
raise (FindlibPackageNotFound fndlb_nm)
in
-
+
groups,
findlib_name_of_library_name,
library_name_of_findlib_name
-
+
let findlib_of_group =
function
| Container (fndlb_nm, _)
| Package (fndlb_nm, _, _, _, _) -> fndlb_nm
-
+
let root_of_group grp =
let rec root_lib_aux =
(* We do a DFS in the group. *)
@@ -1946,41 +1839,41 @@ module OASISFindlib = struct
failwithf
(f_ "Unable to determine root library of findlib library '%s'")
(findlib_of_group grp)
-
+
end
module OASISFlag = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISFlag.ml"
-
+(* # 21 "src/oasis/OASISFlag.ml" *)
+
end
module OASISPackage = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISPackage.ml"
-
+(* # 21 "src/oasis/OASISPackage.ml" *)
+
end
module OASISSourceRepository = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISSourceRepository.ml"
-
+(* # 21 "src/oasis/OASISSourceRepository.ml" *)
+
end
module OASISTest = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISTest.ml"
-
+(* # 21 "src/oasis/OASISTest.ml" *)
+
end
module OASISDocument = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISDocument.ml"
-
+(* # 21 "src/oasis/OASISDocument.ml" *)
+
end
module OASISExec = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISExec.ml"
-
+(* # 21 "src/oasis/OASISExec.ml" *)
+
open OASISGettext
open OASISUtils
open OASISMessage
-
+
(* TODO: I don't like this quote, it is there because $(rm) foo expands to
* 'rm -f' foo...
*)
@@ -2010,7 +1903,7 @@ module OASISExec = struct
cmdline i
| Some f, i ->
f i
-
+
let run_read_output ~ctxt ?f_exit_code cmd args =
let fn =
Filename.temp_file "oasis-" ".txt"
@@ -2041,7 +1934,7 @@ module OASISExec = struct
with e ->
(try Sys.remove fn with _ -> ());
raise e
-
+
let run_read_one_line ~ctxt ?f_exit_code cmd args =
match run_read_output ~ctxt ?f_exit_code cmd args with
| [fst] ->
@@ -2053,10 +1946,10 @@ module OASISExec = struct
end
module OASISFileUtil = struct
-# 21 "/home/trch/software/OCaml/oasis/src/oasis/OASISFileUtil.ml"
-
+(* # 21 "src/oasis/OASISFileUtil.ml" *)
+
open OASISGettext
-
+
let file_exists_case fn =
let dirname = Filename.dirname fn in
let basename = Filename.basename fn in
@@ -2069,9 +1962,9 @@ module OASISFileUtil = struct
(Array.to_list (Sys.readdir dirname))
else
false
-
+
let find_file ?(case_sensitive=true) paths exts =
-
+
(* Cardinal product of two list *)
let ( * ) lst1 lst2 =
List.flatten
@@ -2082,7 +1975,7 @@ module OASISFileUtil = struct
lst2)
lst1)
in
-
+
let rec combined_paths lst =
match lst with
| p1 :: p2 :: tl ->
@@ -2097,7 +1990,7 @@ module OASISFileUtil = struct
| [] ->
[]
in
-
+
let alternatives =
List.map
(fun (p,e) ->
@@ -2113,7 +2006,7 @@ module OASISFileUtil = struct
else
Sys.file_exists)
alternatives
-
+
let which ~ctxt prg =
let path_sep =
match Sys.os_type with
@@ -2131,7 +2024,7 @@ module OASISFileUtil = struct
[""]
in
find_file ~case_sensitive:false [path_lst; [prg]] exec_ext
-
+
(**/**)
let rec fix_dir dn =
(* Windows hack because Sys.file_exists "src\\" = false when
@@ -2144,10 +2037,10 @@ module OASISFileUtil = struct
fix_dir (String.sub dn 0 (ln - 1))
else
dn
-
+
let q = Filename.quote
(**/**)
-
+
let cp ~ctxt ?(recurse=false) src tgt =
if recurse then
match Sys.os_type with
@@ -2163,14 +2056,14 @@ module OASISFileUtil = struct
| "Win32" -> "copy"
| _ -> "cp")
[q src; q tgt]
-
+
let mkdir ~ctxt tgt =
OASISExec.run ~ctxt
(match Sys.os_type with
| "Win32" -> "md"
| _ -> "mkdir")
[q tgt]
-
+
let rec mkdir_parent ~ctxt f tgt =
let tgt =
fix_dir tgt
@@ -2192,7 +2085,7 @@ module OASISFileUtil = struct
mkdir ~ctxt tgt
end
end
-
+
let rmdir ~ctxt tgt =
if Sys.readdir tgt = [||] then
begin
@@ -2202,7 +2095,7 @@ module OASISFileUtil = struct
| _ ->
OASISExec.run ~ctxt "rm" ["-r"; q tgt]
end
-
+
let glob ~ctxt fn =
let basename =
Filename.basename fn
@@ -2248,19 +2141,19 @@ module OASISFileUtil = struct
end
-# 2251 "setup.ml"
+# 2142 "setup.ml"
module BaseEnvLight = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseEnvLight.ml"
-
+(* # 21 "src/base/BaseEnvLight.ml" *)
+
module MapString = Map.Make(String)
-
+
type t = string MapString.t
-
+
let default_filename =
Filename.concat
(Sys.getcwd ())
"setup.data"
-
+
let load ?(allow_empty=false) ?(filename=default_filename) () =
if Sys.file_exists filename then
begin
@@ -2317,7 +2210,7 @@ module BaseEnvLight = struct
"Unable to load environment, the file '%s' doesn't exist."
filename)
end
-
+
let var_get name env =
let rec var_expand str =
let buff =
@@ -2338,7 +2231,7 @@ module BaseEnvLight = struct
Buffer.contents buff
in
var_expand (MapString.find name env)
-
+
let var_choose lst env =
OASISExpr.choose
(fun nm -> var_get nm env)
@@ -2346,59 +2239,59 @@ module BaseEnvLight = struct
end
-# 2349 "setup.ml"
+# 2240 "setup.ml"
module BaseContext = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseContext.ml"
-
+(* # 21 "src/base/BaseContext.ml" *)
+
open OASISContext
-
+
let args = args
-
+
let default = default
-
+
end
module BaseMessage = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseMessage.ml"
-
+(* # 21 "src/base/BaseMessage.ml" *)
+
(** Message to user, overrid for Base
@author Sylvain Le Gall
*)
open OASISMessage
open BaseContext
-
+
let debug fmt = debug ~ctxt:!default fmt
-
+
let info fmt = info ~ctxt:!default fmt
-
+
let warning fmt = warning ~ctxt:!default fmt
-
+
let error fmt = error ~ctxt:!default fmt
-
+
end
module BaseEnv = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseEnv.ml"
-
+(* # 21 "src/base/BaseEnv.ml" *)
+
open OASISGettext
open OASISUtils
open PropList
-
+
module MapString = BaseEnvLight.MapString
-
+
type origin_t =
| ODefault
| OGetEnv
| OFileLoad
| OCommandLine
-
+
type cli_handle_t =
| CLINone
| CLIAuto
| CLIWith
| CLIEnable
| CLIUser of (Arg.key * Arg.spec * Arg.doc) list
-
+
type definition_t =
{
hide: bool;
@@ -2407,22 +2300,22 @@ module BaseEnv = struct
arg_help: string option;
group: string option;
}
-
+
let schema =
Schema.create "environment"
-
+
(* Environment data *)
let env =
Data.create ()
-
+
(* Environment data from file *)
let env_from_file =
ref MapString.empty
-
+
(* Lexer for var *)
let var_lxr =
Genlex.make_lexer []
-
+
let rec var_expand str =
let buff =
Buffer.create ((String.length str) * 2)
@@ -2472,7 +2365,7 @@ module BaseEnv = struct
e)
str;
Buffer.contents buff
-
+
and var_get name =
let vl =
try
@@ -2486,14 +2379,14 @@ module BaseEnv = struct
end
in
var_expand vl
-
+
let var_choose ?printer ?name lst =
OASISExpr.choose
?printer
?name
var_get
lst
-
+
let var_protect vl =
let buff =
Buffer.create (String.length vl)
@@ -2504,7 +2397,7 @@ module BaseEnv = struct
| c -> Buffer.add_char buff c)
vl;
Buffer.contents buff
-
+
let var_define
?(hide=false)
?(dump=true)
@@ -2515,7 +2408,7 @@ module BaseEnv = struct
name (* TODO: type constraint on the fact that name must be a valid OCaml
id *)
dflt =
-
+
let default =
[
OFileLoad, (fun () -> MapString.find name !env_from_file);
@@ -2523,7 +2416,7 @@ module BaseEnv = struct
OGetEnv, (fun () -> Sys.getenv name);
]
in
-
+
let extra =
{
hide = hide;
@@ -2533,7 +2426,7 @@ module BaseEnv = struct
group = group;
}
in
-
+
(* Try to find a value that can be defined
*)
let var_get_low lst =
@@ -2568,13 +2461,13 @@ module BaseEnv = struct
| None, lst ->
raise (Not_set (name, Some (String.concat (s_ ", ") lst)))
in
-
+
let help =
match short_desc with
| Some fs -> Some fs
| None -> None
in
-
+
let var_get_lst =
FieldRO.create
~schema
@@ -2586,10 +2479,10 @@ module BaseEnv = struct
?help
extra
in
-
+
fun () ->
var_expand (var_get_low (var_get_lst env))
-
+
let var_redefine
?hide
?dump
@@ -2617,10 +2510,10 @@ module BaseEnv = struct
name
dflt
end
-
+
let var_ignore (e : unit -> string) =
()
-
+
let print_hidden =
var_define
~hide:true
@@ -2629,7 +2522,7 @@ module BaseEnv = struct
~arg_help:"Print even non-printable variable. (debug)"
"print_hidden"
(fun () -> "false")
-
+
let var_all () =
List.rev
(Schema.fold
@@ -2640,17 +2533,17 @@ module BaseEnv = struct
acc)
[]
schema)
-
+
let default_filename =
BaseEnvLight.default_filename
-
+
let load ?allow_empty ?filename () =
env_from_file := BaseEnvLight.load ?allow_empty ?filename ()
-
+
let unload () =
env_from_file := MapString.empty;
Data.clear env
-
+
let dump ?(filename=default_filename) () =
let chn =
open_out_bin filename
@@ -2681,10 +2574,10 @@ module BaseEnv = struct
in
(* Dump data defined outside of schema *)
MapString.iter output mp_todo;
-
+
(* End of the dump *)
close_out chn
-
+
let print () =
let printable_vars =
Schema.fold
@@ -2720,14 +2613,14 @@ module BaseEnv = struct
let dot_pad str =
String.make ((max_length - (String.length str)) + 3) '.'
in
-
+
Printf.printf "\nConfiguration: \n";
List.iter
(fun (name,value) ->
Printf.printf "%s: %s %s\n" name (dot_pad name) value)
(List.rev printable_vars);
Printf.printf "\n%!"
-
+
let args () =
let arg_concat =
OASISUtils.varname_concat ~hyphen:'-'
@@ -2754,7 +2647,7 @@ module BaseEnv = struct
]
),
"var+val Override any configuration variable.";
-
+
]
@
List.flatten
@@ -2768,23 +2661,23 @@ module BaseEnv = struct
name
s
in
-
+
let arg_name =
OASISUtils.varname_of_string ~hyphen:'-' name
in
-
+
let hlp =
match short_descr_opt with
| Some txt -> txt ()
| None -> ""
in
-
+
let arg_hlp =
match def.arg_help with
| Some s -> s
| None -> "str"
in
-
+
let default_value =
try
Printf.sprintf
@@ -2796,7 +2689,7 @@ module BaseEnv = struct
with Not_set _ ->
""
in
-
+
let args =
match def.cli with
| CLINone ->
@@ -2824,7 +2717,7 @@ module BaseEnv = struct
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
@@ -2838,17 +2731,17 @@ module BaseEnv = struct
end
module BaseArgExt = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseArgExt.ml"
-
+(* # 21 "src/base/BaseArgExt.ml" *)
+
open OASISUtils
open OASISGettext
-
+
let parse argv args =
(* Simulate command line for Arg *)
let current =
ref 0
in
-
+
try
Arg.parse_argv
~current:current
@@ -2866,13 +2759,13 @@ module BaseArgExt = struct
end
module BaseCheck = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseCheck.ml"
-
+(* # 21 "src/base/BaseCheck.ml" *)
+
open BaseEnv
open BaseMessage
open OASISUtils
open OASISGettext
-
+
let prog_best prg prg_lst =
var_redefine
prg
@@ -2894,16 +2787,16 @@ module BaseCheck = struct
match alternate with
| Some prg -> prg
| None -> raise Not_found)
-
+
let prog prg =
prog_best prg [prg]
-
+
let prog_opt prg =
prog_best prg [prg^".opt"; prg]
-
+
let ocamlfind =
prog "ocamlfind"
-
+
let version
var_prefix
cmp
@@ -2944,12 +2837,12 @@ module BaseCheck = struct
(OASISVersion.string_of_comparator cmp)
version_str)
()
-
+
let package_version pkg =
OASISExec.run_read_one_line ~ctxt:!BaseContext.default
(ocamlfind ())
["query"; "-format"; "%v"; pkg]
-
+
let package ?version_comparator pkg () =
let var =
OASISUtils.varname_concat
@@ -2992,18 +2885,18 @@ module BaseCheck = struct
end
module BaseOCamlcConfig = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseOCamlcConfig.ml"
-
-
+(* # 21 "src/base/BaseOCamlcConfig.ml" *)
+
+
open BaseEnv
open OASISUtils
open OASISGettext
-
+
module SMap = Map.Make(String)
-
+
let ocamlc =
BaseCheck.prog_opt "ocamlc"
-
+
let ocamlc_config_map =
(* Map name to value for ocamlc -config output
(name ^": "^value)
@@ -3048,7 +2941,7 @@ module BaseOCamlcConfig = struct
| [] ->
mp
in
-
+
let cache =
lazy
(var_protect
@@ -3067,7 +2960,7 @@ module BaseOCamlcConfig = struct
(fun () ->
(* TODO: update if ocamlc change !!! *)
Lazy.force cache)
-
+
let var_define nm =
(* Extract data from ocamlc -config *)
let avlbl_config_get () =
@@ -3081,7 +2974,7 @@ module BaseOCamlcConfig = struct
with _ ->
s
in
-
+
let nm_config, value_config =
match nm with
| "ocaml_version" ->
@@ -3104,36 +2997,36 @@ module BaseOCamlcConfig = struct
(f_ "Cannot find field '%s' in '%s -config' output")
nm
(ocamlc ()))
-
+
end
module BaseStandardVar = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseStandardVar.ml"
-
-
+(* # 21 "src/base/BaseStandardVar.ml" *)
+
+
open OASISGettext
open OASISTypes
open OASISExpr
open BaseCheck
open BaseEnv
-
+
let ocamlfind = BaseCheck.ocamlfind
let ocamlc = BaseOCamlcConfig.ocamlc
let ocamlopt = prog_opt "ocamlopt"
let ocamlbuild = prog "ocamlbuild"
-
-
+
+
(**/**)
let rpkg =
ref None
-
+
let pkg_get () =
match !rpkg with
| Some pkg -> pkg
| None -> failwith (s_ "OASIS Package is not set")
-
+
let var_cond = ref []
-
+
let var_define_cond ~since_version f dflt =
let holder = ref (fun () -> dflt) in
let since_version =
@@ -3144,32 +3037,32 @@ module BaseStandardVar = struct
if OASISVersion.comparator_apply ver since_version then
holder := f ()) :: !var_cond;
fun () -> !holder ()
-
+
(**/**)
-
+
let pkg_name =
var_define
~short_desc:(fun () -> s_ "Package name")
"pkg_name"
(fun () -> (pkg_get ()).name)
-
+
let pkg_version =
var_define
~short_desc:(fun () -> s_ "Package version")
"pkg_version"
(fun () ->
(OASISVersion.string_of_version (pkg_get ()).version))
-
+
let c = BaseOCamlcConfig.var_define
-
+
let os_type = c "os_type"
let system = c "system"
let architecture = c "architecture"
let ccomp_type = c "ccomp_type"
let ocaml_version = c "ocaml_version"
-
+
(* TODO: Check standard variable presence at runtime *)
-
+
let standard_library_default = c "standard_library_default"
let standard_library = c "standard_library"
let standard_runtime = c "standard_runtime"
@@ -3182,10 +3075,10 @@ module BaseStandardVar = struct
let ext_dll = c "ext_dll"
let default_executable_name = c "default_executable_name"
let systhread_supported = c "systhread_supported"
-
+
let flexlink =
BaseCheck.prog "flexlink"
-
+
let flexdll_version =
var_define
~short_desc:(fun () -> "FlexDLL version (Win32)")
@@ -3200,7 +3093,7 @@ module BaseStandardVar = struct
Scanf.sscanf line "FlexDLL version %s" (fun ver -> ver)
| [] ->
raise Not_found)
-
+
(**/**)
let p name hlp dflt =
var_define
@@ -3209,7 +3102,7 @@ module BaseStandardVar = struct
~arg_help:"dir"
name
dflt
-
+
let (/) a b =
if os_type () = Sys.os_type then
Filename.concat a b
@@ -3219,7 +3112,7 @@ module BaseStandardVar = struct
OASISUtils.failwithf (f_ "Cannot handle os_type %s filename concat")
(os_type ())
(**/**)
-
+
let prefix =
p "prefix"
(fun () -> s_ "Install architecture-independent files dir")
@@ -3232,97 +3125,97 @@ module BaseStandardVar = struct
program_files/(pkg_name ())
| _ ->
"/usr/local")
-
+
let exec_prefix =
p "exec_prefix"
(fun () -> s_ "Install architecture-dependent files in dir")
(fun () -> "$prefix")
-
+
let bindir =
p "bindir"
(fun () -> s_ "User executables")
(fun () -> "$exec_prefix"/"bin")
-
+
let sbindir =
p "sbindir"
(fun () -> s_ "System admin executables")
(fun () -> "$exec_prefix"/"sbin")
-
+
let libexecdir =
p "libexecdir"
(fun () -> s_ "Program executables")
(fun () -> "$exec_prefix"/"libexec")
-
+
let sysconfdir =
p "sysconfdir"
(fun () -> s_ "Read-only single-machine data")
(fun () -> "$prefix"/"etc")
-
+
let sharedstatedir =
p "sharedstatedir"
(fun () -> s_ "Modifiable architecture-independent data")
(fun () -> "$prefix"/"com")
-
+
let localstatedir =
p "localstatedir"
(fun () -> s_ "Modifiable single-machine data")
(fun () -> "$prefix"/"var")
-
+
let libdir =
p "libdir"
(fun () -> s_ "Object code libraries")
(fun () -> "$exec_prefix"/"lib")
-
+
let datarootdir =
p "datarootdir"
(fun () -> s_ "Read-only arch-independent data root")
(fun () -> "$prefix"/"share")
-
+
let datadir =
p "datadir"
(fun () -> s_ "Read-only architecture-independent data")
(fun () -> "$datarootdir")
-
+
let infodir =
p "infodir"
(fun () -> s_ "Info documentation")
(fun () -> "$datarootdir"/"info")
-
+
let localedir =
p "localedir"
(fun () -> s_ "Locale-dependent data")
(fun () -> "$datarootdir"/"locale")
-
+
let mandir =
p "mandir"
(fun () -> s_ "Man documentation")
(fun () -> "$datarootdir"/"man")
-
+
let docdir =
p "docdir"
(fun () -> s_ "Documentation root")
(fun () -> "$datarootdir"/"doc"/"$pkg_name")
-
+
let htmldir =
p "htmldir"
(fun () -> s_ "HTML documentation")
(fun () -> "$docdir")
-
+
let dvidir =
p "dvidir"
(fun () -> s_ "DVI documentation")
(fun () -> "$docdir")
-
+
let pdfdir =
p "pdfdir"
(fun () -> s_ "PDF documentation")
(fun () -> "$docdir")
-
+
let psdir =
p "psdir"
(fun () -> s_ "PS documentation")
(fun () -> "$docdir")
-
+
let destdir =
p "destdir"
(fun () -> s_ "Prepend a path when installing package")
@@ -3331,13 +3224,13 @@ module BaseStandardVar = struct
(PropList.Not_set
("destdir",
Some (s_ "undefined by construct"))))
-
+
let findlib_version =
var_define
"findlib_version"
(fun () ->
BaseCheck.package_version "findlib")
-
+
let is_native =
var_define
"is_native"
@@ -3352,7 +3245,7 @@ module BaseStandardVar = struct
ocamlc ()
in
"false")
-
+
let ext_program =
var_define
"suffix_program"
@@ -3360,7 +3253,7 @@ module BaseStandardVar = struct
match os_type () with
| "Win32" -> ".exe"
| _ -> "")
-
+
let rm =
var_define
~short_desc:(fun () -> s_ "Remove a file.")
@@ -3369,7 +3262,7 @@ module BaseStandardVar = struct
match os_type () with
| "Win32" -> "del"
| _ -> "rm -f")
-
+
let rmdir =
var_define
~short_desc:(fun () -> s_ "Remove a directory.")
@@ -3378,21 +3271,21 @@ module BaseStandardVar = struct
match os_type () with
| "Win32" -> "rd"
| _ -> "rm -rf")
-
+
let debug =
var_define
~short_desc:(fun () -> s_ "Turn ocaml debug flag on")
~cli:CLIEnable
"debug"
(fun () -> "true")
-
+
let profile =
var_define
~short_desc:(fun () -> s_ "Turn ocaml profile flag on")
~cli:CLIEnable
"profile"
(fun () -> "false")
-
+
let tests =
var_define_cond ~since_version:"0.3"
(fun () ->
@@ -3403,7 +3296,7 @@ module BaseStandardVar = struct
"tests"
(fun () -> "false"))
"true"
-
+
let docs =
var_define_cond ~since_version:"0.3"
(fun () ->
@@ -3413,7 +3306,7 @@ module BaseStandardVar = struct
"docs"
(fun () -> "true"))
"true"
-
+
let native_dynlink =
var_define
~short_desc:(fun () -> s_ "Compiler support generation of .cmxs.")
@@ -3464,20 +3357,20 @@ module BaseStandardVar = struct
true
in
string_of_bool res)
-
+
let init pkg =
rpkg := Some pkg;
List.iter (fun f -> f pkg.oasis_version) !var_cond
-
+
end
module BaseFileAB = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseFileAB.ml"
-
+(* # 21 "src/base/BaseFileAB.ml" *)
+
open BaseEnv
open OASISGettext
open BaseMessage
-
+
let to_filename fn =
let fn =
OASISHostPath.of_unix fn
@@ -3487,7 +3380,7 @@ module BaseFileAB = struct
(f_ "File '%s' doesn't have '.ab' extension")
fn;
Filename.chop_extension fn
-
+
let replace fn_lst =
let buff =
Buffer.create 13
@@ -3520,15 +3413,15 @@ module BaseFileAB = struct
end
module BaseLog = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseLog.ml"
-
+(* # 21 "src/base/BaseLog.ml" *)
+
open OASISUtils
-
+
let default_filename =
Filename.concat
(Filename.dirname BaseEnv.default_filename)
"setup.log"
-
+
module SetTupleString =
Set.Make
(struct
@@ -3538,7 +3431,7 @@ module BaseLog = struct
| 0 -> String.compare s12 s22
| n -> n
end)
-
+
let load () =
if Sys.file_exists default_filename then
begin
@@ -3587,14 +3480,14 @@ module BaseLog = struct
begin
[]
end
-
+
let register event data =
let chn_out =
open_out_gen [Open_append; Open_creat; Open_text] 0o644 default_filename
in
Printf.fprintf chn_out "%S %S\n" event data;
close_out chn_out
-
+
let unregister event data =
if Sys.file_exists default_filename then
begin
@@ -3619,7 +3512,7 @@ module BaseLog = struct
if not !write_something then
Sys.remove default_filename
end
-
+
let filter events =
let st_events =
List.fold_left
@@ -3631,7 +3524,7 @@ module BaseLog = struct
List.filter
(fun (e, _) -> SetString.mem e st_events)
(load ())
-
+
let exists event data =
List.exists
(fun v -> (event, data) = v)
@@ -3639,33 +3532,31 @@ module BaseLog = struct
end
module BaseBuilt = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseBuilt.ml"
-
+(* # 21 "src/base/BaseBuilt.ml" *)
+
open OASISTypes
open OASISGettext
open BaseStandardVar
open BaseMessage
-
+
type t =
| BExec (* Executable *)
| BExecLib (* Library coming with executable *)
| BLib (* Library *)
- | BObj (* Library *)
| BDoc (* Document *)
-
+
let to_log_event_file t nm =
"built_"^
(match t with
| BExec -> "exec"
| BExecLib -> "exec_lib"
| BLib -> "lib"
- | BObj -> "obj"
| BDoc -> "doc")^
"_"^nm
-
+
let to_log_event_done t nm =
"is_"^(to_log_event_file t nm)
-
+
let register t nm lst =
BaseLog.register
(to_log_event_done t nm)
@@ -3695,7 +3586,7 @@ module BaseBuilt = struct
(f_ "Cannot find an existing alternative files among: %s")
(String.concat (s_ ", ") alt))
lst
-
+
let unregister t nm =
List.iter
(fun (e, d) ->
@@ -3703,7 +3594,7 @@ module BaseBuilt = struct
(BaseLog.filter
[to_log_event_file t nm;
to_log_event_done t nm])
-
+
let fold t nm f acc =
List.fold_left
(fun acc (_, fn) ->
@@ -3723,8 +3614,6 @@ module BaseBuilt = struct
(f_ "executable %s")
| BLib ->
(f_ "library %s")
- | BObj ->
- (f_ "object %s")
| BDoc ->
(f_ "documentation %s"))
nm);
@@ -3733,7 +3622,7 @@ module BaseBuilt = struct
acc
(BaseLog.filter
[to_log_event_file t nm])
-
+
let is_built t nm =
List.fold_left
(fun is_built (_, d) ->
@@ -3744,7 +3633,7 @@ module BaseBuilt = struct
false
(BaseLog.filter
[to_log_event_done t nm])
-
+
let of_executable ffn (cs, bs, exec) =
let unix_exec_is, unix_dll_opt =
OASISExecutable.unix_exec_is
@@ -3767,7 +3656,7 @@ module BaseBuilt = struct
evs,
unix_exec_is,
unix_dll_opt
-
+
let of_library ffn (cs, bs, lib) =
let unix_lst =
OASISLibrary.generated_unix_files
@@ -3786,41 +3675,24 @@ module BaseBuilt = struct
List.map (List.map ffn) unix_lst]
in
evs, unix_lst
-
-
- let of_object ffn (cs, bs, obj) =
- let unix_lst =
- OASISObject.generated_unix_files
- ~ctxt:!BaseContext.default
- ~source_file_exists:(fun fn ->
- OASISFileUtil.file_exists_case (OASISHostPath.of_unix fn))
- ~is_native:(bool_of_string (is_native ()))
- (cs, bs, obj)
- in
- let evs =
- [BObj,
- cs.cs_name,
- List.map (List.map ffn) unix_lst]
- in
- evs, unix_lst
-
+
end
module BaseCustom = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseCustom.ml"
-
+(* # 21 "src/base/BaseCustom.ml" *)
+
open BaseEnv
open BaseMessage
open OASISTypes
open OASISGettext
-
+
let run cmd args extra_args =
OASISExec.run ~ctxt:!BaseContext.default ~quote:false
(var_expand cmd)
(List.map
var_expand
(args @ (Array.to_list extra_args)))
-
+
let hook ?(failsafe=false) cstm f e =
let optional_command lst =
let printer =
@@ -3857,14 +3729,14 @@ module BaseCustom = struct
end
module BaseDynVar = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseDynVar.ml"
-
-
+(* # 21 "src/base/BaseDynVar.ml" *)
+
+
open OASISTypes
open OASISGettext
open BaseEnv
open BaseBuilt
-
+
let init pkg =
(* TODO: disambiguate exec vs other variable by adding exec_VARNAME. *)
(* TODO: provide compile option for library libary_byte_args_VARNAME... *)
@@ -3897,23 +3769,23 @@ module BaseDynVar = struct
Some (Printf.sprintf
(f_ "Executable '%s' not yet built.")
cs.cs_name)))))
-
- | Library _ | Object _ | Flag _ | Test _ | SrcRepo _ | Doc _ ->
+
+ | Library _ | Flag _ | Test _ | SrcRepo _ | Doc _ ->
())
pkg.sections
end
module BaseTest = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseTest.ml"
-
+(* # 21 "src/base/BaseTest.ml" *)
+
open BaseEnv
open BaseMessage
open OASISTypes
open OASISExpr
open OASISGettext
-
+
let test lst pkg extra_args =
-
+
let one_test (failure, n) (test_plugin, cs, test) =
if var_choose
~name:(Printf.sprintf
@@ -3937,7 +3809,7 @@ module BaseTest = struct
in
chdir dir;
fun () -> chdir cwd
-
+
| None ->
fun () -> ()
in
@@ -3983,7 +3855,7 @@ module BaseTest = struct
failwith msg
else
info "%s" msg;
-
+
(* Possible explanation why the tests where not run. *)
if OASISVersion.version_0_3_or_after pkg.oasis_version &&
not (bool_of_string (BaseStandardVar.tests ())) &&
@@ -3994,15 +3866,15 @@ module BaseTest = struct
end
module BaseDoc = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseDoc.ml"
-
+(* # 21 "src/base/BaseDoc.ml" *)
+
open BaseEnv
open BaseMessage
open OASISTypes
open OASISGettext
-
+
let doc lst pkg extra_args =
-
+
let one_doc (doc_plugin, cs, doc) =
if var_choose
~name:(Printf.sprintf
@@ -4019,7 +3891,7 @@ module BaseDoc = struct
end
in
List.iter one_doc lst;
-
+
if OASISVersion.version_0_3_or_after pkg.oasis_version &&
not (bool_of_string (BaseStandardVar.docs ())) &&
lst <> [] then
@@ -4029,21 +3901,21 @@ module BaseDoc = struct
end
module BaseSetup = struct
-# 21 "/home/trch/software/OCaml/oasis/src/base/BaseSetup.ml"
-
+(* # 21 "src/base/BaseSetup.ml" *)
+
open BaseEnv
open BaseMessage
open OASISTypes
open OASISSection
open OASISGettext
open OASISUtils
-
+
type std_args_fun =
package -> string array -> unit
-
+
type ('a, 'b) section_args_fun =
name * (package -> (common_section * 'a) -> string array -> 'b)
-
+
type t =
{
configure: std_args_fun;
@@ -4066,7 +3938,7 @@ module BaseSetup = struct
oasis_setup_args: string list;
setup_update: bool;
}
-
+
(* Associate a plugin function with data from package *)
let join_plugin_sections filter_map lst =
List.rev
@@ -4079,7 +3951,7 @@ module BaseSetup = struct
acc)
[]
lst)
-
+
(* Search for plugin data associated with a section name *)
let lookup_plugin_section plugin action nm lst =
try
@@ -4090,7 +3962,7 @@ module BaseSetup = struct
plugin
nm
action
-
+
let configure t args =
(* Run configure *)
BaseCustom.hook
@@ -4104,30 +3976,30 @@ module BaseSetup = struct
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
-
+
let build t args =
BaseCustom.hook
t.package.build_custom
(t.build t.package)
args
-
+
let doc t args =
BaseDoc.doc
(join_plugin_sections
@@ -4146,7 +4018,7 @@ module BaseSetup = struct
t.package.sections)
t.package
args
-
+
let test t args =
BaseTest.test
(join_plugin_sections
@@ -4165,7 +4037,7 @@ module BaseSetup = struct
t.package.sections)
t.package
args
-
+
let all t args =
let rno_doc =
ref false
@@ -4182,23 +4054,23 @@ module BaseSetup = struct
"-no-doc",
Arg.Set rno_doc,
s_ "Don't run doc target";
-
+
"-no-test",
Arg.Set rno_test,
s_ "Don't run test target";
]
(failwithf (f_ "Don't know what to do with '%s'"))
"";
-
+
info "Running configure step";
configure t [||];
-
+
info "Running build step";
build t [||];
-
+
(* Load setup.log dynamic variables *)
BaseDynVar.init t.package;
-
+
if not !rno_doc then
begin
info "Running doc step";
@@ -4208,7 +4080,7 @@ module BaseSetup = struct
begin
info "Skipping doc step"
end;
-
+
if not !rno_test then
begin
info "Running test step";
@@ -4218,23 +4090,23 @@ module BaseSetup = struct
begin
info "Skipping test step"
end
-
+
let install t args =
BaseCustom.hook
t.package.install_custom
(t.install t.package)
args
-
+
let uninstall t args =
BaseCustom.hook
t.package.uninstall_custom
(t.uninstall t.package)
args
-
+
let reinstall t args =
uninstall t args;
install t args
-
+
let clean, distclean =
let failsafe f a =
try
@@ -4246,7 +4118,7 @@ module BaseSetup = struct
| Failure msg -> msg
| e -> Printexc.to_string e)
in
-
+
let generic_clean t cstm mains docs tests args =
BaseCustom.hook
~failsafe:true
@@ -4276,7 +4148,6 @@ module BaseSetup = struct
(f t.package (cs, doc))
args
| Library _
- | Object _
| Executable _
| Flag _
| SrcRepo _ ->
@@ -4291,7 +4162,7 @@ module BaseSetup = struct
mains)
()
in
-
+
let clean t args =
generic_clean
t
@@ -4301,11 +4172,11 @@ module BaseSetup = struct
t.clean_test
args
in
-
+
let distclean t args =
(* Call clean *)
clean t args;
-
+
(* Call distclean code *)
generic_clean
t
@@ -4314,7 +4185,7 @@ module BaseSetup = struct
t.distclean_doc
t.distclean_test
args;
-
+
(* Remove generated file *)
List.iter
(fun fn ->
@@ -4329,19 +4200,19 @@ module BaseSetup = struct
::
(List.rev_map BaseFileAB.to_filename t.package.files_ab))
in
-
+
clean, distclean
-
+
let version t _ =
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
@@ -4438,7 +4309,7 @@ module BaseSetup = struct
least oasis v%s.")
oasis_exec oasis_exec_version setup_ml t.oasis_version
in
-
+
if !update_setup_ml then
begin
try
@@ -4463,7 +4334,7 @@ module BaseSetup = struct
end
else
false
-
+
let setup t =
let catch_exn =
ref true
@@ -4475,7 +4346,7 @@ module BaseSetup = struct
(f_ "No action defined, run '%s %s -help'")
Sys.executable_name
Sys.argv.(0))
-
+
in
let extra_args_ref =
ref []
@@ -4487,64 +4358,64 @@ module BaseSetup = struct
Arg.Tuple
[
Arg.Rest (fun str -> extra_args_ref := str :: !extra_args_ref);
-
+
Arg.Unit
(fun () ->
allow_empty_env_ref := allow_empty_env;
act_ref := act);
]
in
-
+
Arg.parse
(Arg.align
([
"-configure",
arg_handle ~allow_empty_env:true configure,
s_ "[options*] Configure the whole build process.";
-
+
"-build",
arg_handle build,
s_ "[options*] Build executables and libraries.";
-
+
"-doc",
arg_handle doc,
s_ "[options*] Build documents.";
-
+
"-test",
arg_handle test,
s_ "[options*] Run tests.";
-
+
"-all",
arg_handle ~allow_empty_env:true all,
s_ "[options*] Run configure, build, doc and test targets.";
-
+
"-install",
arg_handle install,
s_ "[options*] Install libraries, data, executables \
and documents.";
-
+
"-uninstall",
arg_handle uninstall,
s_ "[options*] Uninstall libraries, data, executables \
and documents.";
-
+
"-reinstall",
arg_handle reinstall,
s_ "[options*] Uninstall and install libraries, data, \
executables and documents.";
-
+
"-clean",
arg_handle ~allow_empty_env:true clean,
s_ "[options*] Clean files generated by a build.";
-
+
"-distclean",
arg_handle ~allow_empty_env:true distclean,
s_ "[options*] Clean files generated by a build and configure.";
-
+
"-version",
arg_handle ~allow_empty_env:true version,
s_ " Display version of OASIS used to generate this setup.ml.";
-
+
"-no-catch-exn",
Arg.Clear catch_exn,
s_ " Don't catch exception, useful for debugging.";
@@ -4557,10 +4428,10 @@ module BaseSetup = struct
@ (BaseContext.args ())))
(failwithf (f_ "Don't know what to do with '%s'"))
(s_ "Setup and run build process current package\n");
-
+
(* Build initial environment *)
load ~allow_empty:!allow_empty_env_ref ();
-
+
(** Initialize flags *)
List.iter
(function
@@ -4591,37 +4462,37 @@ module BaseSetup = struct
| _ ->
())
t.package.sections;
-
+
BaseStandardVar.init t.package;
-
+
BaseDynVar.init t.package;
-
+
if t.setup_update && update_setup_ml t then
()
else
!act_ref t (Array.of_list (List.rev !extra_args_ref))
-
+
with e when !catch_exn ->
error "%s" (Printexc.to_string e);
exit 1
-
+
end
-# 4611 "setup.ml"
+# 4480 "setup.ml"
module InternalConfigurePlugin = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/internal/InternalConfigurePlugin.ml"
-
+(* # 21 "src/plugins/internal/InternalConfigurePlugin.ml" *)
+
(** Configure using internal scheme
@author Sylvain Le Gall
*)
-
+
open BaseEnv
open OASISTypes
open OASISUtils
open OASISGettext
open BaseMessage
-
+
(** Configure build using provided series of check to be done
* and then output corresponding file.
*)
@@ -4632,15 +4503,15 @@ module InternalConfigurePlugin = struct
in
()
in
-
+
let errors =
ref SetString.empty
in
-
+
let buff =
Buffer.create 13
in
-
+
let add_errors fmt =
Printf.kbprintf
(fun b ->
@@ -4649,11 +4520,11 @@ module InternalConfigurePlugin = struct
buff
fmt
in
-
+
let warn_exception e =
warning "%s" (Printexc.to_string e)
in
-
+
(* Check tools *)
let check_tools lst =
List.iter
@@ -4683,7 +4554,7 @@ module InternalConfigurePlugin = struct
pkg.sections)
lst
in
-
+
let build_checks sct bs =
if var_choose bs.bs_build then
begin
@@ -4697,10 +4568,10 @@ module InternalConfigurePlugin = struct
(f_ "Section %s requires native compilation")
(OASISSection.string_of_section sct)
end;
-
+
(* Check tools *)
check_tools bs.bs_build_tools;
-
+
(* Check depends *)
List.iter
(function
@@ -4740,10 +4611,10 @@ module InternalConfigurePlugin = struct
bs.bs_build_depends
end
in
-
+
(* Parse command line *)
BaseArgExt.parse argv (BaseEnv.args ());
-
+
(* OCaml version *)
begin
match pkg.ocaml_version with
@@ -4765,7 +4636,7 @@ module InternalConfigurePlugin = struct
| None ->
()
end;
-
+
(* Findlib version *)
begin
match pkg.findlib_version with
@@ -4787,21 +4658,7 @@ module InternalConfigurePlugin = struct
| None ->
()
end;
- (* Make sure the findlib version is fine for the OCaml compiler. *)
- begin
- let ocaml_ge4 =
- OASISVersion.version_compare
- (OASISVersion.version_of_string (BaseStandardVar.ocaml_version()))
- (OASISVersion.version_of_string "4.0.0") >= 0 in
- if ocaml_ge4 then
- let findlib_lt132 =
- OASISVersion.version_compare
- (OASISVersion.version_of_string (BaseStandardVar.findlib_version()))
- (OASISVersion.version_of_string "1.3.2") < 0 in
- if findlib_lt132 then
- add_errors "OCaml >= 4.0.0 requires Findlib version >= 1.3.2"
- end;
-
+
(* FlexDLL *)
if BaseStandardVar.os_type () = "Win32" ||
BaseStandardVar.os_type () = "Cygwin" then
@@ -4812,7 +4669,7 @@ module InternalConfigurePlugin = struct
warn_exception e;
add_errors (f_ "Cannot find 'flexlink'")
end;
-
+
(* Check build depends *)
List.iter
(function
@@ -4828,7 +4685,7 @@ module InternalConfigurePlugin = struct
| _ ->
())
pkg.sections;
-
+
(* Check if we need native dynlink (presence of libraries that compile to
* native)
*)
@@ -4848,7 +4705,7 @@ module InternalConfigurePlugin = struct
if has_cmxa then
var_ignore_eval BaseStandardVar.native_dynlink
end;
-
+
(* Check errors *)
if SetString.empty != !errors then
begin
@@ -4862,47 +4719,44 @@ module InternalConfigurePlugin = struct
(SetString.cardinal !errors))
(SetString.cardinal !errors)
end
-
+
end
module InternalInstallPlugin = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/internal/InternalInstallPlugin.ml"
-
+(* # 21 "src/plugins/internal/InternalInstallPlugin.ml" *)
+
(** Install using internal scheme
@author Sylvain Le Gall
*)
-
+
open BaseEnv
open BaseStandardVar
open BaseMessage
open OASISTypes
- open OASISFindlib
+ open OASISLibrary
open OASISGettext
open OASISUtils
-
+
let exec_hook =
ref (fun (cs, bs, exec) -> cs, bs, exec)
-
+
let lib_hook =
ref (fun (cs, bs, lib) -> cs, bs, lib, [])
-
- let obj_hook =
- ref (fun (cs, bs, obj) -> cs, bs, obj, [])
-
+
let doc_hook =
ref (fun (cs, doc) -> cs, doc)
-
+
let install_file_ev =
"install-file"
-
+
let install_dir_ev =
"install-dir"
-
+
let install_findlib_ev =
"install-findlib"
-
+
let win32_max_command_line_length = 8000
-
+
let split_install_command ocamlfind findlib_name meta files =
if Sys.os_type = "Win32" then
(* Arguments for the first command: *)
@@ -4965,9 +4819,9 @@ module InternalInstallPlugin = struct
split first_args files
else
["install" :: findlib_name :: meta :: files]
-
+
let install pkg argv =
-
+
let in_destdir =
try
let destdir =
@@ -4980,7 +4834,7 @@ module InternalInstallPlugin = struct
with PropList.Not_set _ ->
fun fn -> fn
in
-
+
let install_file ?tgt_fn src_file envdir =
let tgt_dir =
in_destdir (envdir ())
@@ -5001,13 +4855,13 @@ module InternalInstallPlugin = struct
info (f_ "Creating directory '%s'") dn;
BaseLog.register install_dir_ev dn)
tgt_dir;
-
+
(* Really install files *)
info (f_ "Copying file '%s' to '%s'") src_file tgt_file;
OASISFileUtil.cp ~ctxt:!BaseContext.default src_file tgt_file;
BaseLog.register install_file_ev tgt_file
in
-
+
(* Install data into defined directory *)
let install_data srcdir lst tgtdir =
let tgtdir =
@@ -5037,10 +4891,10 @@ module InternalInstallPlugin = struct
real_srcs)
lst
in
-
+
(** Install all libraries *)
let install_libs pkg =
-
+
let files_of_library (f_data, acc) data_lib =
let cs, bs, lib, lib_extra =
!lib_hook data_lib
@@ -5082,7 +4936,7 @@ module InternalInstallPlugin = struct
acc
lib.lib_modules
in
-
+
let acc =
(* Get generated files *)
BaseBuilt.fold
@@ -5091,7 +4945,7 @@ module InternalInstallPlugin = struct
(fun acc fn -> fn :: acc)
acc
in
-
+
let f_data () =
(* Install data associated with the library *)
install_data
@@ -5102,84 +4956,15 @@ module InternalInstallPlugin = struct
pkg.name);
f_data ()
in
-
- (f_data, acc)
- end
- else
- begin
- (f_data, acc)
- end
- and files_of_object (f_data, acc) data_obj =
- let cs, bs, obj, obj_extra =
- !obj_hook data_obj
- in
- if var_choose bs.bs_install &&
- BaseBuilt.is_built BaseBuilt.BObj cs.cs_name then
- begin
- let acc =
- (* Start with acc + obj_extra *)
- List.rev_append obj_extra acc
- in
- let acc =
- (* Add uncompiled header from the source tree *)
- let path =
- OASISHostPath.of_unix bs.bs_path
- in
- List.fold_left
- (fun acc modul ->
- try
- List.find
- OASISFileUtil.file_exists_case
- (List.map
- (Filename.concat path)
- [modul^".mli";
- modul^".ml";
- String.uncapitalize modul^".mli";
- String.capitalize modul^".mli";
- String.uncapitalize modul^".ml";
- String.capitalize modul^".ml"])
- :: acc
- with Not_found ->
- begin
- warning
- (f_ "Cannot find source header for module %s \
- in object %s")
- modul cs.cs_name;
- acc
- end)
- acc
- obj.obj_modules
- in
-
- let acc =
- (* Get generated files *)
- BaseBuilt.fold
- BaseBuilt.BObj
- cs.cs_name
- (fun acc fn -> fn :: acc)
- acc
- in
-
- let f_data () =
- (* Install data associated with the object *)
- install_data
- bs.bs_path
- bs.bs_data_files
- (Filename.concat
- (datarootdir ())
- pkg.name);
- f_data ()
- in
-
+
(f_data, acc)
end
else
begin
(f_data, acc)
end
-
in
-
+
(* Install one group of library *)
let install_group_lib grp =
(* Iterate through all group nodes *)
@@ -5188,32 +4973,30 @@ module InternalInstallPlugin = struct
match grp with
| Container (_, children) ->
data_and_files, children
- | Package (_, cs, bs, `Library lib, children) ->
+ | Package (_, cs, bs, lib, children) ->
files_of_library data_and_files (cs, bs, lib), children
- | Package (_, cs, bs, `Object obj, children) ->
- files_of_object data_and_files (cs, bs, obj), children
in
List.fold_left
install_group_lib_aux
data_and_files
children
in
-
+
(* Findlib name of the root library *)
let findlib_name =
findlib_of_group grp
in
-
+
(* Determine root library *)
let root_lib =
root_of_group grp
in
-
+
(* All files to install for this library *)
let f_data, files =
install_group_lib_aux (ignore, []) grp
in
-
+
(* Really install, if there is something to install *)
if files = [] then
begin
@@ -5282,20 +5065,20 @@ module InternalInstallPlugin = struct
commands;
BaseLog.register install_findlib_ev findlib_name
end;
-
+
(* Install data files *)
f_data ();
-
+
in
-
+
let group_libs, _, _ =
findlib_mapping pkg
in
-
+
(* We install libraries in groups *)
List.iter install_group_lib group_libs
in
-
+
let install_execs pkg =
let install_exec data_exec =
let (cs, bs, exec) =
@@ -5342,7 +5125,7 @@ module InternalInstallPlugin = struct
())
pkg.sections
in
-
+
let install_docs pkg =
let install_doc data =
let (cs, doc) =
@@ -5376,11 +5159,11 @@ module InternalInstallPlugin = struct
())
pkg.sections
in
-
+
install_libs pkg;
install_execs pkg;
install_docs pkg
-
+
(* Uninstall already installed data *)
let uninstall _ argv =
List.iter
@@ -5445,30 +5228,30 @@ module InternalInstallPlugin = struct
[install_file_ev;
install_dir_ev;
install_findlib_ev;]))
-
+
end
-# 5452 "setup.ml"
+# 5233 "setup.ml"
module OCamlbuildCommon = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/ocamlbuild/OCamlbuildCommon.ml"
-
+(* # 21 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
+
(** Functions common to OCamlbuild build and doc plugin
*)
-
+
open OASISGettext
open BaseEnv
open BaseStandardVar
-
+
let ocamlbuild_clean_ev =
"ocamlbuild-clean"
-
+
let ocamlbuildflags =
var_define
~short_desc:(fun () -> "OCamlbuild additional flags")
"ocamlbuildflags"
(fun () -> "")
-
+
(** Fix special arguments depending on environment *)
let fix_args args extra_argv =
List.flatten
@@ -5483,7 +5266,7 @@ module OCamlbuildCommon = struct
]
else
[];
-
+
if not (bool_of_string (is_native ())) || (os_type ()) = "Win32" then
[
"-byte-plugin"
@@ -5491,22 +5274,22 @@ module OCamlbuildCommon = struct
else
[];
args;
-
+
if bool_of_string (debug ()) then
["-tag"; "debug"]
else
[];
-
+
if bool_of_string (profile ()) then
["-tag"; "profile"]
else
[];
-
+
OASISString.nsplit (ocamlbuildflags ()) ' ';
-
+
Array.to_list extra_argv;
]
-
+
(** Run 'ocamlbuild -clean' if not already done *)
let run_clean extra_argv =
let extra_cli =
@@ -5525,7 +5308,7 @@ module OCamlbuildCommon = struct
with _ ->
())
end
-
+
(** Run ocamlbuild, unregister all clean events *)
let run_ocamlbuild args extra_argv =
(* TODO: enforce that target in args must be UNIX encoded i.e. toto/index.html
@@ -5536,7 +5319,7 @@ module OCamlbuildCommon = struct
List.iter
(fun (e, d) -> BaseLog.unregister e d)
(BaseLog.filter [ocamlbuild_clean_ev])
-
+
(** Determine real build directory *)
let build_dir extra_argv =
let rec search_args dir =
@@ -5549,16 +5332,16 @@ module OCamlbuildCommon = struct
dir
in
search_args "_build" (fix_args [] extra_argv)
-
+
end
module OCamlbuildPlugin = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml"
-
+(* # 21 "src/plugins/ocamlbuild/OCamlbuildPlugin.ml" *)
+
(** Build using ocamlbuild
@author Sylvain Le Gall
*)
-
+
open OASISTypes
open OASISGettext
open OASISUtils
@@ -5566,37 +5349,24 @@ module OCamlbuildPlugin = struct
open OCamlbuildCommon
open BaseStandardVar
open BaseMessage
-
+
let cond_targets_hook =
ref (fun lst -> lst)
-
+
let build pkg argv =
-
+
(* Return the filename in build directory *)
let in_build_dir fn =
Filename.concat
(build_dir argv)
fn
in
-
+
(* Return the unix filename in host build directory *)
let in_build_dir_of_unix fn =
in_build_dir (OASISHostPath.of_unix fn)
in
-
- (* Checks if the string [fn] ends with [nd] *)
- let ends_with nd fn =
- let nd_len =
- String.length nd
- in
- (String.length fn >= nd_len)
- &&
- (String.sub
- fn
- (String.length fn - nd_len)
- nd_len) = nd
- in
-
+
let cond_targets =
List.fold_left
(fun acc ->
@@ -5608,7 +5378,19 @@ module OCamlbuildPlugin = struct
in_build_dir_of_unix
(cs, bs, lib)
in
-
+
+ let ends_with nd fn =
+ let nd_len =
+ String.length nd
+ in
+ (String.length fn >= nd_len)
+ &&
+ (String.sub
+ fn
+ (String.length fn - nd_len)
+ nd_len) = nd
+ in
+
let tgts =
List.flatten
(List.filter
@@ -5623,7 +5405,7 @@ module OCamlbuildPlugin = struct
|| ends_with (ext_dll ()) fn))
unix_files))
in
-
+
match tgts with
| _ :: _ ->
(evs, tgts) :: acc
@@ -5632,36 +5414,7 @@ module OCamlbuildPlugin = struct
(f_ "No possible ocamlbuild targets for library %s")
cs.cs_name
end
-
- | Object (cs, bs, obj) when var_choose bs.bs_build ->
- begin
- let evs, unix_files =
- BaseBuilt.of_object
- in_build_dir_of_unix
- (cs, bs, obj)
- in
-
- let tgts =
- List.flatten
- (List.filter
- (fun l -> l <> [])
- (List.map
- (List.filter
- (fun fn ->
- ends_with ".cmo" fn
- || ends_with ".cmx" fn))
- unix_files))
- in
-
- match tgts with
- | _ :: _ ->
- (evs, tgts) :: acc
- | [] ->
- failwithf
- (f_ "No possible ocamlbuild targets for object %s")
- cs.cs_name
- end
-
+
| Executable (cs, bs, exec) when var_choose bs.bs_build ->
begin
let evs, unix_exec_is, unix_dll_opt =
@@ -5669,7 +5422,7 @@ module OCamlbuildPlugin = struct
in_build_dir_of_unix
(cs, bs, exec)
in
-
+
let target ext =
let unix_tgt =
(OASISUnixPath.concat
@@ -5689,7 +5442,7 @@ module OCamlbuildPlugin = struct
in
evs, [unix_tgt]
in
-
+
(* Add executable *)
let acc =
match bs.bs_compiled_object with
@@ -5703,15 +5456,15 @@ module OCamlbuildPlugin = struct
in
acc
end
-
- | Library _ | Object _ | Executable _ | Test _
+
+ | Library _ | Executable _ | Test _
| SrcRepo _ | Flag _ | Doc _ ->
acc)
[]
(* Keep the pkg.sections ordered *)
(List.rev pkg.sections);
in
-
+
(* Check and register built files *)
let check_and_register (bt, bnm, lst) =
List.iter
@@ -5723,12 +5476,12 @@ module OCamlbuildPlugin = struct
lst;
(BaseBuilt.register bt bnm lst)
in
-
+
let cond_targets =
(* Run the hook *)
!cond_targets_hook cond_targets
in
-
+
(* Run a list of target... *)
run_ocamlbuild
(List.flatten
@@ -5738,8 +5491,8 @@ module OCamlbuildPlugin = struct
List.iter
check_and_register
(List.flatten (List.map fst cond_targets))
-
-
+
+
let clean pkg extra_args =
run_clean extra_args;
List.iter
@@ -5752,24 +5505,24 @@ module OCamlbuildPlugin = struct
| _ ->
())
pkg.sections
-
+
end
module OCamlbuildDocPlugin = struct
-# 21 "/home/trch/software/OCaml/oasis/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml"
-
+(* # 21 "src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" *)
+
(* Create documentation using ocamlbuild .odocl files
@author Sylvain Le Gall
*)
-
+
open OASISTypes
open OASISGettext
open OASISMessage
open OCamlbuildCommon
open BaseStandardVar
-
-
-
+
+
+
let doc_build path pkg (cs, doc) argv =
let index_html =
OASISUnixPath.make
@@ -5796,15 +5549,15 @@ module OCamlbuildDocPlugin = struct
[OASISFileUtil.glob ~ctxt:!BaseContext.default
(Filename.concat tgt_dir glb)])
["*.html"; "*.css"]
-
+
let doc_clean t pkg (cs, doc) argv =
run_clean argv;
BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name
-
+
end
-# 5807 "setup.ml"
+# 5558 "setup.ml"
open OASISTypes;;
let setup_t =
@@ -5827,7 +5580,7 @@ let setup_t =
ocaml_version = None;
findlib_version = None;
name = "benchmark";
- version = "1.2";
+ version = "1.3";
license =
OASISLicense.DEP5License
(OASISLicense.DEP5Unit
@@ -5883,6 +5636,17 @@ let setup_t =
files_ab = [];
sections =
[
+ Flag
+ ({
+ cs_name = "examples";
+ cs_data = PropList.Data.create ();
+ cs_plugin_data = [];
+ },
+ {
+ flag_description =
+ Some "Whether to compile the examples.";
+ flag_default = [(OASISExpr.EBool true, false)];
+ });
Library
({
cs_name = "benchmark";
@@ -5948,7 +5712,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -5975,7 +5743,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -5998,7 +5770,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6025,7 +5801,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6052,7 +5832,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6075,7 +5859,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6098,7 +5886,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6121,7 +5913,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6149,7 +5945,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6176,7 +5976,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "examples", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples/";
bs_compiled_object = Best;
@@ -6199,7 +6003,11 @@ let setup_t =
cs_plugin_data = [];
},
{
- bs_build = [(OASISExpr.EBool true, true)];
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "tests", true)
+ ];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "tests";
bs_compiled_object = Best;
@@ -6243,8 +6051,9 @@ let setup_t =
plugin_data = [];
};
oasis_fn = Some "_oasis";
- oasis_version = "0.3.1";
- oasis_digest = Some "\178\217\221\015/\184F\194y,\022\171jh;\158";
+ oasis_version = "0.3.0";
+ oasis_digest =
+ Some "\175\132\143\187\165\140\142\184\127(9\134{\018\211s";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false;
@@ -6252,6 +6061,6 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;;
-# 6256 "setup.ml"
+# 6063 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;