build system

This commit is contained in:
Simon Cruanes 2014-04-09 00:22:52 +02:00
parent 10b72019d7
commit cfed1c44a9
8 changed files with 215 additions and 90 deletions

View file

@ -1,5 +1,5 @@
# OASIS_START # OASIS_START
# DO NOT EDIT (digest: 7b2408909643717852b95f994b273fee) # DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
SETUP = ocaml setup.ml SETUP = ocaml setup.ml
@ -33,6 +33,9 @@ distclean:
setup.data: setup.data:
$(SETUP) -configure $(CONFIGUREFLAGS) $(SETUP) -configure $(CONFIGUREFLAGS)
configure:
$(SETUP) -configure $(CONFIGUREFLAGS)
.PHONY: build doc test all install uninstall reinstall clean distclean configure .PHONY: build doc test all install uninstall reinstall clean distclean configure
# OASIS_STOP # OASIS_STOP

3
_oasis
View file

@ -40,7 +40,8 @@ Library "containers"
Vector, Bij, PiCalculus, Bencode, Sexp, RAL, MultiSet, Vector, Bij, PiCalculus, Bencode, Sexp, RAL, MultiSet,
UnionFind, SmallSet, Leftistheap, AbsSet, CSM, MultiMap, UnionFind, SmallSet, Leftistheap, AbsSet, CSM, MultiMap,
ActionMan, BV, QCheck, BencodeOnDisk, Show, TTree, ActionMan, BV, QCheck, BencodeOnDisk, Show, TTree,
HGraph, Automaton, Conv, Levenshtein, Bidir, Iteratee HGraph, Automaton, Conv, Levenshtein, Bidir, Iteratee,
Ty
BuildDepends: unix BuildDepends: unix
Library "containers_thread" Library "containers_thread"

3
_tags
View file

