Commits

"Jun...@gmail.com>"  committed 07cd1fe

setup

  • Participants
  • Parent commits 2b1c094
  • Tags 1.1.4

Comments (0)

Files changed (1)

 (* setup.ml generated for the first time by OASIS v0.3.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 9c5877b710b8853f7e92b0591b0f45b0) *)
+(* DO NOT EDIT (digest: 8f257e15f898aa00e34d7633dad0add5) *)
 (*
-   Regenerated by OASIS v0.4.1
+   Regenerated by OASIS v0.4.4
    Visit http://oasis.forge.ocamlcore.org for more information and
    documentation about functions used in this file.
 *)
 
   type t =
     {
+      (* TODO: replace this by a proplist. *)
       quiet:                 bool;
       info:                  bool;
       debug:                 bool;
     {!default with quiet = true}
 
 
-  let args () =
+  let fspecs () =
+    (* TODO: don't act on default. *)
+    let ignore_plugins = ref false in
     ["-quiet",
      Arg.Unit (fun () -> default := {!default with quiet = true}),
-     (s_ " Run quietly");
+     s_ " Run quietly";
 
      "-info",
      Arg.Unit (fun () -> default := {!default with info = true}),
-     (s_ " Display information message");
+     s_ " Display information message";
 
 
      "-debug",
      Arg.Unit (fun () -> default := {!default with debug = true}),
-     (s_ " Output debug message")]
+     s_ " Output debug message";
+
+     "-ignore-plugins",
+     Arg.Set ignore_plugins,
+     s_ " Ignore plugin's field.";
+
+     "-C",
+     (* TODO: remove this chdir. *)
+     Arg.String (fun str -> Sys.chdir str),
+     s_ "dir Change directory before running."],
+    fun () -> {!default with ignore_plugins = !ignore_plugins}
 end
 
 module OASISString = struct
   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
+  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
+
+
+  module MapString = MapExt.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
+
+
+  module SetString = SetExt.Make(String)
 
 
   let compare_csl s1 s2 =
            Hashtbl.hash (String.lowercase s)
        end)
 
+  module SetStringCsl =
+    SetExt.Make
+      (struct
+         type t = string
+         let compare = compare_csl
+       end)
+
 
   let varname_of_string ?(hyphen='_') s =
     if String.length s = 0 then
   type s = string
 
 
-  type t = string 
+  type t = string
 
 
   type comparator =
     | VLesserEqual of t
     | VOr of  comparator * comparator
     | VAnd of comparator * comparator
-    
+
 
 
   (* Range of allowed characters *)
 
 
 
-  type license = string 
-
-
-  type license_exception = string 
+  type license = string
+
+
+  type license_exception = string
 
 
   type license_version =
     | Version of OASISVersion.t
     | VersionOrLater of OASISVersion.t
     | NoVersion
-    
+
 
 
   type license_dep_5_unit =
       excption:  license_exception option;
       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
   open OASISGettext
 
 
-  type test = string 
-
-
-  type flag = string 
+  type test = string
+
+
+  type flag = string
 
 
   type t =
     | EOr of t * t
     | EFlag of flag
     | ETest of test * string
-    
-
-
-  type 'a choices = (t * 'a) list 
+
+
+
+  type 'a choices = (t * 'a) list
 
 
   let eval var_get t =
 
 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
 (* # 22 "src/oasis/OASISTypes.ml" *)
 
 
 
 
-  type name          = string 
-  type package_name  = string 
-  type url           = string 
-  type unix_dirname  = string 
-  type unix_filename = string 
-  type host_dirname  = string 
-  type host_filename = string 
-  type prog          = string 
-  type arg           = string 
-  type args          = string list 
-  type command_line  = (prog * arg list) 
-
-
-  type findlib_name = string 
-  type findlib_full = string 
+  type name          = string
+  type package_name  = string
+  type url           = string
+  type unix_dirname  = string
+  type unix_filename = string
+  type host_dirname  = string
+  type host_filename = string
+  type prog          = string
+  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 =
     | Arch
     | Monotone
     | OtherVCS of url
-    
+
 
 
   type plugin_kind =
       ]
 
 
