Skip to content
Browse files

Regenerate _oasis files to use pcre.ml

  • Loading branch information...
1 parent e45a03d commit 06ee2ae9bf4aab2e3cc3ce4af11a70b8a4bf0ee0 @samoht committed
Showing with 2,129 additions and 1,578 deletions.
  1. +2 −2 _oasis
  2. +11 −6 _tags
  3. +28 −16 lib/META
  4. +2 −1 lib/re_perl.mllib
  5. +187 −89 myocamlbuild.ml
  6. +1,899 −1,464 setup.ml
View
4 _oasis
@@ -4,7 +4,7 @@ Version: 0.9-dev
Synopsis: Pure OCaml regular expression library
Authors: Jerome Vouillon
License: LGPL-2.0 with OCaml linking exception
-Plugins: META (0.2)
+Plugins: META (0.3)
BuildTools: ocamlbuild
Library re
@@ -47,7 +47,7 @@ Library re_glob
Library re_perl
Path: lib
- Modules: Re_perl
+ Modules: Re_perl, Pcre
XMETADescription: Perl-compatible regexps
Findlibname: perl
FindlibParent: re
View
17 _tags
@@ -1,5 +1,5 @@
# OASIS_START
-# DO NOT EDIT (digest: 6fc959993b2d88e502cb62dab425bc82)
+# DO NOT EDIT (digest: fd7b7932bedf3d73c9707b119a754fe3)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
@@ -14,16 +14,21 @@
"_darcs": -traverse
"_darcs": not_hygienic
# Library re
+"lib/re.cmxs": use_re
# Library re_emacs
+"lib/re_emacs.cmxs": use_re_emacs
# Library re_str
+"lib/re_str.cmxs": use_re_str
<lib/*.ml{,i}>: use_re_emacs
+# Library re_posix
+"lib/re_posix.cmxs": use_re_posix
+# Library re_glob
+"lib/re_glob.cmxs": use_re_glob
+# Library re_perl
+"lib/re_perl.cmxs": use_re_perl
+<lib/*.ml{,i}>: use_re
# Executable re_match
<lib_test/re_match.{native,byte}>: use_re
<lib_test/*.ml{,i}>: use_re
<lib_test/re_match.{native,byte}>: custom
-# Library re_perl
-# Library re_glob
-# Library re_posix
-"lib": include
-<lib/*.ml{,i}>: use_re
# OASIS_STOP
View
44 lib/META
@@ -1,44 +1,54 @@
# OASIS_START
-# DO NOT EDIT (digest: 74f55bd06cdf0cbca4ebdc3f647a082b)
+# DO NOT EDIT (digest: 1f20136033b003daaf1ce6b45da1b107)
version = "0.9-dev"
description = "Pure OCaml regular expression library"
archive(byte) = "re.cma"
+archive(byte, plugin) = "re.cma"
archive(native) = "re.cmxa"
+archive(native, plugin) = "re.cmxs"
exists_if = "re.cma"
+package "str" (
+ version = "0.9-dev"
+ description = "Str-compatible regexps"
+ requires = "re re.emacs"
+ archive(byte) = "re_str.cma"
+ archive(byte, plugin) = "re_str.cma"
+ archive(native) = "re_str.cmxa"
+ archive(native, plugin) = "re_str.cmxs"
+ exists_if = "re_str.cma"
+)
+
package "posix" (
version = "0.9-dev"
description = "POSIX-compatible regexps"
requires = "re"
archive(byte) = "re_posix.cma"
+ archive(byte, plugin) = "re_posix.cma"
archive(native) = "re_posix.cmxa"
+ archive(native, plugin) = "re_posix.cmxs"
exists_if = "re_posix.cma"
)
-package "glob" (
- version = "0.9-dev"
- description = "Shell glob regexps"
- requires = "re"
- archive(byte) = "re_glob.cma"
- archive(native) = "re_glob.cmxa"
- exists_if = "re_glob.cma"
-)
-
package "perl" (
version = "0.9-dev"
description = "Perl-compatible regexps"
requires = "re"
archive(byte) = "re_perl.cma"
+ archive(byte, plugin) = "re_perl.cma"
archive(native) = "re_perl.cmxa"
+ archive(native, plugin) = "re_perl.cmxs"
exists_if = "re_perl.cma"
)
-package "str" (
+package "glob" (
version = "0.9-dev"
- description = "Str-compatible regexps"
- requires = "re re.emacs"
- archive(byte) = "re_str.cma"
- archive(native) = "re_str.cmxa"
- exists_if = "re_str.cma"
+ description = "Shell glob regexps"
+ requires = "re"
+ archive(byte) = "re_glob.cma"
+ archive(byte, plugin) = "re_glob.cma"
+ archive(native) = "re_glob.cmxa"
+ archive(native, plugin) = "re_glob.cmxs"
+ exists_if = "re_glob.cma"
)
package "emacs" (
@@ -46,7 +56,9 @@ package "emacs" (
description = "Emacs-compatible regexps"
requires = "re"
archive(byte) = "re_emacs.cma"
+ archive(byte, plugin) = "re_emacs.cma"
archive(native) = "re_emacs.cmxa"
+ archive(native, plugin) = "re_emacs.cmxs"
exists_if = "re_emacs.cma"
)
# OASIS_STOP
View
3 lib/re_perl.mllib
@@ -1,4 +1,5 @@
# OASIS_START
-# DO NOT EDIT (digest: 0da0de88cc2ea375a725bb3124e688dc)
+# DO NOT EDIT (digest: 9c4058807bc11c2b01f044f01feba37f)
Re_perl
+Pcre
# OASIS_STOP
View
276 myocamlbuild.ml
@@ -1,39 +1,39 @@
(* OASIS_START *)
-(* DO NOT EDIT (digest: 6e98ce2579212be9dc796aee9bbe7a56) *)
+(* DO NOT EDIT (digest: 94614cb9a89a2927d6c5b44610770457) *)
module OASISGettext = struct
-# 21 "/Users/avsm/src/darcs/oasis/src/oasis/OASISGettext.ml"
-
+# 21 "/Users/tgazagna/src/oasis-0.3.0~rc5/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 "/Users/avsm/src/darcs/oasis/src/oasis/OASISExpr.ml"
-
-
-
+# 21 "/Users/tgazagna/src/oasis-0.3.0~rc5/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,22 +110,23 @@ module OASISExpr = struct
str_lst)
in
choose_aux (List.rev lst)
-
+
end
+# 117 "myocamlbuild.ml"
module BaseEnvLight = struct
-# 21 "/Users/avsm/src/darcs/oasis/src/base/BaseEnvLight.ml"
-
+# 21 "/Users/tgazagna/src/oasis-0.3.0~rc5/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
@@ -182,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 =
@@ -203,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)
@@ -211,9 +212,10 @@ module BaseEnvLight = struct
end
+# 215 "myocamlbuild.ml"
module MyOCamlbuildFindlib = struct
-# 21 "/Users/avsm/src/darcs/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml"
-
+# 21 "/Users/tgazagna/src/oasis-0.3.0~rc5/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
@@ -223,14 +225,14 @@ 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 x =
ref []
@@ -245,24 +247,24 @@ module MyOCamlbuildFindlib = struct
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 ->
@@ -292,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 ->
@@ -301,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
@@ -314,47 +316,58 @@ 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 "/Users/avsm/src/darcs/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
-
+# 21 "/Users/tgazagna/src/oasis-0.3.0~rc5/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
-
-# 55 "/Users/avsm/src/darcs/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
-
+
+# 56 "/Users/tgazagna/src/oasis-0.3.0~rc5/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
+
type t =
{
lib_ocaml: (name * dir list) list;
lib_c: (name * dir * file list) list;
flags: (tag list * (spec OASISExpr.choices)) list;
+ (* Replace the 'dir: include' from _tags by a precise interdepends in
+ * directory.
+ *)
+ includes: (dir * dir list) list;
}
-
+
let env_filename =
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
@@ -381,53 +394,136 @@ module MyOCamlbuildBase = struct
Options.ext_lib, "ext_lib";
Options.ext_dll, "ext_dll";
]
-
+
+ | Before_rules ->
+ (* TODO: move this into its own file and conditionnaly include it, if
+ * needed.
+ *)
+ (* OCaml cmxs rules: cmxs available in ocamlopt but not ocamlbuild.
+ Copied from ocaml_specific.ml in ocamlbuild sources. *)
+ let has_native_dynlink =
+ try
+ bool_of_string (BaseEnvLight.var_get "native_dynlink" env)
+ with Not_found ->
+ false
+ in
+ if has_native_dynlink && String.sub Sys.ocaml_version 0 4 = "3.11" then
+ begin
+ let ext_lib = !Options.ext_lib in
+ let ext_obj = !Options.ext_obj in
+ let ext_dll = !Options.ext_dll in
+ let x_o = "%"-.-ext_obj in
+ let x_a = "%"-.-ext_lib in
+ let x_dll = "%"-.-ext_dll in
+ let x_p_o = "%.p"-.-ext_obj in
+ let x_p_a = "%.p"-.-ext_lib in
+ let x_p_dll = "%.p"-.-ext_dll in
+
+ rule "ocaml: mldylib & p.cmx* & p.o* -> p.cmxs & p.so"
+ ~tags:["ocaml"; "native"; "profile"; "shared"; "library"]
+ ~prods:["%.p.cmxs"; x_p_dll]
+ ~dep:"%.mldylib"
+ (OC.native_profile_shared_library_link_mldylib
+ "%.mldylib" "%.p.cmxs");
+
+ rule "ocaml: mldylib & cmx* & o* -> cmxs & so"
+ ~tags:["ocaml"; "native"; "shared"; "library"]
+ ~prods:["%.cmxs"; x_dll]
+ ~dep:"%.mldylib"
+ (OC.native_shared_library_link_mldylib
+ "%.mldylib" "%.cmxs");
+
+ rule "ocaml: p.cmx & p.o -> p.cmxs & p.so"
+ ~tags:["ocaml"; "native"; "profile"; "shared"; "library"]
+ ~prods:["%.p.cmxs"; x_p_dll]
+ ~deps:["%.p.cmx"; x_p_o]
+ (OC.native_shared_library_link ~tags:["profile"]
+ "%.p.cmx" "%.p.cmxs");
+
+ rule "ocaml: p.cmxa & p.a -> p.cmxs & p.so"
+ ~tags:["ocaml"; "native"; "profile"; "shared"; "library"]
+ ~prods:["%.p.cmxs"; x_p_dll]
+ ~deps:["%.p.cmxa"; x_p_a]
+ (OC.native_shared_library_link ~tags:["profile"; "linkall"]
+ "%.p.cmxa" "%.p.cmxs");
+
+ rule "ocaml: cmx & o -> cmxs"
+ ~tags:["ocaml"; "native"; "shared"; "library"]
+ ~prods:["%.cmxs"]
+ ~deps:["%.cmx"; x_o]
+ (OC.native_shared_library_link "%.cmx" "%.cmxs");
+
+ rule "ocaml: cmx & o -> cmxs & so"
+ ~tags:["ocaml"; "native"; "shared"; "library"]
+ ~prods:["%.cmxs"; x_dll]
+ ~deps:["%.cmx"; x_o]
+ (OC.native_shared_library_link "%.cmx" "%.cmxs");
+
+ rule "ocaml: cmxa & a -> cmxs & so"
+ ~tags:["ocaml"; "native"; "shared"; "library"]
+ ~prods:["%.cmxs"; x_dll]
+ ~deps:["%.cmxa"; x_a]
+ (OC.native_shared_library_link ~tags:["linkall"]
+ "%.cmxa" "%.cmxs");
+ end
+
| After_rules ->
(* Declare OCaml libraries *)
List.iter
(function
- | lib, [] ->
- ocaml_lib lib;
- | lib, dir :: tl ->
- ocaml_lib ~dir:dir lib;
+ | nm, [] ->
+ ocaml_lib nm
+ | nm, dir :: tl ->
+ ocaml_lib ~dir:dir (dir^"/"^nm);
List.iter
(fun dir ->
- flag
- ["ocaml"; "use_"^lib; "compile"]
- (S[A"-I"; P dir]))
+ List.iter
+ (fun str ->
+ flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir]))
+ ["compile"; "infer_interface"; "doc"])
tl)
t.lib_ocaml;
-
+
+ (* Declare directories dependencies, replace "include" in _tags. *)
+ List.iter
+ (fun (dir, include_dirs) ->
+ Pathname.define_context dir include_dirs)
+ t.includes;
+
(* Declare C libraries *)
List.iter
(fun (lib, dir, headers) ->
(* Handle C part of library *)
- flag ["link"; "library"; "ocaml"; "byte"; "use_lib"^lib]
- (S[A"-dllib"; A("-l"^lib); A"-cclib"; A("-l"^lib)]);
-
- flag ["link"; "library"; "ocaml"; "native"; "use_lib"^lib]
- (S[A"-cclib"; A("-l"^lib)]);
+ flag ["link"; "library"; "ocaml"; "byte"; tag_libstubs lib]
+ (S[A"-dllib"; A("-l"^(nm_libstubs lib)); A"-cclib";
+ A("-l"^(nm_libstubs lib))]);
+
+ flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib]
+ (S[A"-cclib"; A("-l"^(nm_libstubs lib))]);
- flag ["link"; "program"; "ocaml"; "byte"; "use_lib"^lib]
- (S[A"-dllib"; A("dll"^lib)]);
-
+ flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib]
+ (S[A"-dllib"; A("dll"^(nm_libstubs lib))]);
+
(* When ocaml link something that use the C library, then one
need that file to be up to date.
*)
- dep ["compile"; "ocaml"; "use_lib"^lib]
- [dir/"lib"^lib^"."^(!Options.ext_lib)];
-
+ dep ["link"; "ocaml"; "program"; tag_libstubs lib]
+ [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
+
+ dep ["compile"; "ocaml"; "program"; tag_libstubs lib]
+ [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
+
(* TODO: be more specific about what depends on headers *)
(* Depends on .h files *)
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) ->
@@ -438,36 +534,38 @@ module MyOCamlbuildBase = struct
t.flags
| _ ->
()
-
+
let dispatch_default t =
dispatch_combine
[
dispatch t;
MyOCamlbuildFindlib.dispatch;
]
-
+
end
+# 548 "myocamlbuild.ml"
open Ocamlbuild_plugin;;
let package_default =
{
MyOCamlbuildBase.lib_ocaml =
[
- ("lib/re", ["lib"]);
- ("lib/re_emacs", ["lib"]);
- ("lib/re_str", ["lib"]);
- ("lib/re_perl", ["lib"]);
- ("lib/re_glob", ["lib"]);
- ("lib/re_posix", ["lib"])
+ ("re", ["lib"]);
+ ("re_emacs", ["lib"]);
+ ("re_str", ["lib"]);
+ ("re_posix", ["lib"]);
+ ("re_glob", ["lib"]);
+ ("re_perl", ["lib"])
];
lib_c = [];
flags = [];
+ includes = [("lib_test", ["lib"])];
}
;;
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
-# 472 "myocamlbuild.ml"
+# 570 "myocamlbuild.ml"
(* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;;
View
3,363 setup.ml
1,899 additions, 1,464 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 06ee2ae

Please sign in to comment.
Something went wrong with that request. Please try again.