@ -1,5 +1,5 @@
# OASIS_START # OASIS_START
# DO NOT EDIT (digest: fd2094ebb8dc920dfd422597f0857b18) # DO NOT EDIT (digest: 1f820e710eb0e25ebe36cbb436da1e21)
# Ignore VCS directories, you can use the same kind of rule outside # Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains # OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process # useless stuff for the build process
@ -57,6 +57,7 @@
"levenshtein.cmx": for-pack(Containers) "levenshtein.cmx": for-pack(Containers)
"bidir.cmx": for-pack(Containers) "bidir.cmx": for-pack(Containers)
"iteratee.cmx": for-pack(Containers) "iteratee.cmx": for-pack(Containers)
"ty.cmx": for-pack(Containers)
# Library containers_thread # Library containers_thread
"threads/containers_thread.cmxs": use_containers_thread "threads/containers_thread.cmxs": use_containers_thread
<threads/*.ml{,i}>: package(threads) <threads/*.ml{,i}>: package(threads)

View file

@ -1,5 +1,5 @@
# OASIS_START # OASIS_START
# DO NOT EDIT (digest: aaae13bc67b3330cd57981dd937f5914) # DO NOT EDIT (digest: a57e9337d5ca2ca5de2c29c113a55d57)
Cache Cache
Deque Deque
Gen Gen
@ -42,4 +42,5 @@ Conv
Levenshtein Levenshtein
Bidir Bidir
Iteratee Iteratee
Ty
# OASIS_STOP # OASIS_STOP

View file

@ -1,5 +1,5 @@
# OASIS_START # OASIS_START
# DO NOT EDIT (digest: aaae13bc67b3330cd57981dd937f5914) # DO NOT EDIT (digest: a57e9337d5ca2ca5de2c29c113a55d57)
Cache Cache
Deque Deque
Gen Gen
@ -42,4 +42,5 @@ Conv
Levenshtein Levenshtein
Bidir Bidir
Iteratee Iteratee
Ty
# OASIS_STOP # OASIS_STOP

View file

@ -164,10 +164,14 @@ module type S = sig
end end
end end
(** {2 Functor} *)
module Make(Str : STRING) : S module Make(Str : STRING) : S
with type string_ = Str.t with type string_ = Str.t
and type char_ = Str.char_ and type char_ = Str.char_
(** {2 Default instance: string} *)
include S with type char_ = char and type string_ = string include S with type char_ = char and type string_ = string
val debug_print : out_channel -> automaton -> unit val debug_print : out_channel -> automaton -> unit

View file

@ -1,5 +1,5 @@
(* OASIS_START *) (* OASIS_START *)
(* DO NOT EDIT (digest: 5aa8431a34ac4b8eb107bbd4e50b9c49) *) (* DO NOT EDIT (digest: d29ffdfaf6a1a8b5374c77f1680535e9) *)
module OASISGettext = struct module OASISGettext = struct
(* # 22 "src/oasis/OASISGettext.ml" *) (* # 22 "src/oasis/OASISGettext.ml" *)
@ -259,6 +259,31 @@ module MyOCamlbuildFindlib = struct
Ocamlbuild_pack.Lexers.blank_sep_strings Ocamlbuild_pack.Lexers.blank_sep_strings
let exec_from_conf exec =
let exec =
let env_filename = Pathname.basename BaseEnvLight.default_filename in
let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in
try
BaseEnvLight.var_get exec env
with Not_found ->
Printf.eprintf "W: Cannot get variable %s\n" exec;
exec
in
let fix_win32 str =
if Sys.os_type = "Win32" then begin
let buff = Buffer.create (String.length str) in
(* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'.
*)
String.iter
(fun c -> Buffer.add_char buff (if c = '\\' then '/' else c))
str;
Buffer.contents buff
end else begin
str
end
in
fix_win32 exec
let split s ch = let split s ch =
let buf = Buffer.create 13 in let buf = Buffer.create 13 in
let x = ref [] in let x = ref [] in
@ -286,17 +311,7 @@ module MyOCamlbuildFindlib = struct
with Not_found -> s with Not_found -> s
(* ocamlfind command *) (* ocamlfind command *)
let ocamlfind x = let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x]
let ocamlfind_prog =
let env_filename = Pathname.basename BaseEnvLight.default_filename in
let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in
try
BaseEnvLight.var_get "ocamlfind" env
with Not_found ->
Printf.eprintf "W: Cannot get variable ocamlfind";
"ocamlfind"
in
S[Sh ocamlfind_prog; x]
(* This lists all supported packages. *) (* This lists all supported packages. *)
let find_packages () = let find_packages () =
@ -325,7 +340,7 @@ module MyOCamlbuildFindlib = struct
let dispatch = let dispatch =
function function
| Before_options -> | After_options ->
(* By using Before_options one let command line options have an higher (* By using Before_options one let command line options have an higher
* priority on the contrary using After_options will guarantee to have * priority on the contrary using After_options will guarantee to have
* the higher priority override default commands by ocamlfind ones *) * the higher priority override default commands by ocamlfind ones *)
@ -476,7 +491,7 @@ module MyOCamlbuildBase = struct
try try
opt := no_trailing_dot (BaseEnvLight.var_get var env) opt := no_trailing_dot (BaseEnvLight.var_get var env)
with Not_found -> with Not_found ->
Printf.eprintf "W: Cannot get variable %s" var) Printf.eprintf "W: Cannot get variable %s\n" var)
[ [
Options.ext_obj, "ext_obj"; Options.ext_obj, "ext_obj";
Options.ext_lib, "ext_lib"; Options.ext_lib, "ext_lib";
@ -576,7 +591,7 @@ module MyOCamlbuildBase = struct
end end
# 579 "myocamlbuild.ml" # 594 "myocamlbuild.ml"
open Ocamlbuild_plugin;; open Ocamlbuild_plugin;;
let package_default = let package_default =
{ {
@ -595,6 +610,6 @@ let package_default =
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
# 599 "myocamlbuild.ml" # 614 "myocamlbuild.ml"
(* OASIS_STOP *) (* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;; Ocamlbuild_plugin.dispatch dispatch_default;;

237
setup.ml
View file

@ -1,9 +1,9 @@
(* setup.ml generated for the first time by OASIS v0.3.0 *) (* setup.ml generated for the first time by OASIS v0.3.0 *)
(* OASIS_START *) (* OASIS_START *)
(* DO NOT EDIT (digest: ab136fb2303cc599d52ecdf4cdcf9067) *) (* DO NOT EDIT (digest: 607ac444249450197cccc8d204000609) *)
(* (*
Regenerated by OASIS v0.4.2 Regenerated by OASIS v0.4.4
Visit http://oasis.forge.ocamlcore.org for more information and Visit http://oasis.forge.ocamlcore.org for more information and
documentation about functions used in this file. documentation about functions used in this file.
*) *)
@ -258,29 +258,62 @@ module OASISUtils = struct
open OASISGettext open OASISGettext
module MapString = Map.Make(String) module MapExt =
struct
module type S =
sig
include Map.S
val add_list: 'a t -> (key * 'a) list -> 'a t
val of_list: (key * 'a) list -> 'a t
val to_list: 'a t -> (key * 'a) list
end
module Make (Ord: Map.OrderedType) =
struct
include Map.Make(Ord)
let rec add_list t =
function
| (k, v) :: tl -> add_list (add k v t) tl
| [] -> t
let of_list lst = add_list empty lst
let to_list t = fold (fun k v acc -> (k, v) :: acc) t []
end
end
let map_string_of_assoc assoc = module MapString = MapExt.Make(String)
List.fold_left
(fun acc (k, v) -> MapString.add k v acc)
MapString.empty
assoc
module SetString = Set.Make(String) module SetExt =
struct
module type S =
sig
include Set.S
val add_list: t -> elt list -> t
val of_list: elt list -> t
val to_list: t -> elt list
end
module Make (Ord: Set.OrderedType) =
struct
include Set.Make(Ord)
let rec add_list t =
function
| e :: tl -> add_list (add e t) tl
| [] -> t
let of_list lst = add_list empty lst
let to_list = elements
end
end
let set_string_add_list st lst = module SetString = SetExt.Make(String)
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 = let compare_csl s1 s2 =
@ -300,7 +333,7 @@ module OASISUtils = struct
end) end)
module SetStringCsl = module SetStringCsl =
Set.Make SetExt.Make
(struct (struct
type t = string type t = string
let compare = compare_csl let compare = compare_csl
@ -1047,6 +1080,21 @@ module OASISExpr = struct
end end
module OASISText = struct
(* # 22 "src/oasis/OASISText.ml" *)
type elt =
| Para of string
| Verbatim of string
| BlankLine
type t = elt list
end
module OASISTypes = struct module OASISTypes = struct
(* # 22 "src/oasis/OASISTypes.ml" *) (* # 22 "src/oasis/OASISTypes.ml" *)
@ -1279,41 +1327,42 @@ module OASISTypes = struct
type package = type package =
{ {
oasis_version: OASISVersion.t; oasis_version: OASISVersion.t;
ocaml_version: OASISVersion.comparator option; ocaml_version: OASISVersion.comparator option;
findlib_version: OASISVersion.comparator option; findlib_version: OASISVersion.comparator option;
alpha_features: string list; alpha_features: string list;
beta_features: string list; beta_features: string list;
name: package_name; name: package_name;
version: OASISVersion.t; version: OASISVersion.t;
license: OASISLicense.t; license: OASISLicense.t;
license_file: unix_filename option; license_file: unix_filename option;
copyrights: string list; copyrights: string list;
maintainers: string list; maintainers: string list;
authors: string list; authors: string list;
homepage: url option; homepage: url option;
synopsis: string; synopsis: string;
description: string option; description: OASISText.t option;
categories: url list; categories: url list;
conf_type: [`Configure] plugin; conf_type: [`Configure] plugin;
conf_custom: custom; conf_custom: custom;
build_type: [`Build] plugin; build_type: [`Build] plugin;
build_custom: custom; build_custom: custom;
install_type: [`Install] plugin; install_type: [`Install] plugin;
install_custom: custom; install_custom: custom;
uninstall_custom: custom; uninstall_custom: custom;
clean_custom: custom; clean_custom: custom;
distclean_custom: custom; distclean_custom: custom;
files_ab: unix_filename list; files_ab: unix_filename list;
sections: section list; sections: section list;
plugins: [`Extra] plugin list; plugins: [`Extra] plugin list;
schema_data: PropList.Data.t; disable_oasis_section: unix_filename list;
plugin_data: plugin_data; schema_data: PropList.Data.t;
plugin_data: plugin_data;
} }
@ -1367,6 +1416,24 @@ module OASISFeatures = struct
let plugin_version plugin_kind plugin_name t = let plugin_version plugin_kind plugin_name t =
MapPlugin.find (plugin_kind, plugin_name) t.plugin_versions MapPlugin.find (plugin_kind, plugin_name) t.plugin_versions
let to_string t =
Printf.sprintf
"oasis_version: %s; alpha_features: %s; beta_features: %s; \
plugins_version: %s"
(OASISVersion.string_of_version t.oasis_version)
(String.concat ", " t.alpha_features)
(String.concat ", " t.beta_features)
(String.concat ", "
(MapPlugin.fold
(fun (_, plg) ver_opt acc ->
(plg^
(match ver_opt with
| Some v ->
" "^(OASISVersion.string_of_version v)
| None -> ""))
:: acc)
t.plugin_versions []))
end end
type origin = type origin =
@ -1407,6 +1474,17 @@ module OASISFeatures = struct
let beta = InDev Beta let beta = InDev Beta
let to_string t =
Printf.sprintf
"feature: %s; plugin: %s; publication: %s"
t.name
(match t.plugin with
| None -> "<none>"
| Some (_, nm, _) -> nm)
(match t.publication with
| InDev stage -> string_of_stage stage
| SinceVersion ver -> ">= "^(OASISVersion.string_of_version ver))
let data_check t data origin = let data_check t data origin =
let no_message = "no message" in let no_message = "no message" in
@ -1639,6 +1717,18 @@ module OASISFeatures = struct
create "dynrun_for_release" alpha create "dynrun_for_release" alpha
(fun () -> (fun () ->
s_ "Make '-setup-update dynamic' suitable for releasing project.") s_ "Make '-setup-update dynamic' suitable for releasing project.")
let compiled_setup_ml =
create "compiled_setup_ml" alpha
(fun () ->
s_ "It compiles the setup.ml and speed-up actions done with it.")
let disable_oasis_section =
create "disable_oasis_section" alpha
(fun () ->
s_ "Allows the OASIS section comments and digest to be omitted in \
generated files.")
end end
module OASISUnixPath = struct module OASISUnixPath = struct
@ -2727,14 +2817,17 @@ module OASISFileUtil = struct
let rmdir ~ctxt tgt = let rmdir ~ctxt tgt =
if Sys.readdir tgt = [||] then if Sys.readdir tgt = [||] then begin
begin match Sys.os_type with
match Sys.os_type with | "Win32" ->
| "Win32" -> OASISExec.run ~ctxt "rd" [q tgt]
OASISExec.run ~ctxt "rd" [q tgt] | _ ->
| _ -> OASISExec.run ~ctxt "rm" ["-r"; q tgt]
OASISExec.run ~ctxt "rm" ["-r"; q tgt] end else begin
end OASISMessage.error ~ctxt
(f_ "Cannot remove directory '%s': not empty.")
tgt
end
let glob ~ctxt fn = let glob ~ctxt fn =
@ -2782,7 +2875,7 @@ module OASISFileUtil = struct
end end
# 2785 "setup.ml" # 2878 "setup.ml"
module BaseEnvLight = struct module BaseEnvLight = struct
(* # 22 "src/base/BaseEnvLight.ml" *) (* # 22 "src/base/BaseEnvLight.ml" *)
@ -2887,7 +2980,7 @@ module BaseEnvLight = struct
end end
# 2890 "setup.ml" # 2983 "setup.ml"
module BaseContext = struct module BaseContext = struct
(* # 22 "src/base/BaseContext.ml" *) (* # 22 "src/base/BaseContext.ml" *)
@ -5298,7 +5391,7 @@ module BaseSetup = struct
end end
# 5301 "setup.ml" # 5394 "setup.ml"
module InternalConfigurePlugin = struct module InternalConfigurePlugin = struct
(* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *) (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
@ -6147,7 +6240,7 @@ module InternalInstallPlugin = struct
end end
# 6150 "setup.ml" # 6243 "setup.ml"
module OCamlbuildCommon = struct module OCamlbuildCommon = struct
(* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *) (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
@ -6520,7 +6613,7 @@ module OCamlbuildDocPlugin = struct
end end
# 6523 "setup.ml" # 6616 "setup.ml"
module CustomPlugin = struct module CustomPlugin = struct
(* # 22 "src/plugins/custom/CustomPlugin.ml" *) (* # 22 "src/plugins/custom/CustomPlugin.ml" *)
@ -6668,7 +6761,7 @@ module CustomPlugin = struct
end end
# 6671 "setup.ml" # 6764 "setup.ml"
open OASISTypes;; open OASISTypes;;
let setup_t = let setup_t =
@ -6756,7 +6849,10 @@ let setup_t =
synopsis = "A bunch of modules, including polymorphic containers."; synopsis = "A bunch of modules, including polymorphic containers.";
description = description =
Some Some
"A bunch of useful modules, including polymorphic containers, graph\nabstractions, serialization systems, testing systems and various\nexperiments."; [
OASISText.Para
"A bunch of useful modules, including polymorphic containers, graph abstractions, serialization systems, testing systems and various experiments."
];
categories = []; categories = [];
conf_type = (`Configure, "internal", Some "0.4"); conf_type = (`Configure, "internal", Some "0.4");
conf_custom = conf_custom =
@ -6904,7 +7000,8 @@ let setup_t =
"Conv"; "Conv";
"Levenshtein"; "Levenshtein";
"Bidir"; "Bidir";
"Iteratee" "Iteratee";
"Ty"
]; ];
lib_pack = true; lib_pack = true;
lib_internal_modules = []; lib_internal_modules = [];
@ -7285,12 +7382,14 @@ let setup_t =
]; ];
plugins = plugins =
[(`Extra, "META", Some "0.3"); (`Extra, "DevFiles", Some "0.3")]; [(`Extra, "META", Some "0.3"); (`Extra, "DevFiles", Some "0.3")];
disable_oasis_section = [];
schema_data = PropList.Data.create (); schema_data = PropList.Data.create ();
plugin_data = [] plugin_data = []
}; };
oasis_fn = Some "_oasis"; oasis_fn = Some "_oasis";
oasis_version = "0.4.2"; oasis_version = "0.4.4";
oasis_digest = Some "[\227\135\169\022E\142\218xei\139\218Ha\163"; oasis_digest =
Some "\234\208\170\146/\020\006\020k\186\024\145\237\193\148\145";
oasis_exec = None; oasis_exec = None;
oasis_setup_args = []; oasis_setup_args = [];
setup_update = false setup_update = false
@ -7298,6 +7397,6 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;; let setup () = BaseSetup.setup setup_t;;
# 7302 "setup.ml" # 7401 "setup.ml"
(* OASIS_STOP *) (* OASIS_STOP *)
let () = setup ();; let () = setup ();;