-  type 'a plugin = 'a * name * OASISVersion.t option 
+  type 'a plugin = 'a * name * OASISVersion.t option
 
 
   type all_plugin = plugin_kind plugin
 (* # 115 "src/oasis/OASISTypes.ml" *)
 
 
-  type 'a conditional = 'a OASISExpr.choices 
+  type 'a conditional = 'a OASISExpr.choices
 
 
   type custom =
         pre_command:  (command_line option) conditional;
         post_command: (command_line option) conditional;
       }
-      
+
 
 
   type common_section =
         cs_data: PropList.Data.t;
         cs_plugin_data: plugin_data;
       }
-      
+
 
 
   type build_section =
         bs_byteopt:         args conditional;
         bs_nativeopt:       args conditional;
       }
-      
+
 
 
   type library =
         lib_findlib_parent:     findlib_name option;
         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_branch:      string option;
         src_repo_tag:         string option;
         src_repo_subdir:      unix_filename option;
-      } 
+      }
 
 
   type test =
         test_working_directory:  unix_filename option;
         test_run:                bool conditional;
         test_tools:              tool list;
-      } 
+      }
 
 
   type doc_format =
     | Info of unix_filename
     | DVI
     | OtherDoc
-    
+
 
 
   type doc =
         doc_format:      doc_format;
         doc_data_files:  (unix_filename * unix_filename option) list;
         doc_build_tools: tool list;
-      } 
+      }
 
 
   type section =
     | SrcRepo    of common_section * source_repository
     | Test       of common_section * test
     | Doc        of common_section * doc
-    
+
 
 
   type section_kind =
 
   type package =
       {
-        oasis_version:    OASISVersion.t;
-        ocaml_version:    OASISVersion.comparator option;
-        findlib_version:  OASISVersion.comparator option;
-        alpha_features:   string list;
-        beta_features:    string list;
-        name:             package_name;
-        version:          OASISVersion.t;
-        license:          OASISLicense.t;
-        license_file:     unix_filename option;
-        copyrights:       string list;
-        maintainers:      string list;
-        authors:          string list;
-        homepage:         url option;
-        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;
-      } 
+        oasis_version:          OASISVersion.t;
+        ocaml_version:          OASISVersion.comparator option;
+        findlib_version:        OASISVersion.comparator option;
+        alpha_features:         string list;
+        beta_features:          string list;
+        name:                   package_name;
+        version:                OASISVersion.t;
+        license:                OASISLicense.t;
+        license_file:           unix_filename option;
+        copyrights:             string list;
+        maintainers:            string list;
+        authors:                string list;
+        homepage:               url option;
+        synopsis:               string;
+        description:            OASISText.t 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;
+        disable_oasis_section:  unix_filename list;
+        schema_data:            PropList.Data.t;
+        plugin_data:            plugin_data;
+      }
 
 
 end
 
     let plugin_version plugin_kind plugin_name t =
       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
 
   type origin =
   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 no_message = "no message" in
 
     create "dynrun_for_release" alpha
       (fun () ->
          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
 
 module OASISUnixPath = struct
 
 
   let rmdir ~ctxt tgt =
-    if Sys.readdir tgt = [||] then
-      begin
-        match Sys.os_type with
-          | "Win32" ->
-              OASISExec.run ~ctxt "rd" [q tgt]
-          | _ ->
-              OASISExec.run ~ctxt "rm" ["-r"; q tgt]
-      end
+    if Sys.readdir tgt = [||] then begin
+      match Sys.os_type with
+        | "Win32" ->
+            OASISExec.run ~ctxt "rd" [q tgt]
+        | _ ->
+            OASISExec.run ~ctxt "rm" ["-r"; q tgt]
+    end else begin
+      OASISMessage.error ~ctxt
+        (f_ "Cannot remove directory '%s': not empty.")
+        tgt
+    end
 
 
   let glob ~ctxt fn =
 end
 
 
-# 2766 "setup.ml"
+# 2878 "setup.ml"
 module BaseEnvLight = struct
 (* # 22 "src/base/BaseEnvLight.ml" *)
 
       end
 
 
+  let rec var_expand str env =
+    let buff =
+      Buffer.create ((String.length str) * 2)
+    in
+      Buffer.add_substitute
+        buff
+        (fun var ->
+           try
+             var_expand (MapString.find var env) env
+           with Not_found ->
+             failwith
+               (Printf.sprintf
+                  "No variable %s defined when trying to expand %S."
+                  var
+                  str))
+        str;
+      Buffer.contents buff
+
+
   let var_get name env =
-    let rec var_expand str =
-      let buff =
-        Buffer.create ((String.length str) * 2)
-      in
-        Buffer.add_substitute
-          buff
-          (fun var ->
-             try
-               var_expand (MapString.find var env)
-             with Not_found ->
-               failwith
-                 (Printf.sprintf
-                    "No variable %s defined when trying to expand %S."
-                    var
-                    str))
-          str;
-        Buffer.contents buff
-    in
-      var_expand (MapString.find name env)
+    var_expand (MapString.find name env) env
 
 
   let var_choose lst env =
 end
 
 
-# 2870 "setup.ml"
+# 2983 "setup.ml"
 module BaseContext = struct
 (* # 22 "src/base/BaseContext.ml" *)
 
-
+  (* TODO: get rid of this module. *)
   open OASISContext
 
 
-  let args = args
+  let args () = fst (fspecs ())
 
 
   let default = default
        s_ " Don't try to update setup.ml, even if _oasis has changed.")
 
 
+  let default_oasis_fn = "_oasis"
+
+
   let update_setup_ml t =
     let oasis_fn =
       match t.oasis_fn with
         | Some fn -> fn
-        | None -> "_oasis"
+        | None -> default_oasis_fn
     in
     let oasis_exec =
       match t.oasis_exec with
         try
           match t.oasis_digest with
             | Some dgst ->
-              if Sys.file_exists oasis_fn && dgst <> Digest.file "_oasis" then
+              if Sys.file_exists oasis_fn &&
+                 dgst <> Digest.file default_oasis_fn then
                 begin
                   do_update ();
                   true
 end
 
 
-# 5277 "setup.ml"
+# 5394 "setup.ml"
 module InternalConfigurePlugin = struct
 (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
 
 end
 
 
-# 6126 "setup.ml"
+# 6243 "setup.ml"
 module CustomPlugin = struct
 (* # 22 "src/plugins/custom/CustomPlugin.ml" *)
 
         cmd_main:      command_line conditional;
         cmd_clean:     (command_line option) conditional;
         cmd_distclean: (command_line option) conditional;
-      } 
+      }
 
 
   let run  = BaseCustom.run
 end
 
 
-# 6274 "setup.ml"
+# 6391 "setup.ml"
 open OASISTypes;;
 
 let setup_t =
             cmd_clean =
               [
                  (OASISExpr.EBool true,
-                   Some (("PREFIX=$prefix", ["omake"; "clean"])))
+                   Some
+                     (("cp",
+                        [
+                           "OMakeroot.in";
+                           "OMakeroot;";
+                           "PREFIX=$prefix";
+                           "omake";
+                           "clean"
+                        ])))
               ];
             cmd_distclean = [(OASISExpr.EBool true, None)]
          };
             CustomPlugin.cmd_main =
               [
                  (OASISExpr.EBool true,
-                   ("PREFIX=$prefix", ["omake"; "install"]))
+                   ("cp",
+                     [
+                        "OMakeroot.in";
+                        "OMakeroot;";
+                        "PREFIX=$prefix";
+                        "omake";
+                        "install"
+                     ]))
               ];
             cmd_clean = [(OASISExpr.EBool true, None)];
             cmd_distclean = [(OASISExpr.EBool true, None)]
             CustomPlugin.cmd_main =
               [
                  (OASISExpr.EBool true,
-                   ("PREFIX=$prefix", ["omake"; "uninstall"]))
+                   ("cp",
+                     [
+                        "OMakeroot.in";
+                        "OMakeroot;";
+                        "PREFIX=$prefix";
+                        "omake";
+                        "uninstall"
+                     ]))
               ];
             cmd_clean = [(OASISExpr.EBool true, None)];
             cmd_distclean = [(OASISExpr.EBool true, None)]
                cmd_clean =
                  [
                     (OASISExpr.EBool true,
-                      Some (("PREFIX=$prefix", ["omake"; "clean"])))
+                      Some
+                        (("cp",
+                           [
+                              "OMakeroot.in";
+                              "OMakeroot;";
+                              "PREFIX=$prefix";
+                              "omake";
+                              "clean"
+                           ])))
                  ];
                cmd_distclean = [(OASISExpr.EBool true, None)]
             };
                CustomPlugin.cmd_main =
                  [
                     (OASISExpr.EBool true,
-                      ("PREFIX=$prefix", ["omake"; "install"]))
+                      ("cp",
+                        [
+                           "OMakeroot.in";
+                           "OMakeroot;";
+                           "PREFIX=$prefix";
+                           "omake";
+                           "install"
+                        ]))
                  ];
                cmd_clean = [(OASISExpr.EBool true, None)];
                cmd_distclean = [(OASISExpr.EBool true, None)]
                CustomPlugin.cmd_main =
                  [
                     (OASISExpr.EBool true,
-                      ("PREFIX=$prefix", ["omake"; "uninstall"]))
+                      ("cp",
+                        [
+                           "OMakeroot.in";
+                           "OMakeroot;";
+                           "PREFIX=$prefix";
+                           "omake";
+                           "uninstall"
+                        ]))
                  ];
                cmd_clean = [(OASISExpr.EBool true, None)];
                cmd_distclean = [(OASISExpr.EBool true, None)]
                cmd_clean =
                  [
                     (OASISExpr.EBool true,
-                      Some (("PREFIX=$prefix", ["omake"; "clean"])))
+                      Some
+                        (("cp",
+                           [
+                              "OMakeroot.in";
+                              "OMakeroot;";
+                              "PREFIX=$prefix";
+                              "omake";
+                              "clean"
+                           ])))
                  ];
                cmd_distclean = [(OASISExpr.EBool true, None)]
             };
                CustomPlugin.cmd_main =
                  [
                     (OASISExpr.EBool true,
-                      ("PREFIX=$prefix", ["omake"; "install"]))
+                      ("cp",
+                        [
+                           "OMakeroot.in";
+                           "OMakeroot;";
+                           "PREFIX=$prefix";
+                           "omake";
+                           "install"
+                        ]))
                  ];
                cmd_clean = [(OASISExpr.EBool true, None)];
                cmd_distclean = [(OASISExpr.EBool true, None)]
                CustomPlugin.cmd_main =
                  [
                     (OASISExpr.EBool true,
-                      ("PREFIX=$prefix", ["omake"; "uninstall"]))
+                      ("cp",
+                        [
+                           "OMakeroot.in";
+                           "OMakeroot;";
+                           "PREFIX=$prefix";
+                           "omake";
+                           "uninstall"
+                        ]))
                  ];
                cmd_clean = [(OASISExpr.EBool true, None)];
                cmd_distclean = [(OASISExpr.EBool true, None)]
           files_ab = [];
           sections = [];
           plugins = [(`Extra, "StdFiles", Some "0.2")];
+          disable_oasis_section = [];
           schema_data = PropList.Data.create ();
           plugin_data = []
        };
      oasis_fn = Some "_oasis";
-     oasis_version = "0.4.1";
-     oasis_digest = Some "\186\132\165\215\240+\007\179>\135Lg#QO\216";
+     oasis_version = "0.4.4";
+     oasis_digest = Some "\027~\n \159r`q&8p\027\141�u\146";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 6486 "setup.ml"
+# 6670 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;