From d3d926ada79b98c1164a09ad13ac199b9aeab6e5 Mon Sep 17 00:00:00 2001 From: Spiros Eliopoulos Date: Mon, 8 Dec 2014 11:27:40 -0500 Subject: [PATCH] v0.7.0 --- _oasis | 2 +- _tags | 147 ++++++++++++++++++------------------- lib/META | 8 +- myocamlbuild.ml | 88 ++++++++++++---------- setup.ml | 189 ++++++++++++++++++++++++++++-------------------- 5 files changed, 242 insertions(+), 192 deletions(-) diff --git a/_oasis b/_oasis index 1f3930e..d572ef8 100644 --- a/_oasis +++ b/_oasis @@ -1,7 +1,7 @@ OASISFormat: 0.3 OCamlVersion: >= 4.01.0 Name: openflow -Version: 0.6.2 +Version: 0.7.0 Synopsis: Serialization library for OpenFlow Authors: https://github.com/frenetic-lang/ocaml-openflow/contributors License: LGPL diff --git a/_tags b/_tags index e099117..980b20a 100644 --- a/_tags +++ b/_tags @@ -1,8 +1,9 @@ # OASIS_START -# DO NOT EDIT (digest: e841dae195b3a4dde01d54b7e83088dd) +# DO NOT EDIT (digest: c549d3b3eb1ea3a63e2936cb07d78beb) # 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 +true: annot, bin_annot <**/.svn>: -traverse <**/.svn>: not_hygienic ".bzr": -traverse @@ -15,40 +16,40 @@ "_darcs": not_hygienic # Library openflow "lib/openflow.cmxs": use_openflow -: package(core) -: package(cstruct) -: package(cstruct.syntax) -: package(packet) -: package(sexplib) -: package(sexplib.syntax) -: package(str) -: package(threads) +: package(core) +: package(cstruct) +: package(cstruct.syntax) +: package(packet) +: package(sexplib) +: package(sexplib.syntax) +: package(str) +: package(threads) # Library async "async/async.cmxs": use_async -: package(async) -: package(core) -: package(cstruct) -: package(cstruct.async) -: package(cstruct.syntax) -: package(packet) -: package(sexplib) -: package(sexplib.syntax) -: package(str) -: package(threads) -: use_openflow +: package(async) +: package(core) +: package(cstruct) +: package(cstruct.async) +: package(cstruct.syntax) +: package(packet) +: package(sexplib) +: package(sexplib.syntax) +: package(str) +: package(threads) +: use_openflow # Library quickcheck "quickcheck/quickcheck.cmxs": use_quickcheck -: package(core) -: package(cstruct) -: package(cstruct.syntax) -: package(packet) -: package(packet.quickcheck) -: package(quickcheck) -: package(sexplib) -: package(sexplib.syntax) -: package(str) -: package(threads) -: use_openflow +: package(core) +: package(cstruct) +: package(cstruct.syntax) +: package(packet) +: package(packet.quickcheck) +: package(quickcheck) +: package(sexplib) +: package(sexplib.syntax) +: package(str) +: package(threads) +: use_openflow # Executable testtool "test/Test.byte": package(core) "test/Test.byte": package(cstruct) @@ -65,21 +66,21 @@ "test/Test.byte": package(threads) "test/Test.byte": use_openflow "test/Test.byte": use_quickcheck -: package(core) -: package(cstruct) -: package(cstruct.syntax) -: package(oUnit) -: package(pa_ounit) -: package(pa_ounit.syntax) -: package(packet) -: package(packet.quickcheck) -: package(quickcheck) -: package(sexplib) -: package(sexplib.syntax) -: package(str) -: package(threads) -: use_openflow -: use_quickcheck +: package(core) +: package(cstruct) +: package(cstruct.syntax) +: package(oUnit) +: package(pa_ounit) +: package(pa_ounit.syntax) +: package(packet) +: package(packet.quickcheck) +: package(quickcheck) +: package(sexplib) +: package(sexplib.syntax) +: package(str) +: package(threads) +: use_openflow +: use_quickcheck # Executable ping_test "ping-test/PingTest.byte": package(async) "ping-test/PingTest.byte": package(core) @@ -96,21 +97,21 @@ "ping-test/PingTest.byte": package(threads) "ping-test/PingTest.byte": use_async "ping-test/PingTest.byte": use_openflow -: package(async) -: package(core) -: package(cstruct) -: package(cstruct.async) -: package(cstruct.syntax) -: package(oUnit) -: package(pa_ounit) -: package(pa_ounit.syntax) -: package(packet) -: package(sexplib) -: package(sexplib.syntax) -: package(str) -: package(threads) -: use_async -: use_openflow +: package(async) +: package(core) +: package(cstruct) +: package(cstruct.async) +: package(cstruct.syntax) +: package(oUnit) +: package(pa_ounit) +: package(pa_ounit.syntax) +: package(packet) +: package(sexplib) +: package(sexplib.syntax) +: package(str) +: package(threads) +: use_async +: use_openflow # Executable learning_switch "examples/Learning_Switch.byte": package(async) "examples/Learning_Switch.byte": package(core) @@ -137,18 +138,18 @@ "examples/Learning_Switch0x04.byte": package(threads) "examples/Learning_Switch0x04.byte": use_async "examples/Learning_Switch0x04.byte": use_openflow -: package(async) -: package(core) -: package(cstruct) -: package(cstruct.async) -: package(cstruct.syntax) -: package(packet) -: package(sexplib) -: package(sexplib.syntax) -: package(str) -: package(threads) -: use_async -: use_openflow +: package(async) +: package(core) +: package(cstruct) +: package(cstruct.async) +: package(cstruct.syntax) +: package(packet) +: package(sexplib) +: package(sexplib.syntax) +: package(str) +: package(threads) +: use_async +: use_openflow # OASIS_STOP : syntax_camlp4o : syntax_camlp4o diff --git a/lib/META b/lib/META index 3b70c69..35e3c39 100644 --- a/lib/META +++ b/lib/META @@ -1,6 +1,6 @@ # OASIS_START -# DO NOT EDIT (digest: 03c6aa4eb5311c099a1fb8ca2157a81f) -version = "0.6.2" +# DO NOT EDIT (digest: bca9ff9aca32d529880868a36b2f43fb) +version = "0.7.0" description = "Serialization library for OpenFlow" requires = "str cstruct cstruct.syntax packet core sexplib.syntax sexplib threads" @@ -10,7 +10,7 @@ archive(native) = "openflow.cmxa" archive(native, plugin) = "openflow.cmxs" exists_if = "openflow.cma" package "quickcheck" ( - version = "0.6.2" + version = "0.7.0" description = "Serialization library for OpenFlow" requires = "quickcheck openflow packet.quickcheck" archive(byte) = "quickcheck.cma" @@ -21,7 +21,7 @@ package "quickcheck" ( ) package "async" ( - version = "0.6.2" + version = "0.7.0" description = "Serialization library for OpenFlow" requires = "async openflow cstruct.async threads sexplib.syntax sexplib" archive(byte) = "async.cma" diff --git a/myocamlbuild.ml b/myocamlbuild.ml index c1cf0bf..dd8d649 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -1,5 +1,5 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: d504cc72904744d1a686718531d2e7f0) *) +(* DO NOT EDIT (digest: 91f001561aa83cb69a61fc50aa6c6602) *) module OASISGettext = struct (* # 22 "src/oasis/OASISGettext.ml" *) @@ -249,6 +249,9 @@ module MyOCamlbuildFindlib = struct *) open Ocamlbuild_plugin + type conf = + { no_automatic_syntax: bool; + } (* these functions are not really officially exported *) let run_and_read = @@ -315,7 +318,7 @@ module MyOCamlbuildFindlib = struct (* This lists all supported packages. *) let find_packages () = - List.map before_space (split_nl & run_and_read "ocamlfind list") + List.map before_space (split_nl & run_and_read (exec_from_conf "ocamlfind" ^ " list")) (* Mock to list available syntaxes. *) @@ -338,7 +341,7 @@ module MyOCamlbuildFindlib = struct ] - let dispatch = + let dispatch conf = function | After_options -> (* By using Before_options one let command line options have an higher @@ -357,31 +360,39 @@ module MyOCamlbuildFindlib = struct * -linkpkg *) flag ["ocaml"; "link"; "program"] & A"-linkpkg"; - (* For each ocamlfind package one inject the -package option when - * compiling, computing dependencies, generating documentation and - * linking. *) - List.iter - begin fun pkg -> - let base_args = [A"-package"; A pkg] in - (* TODO: consider how to really choose camlp4o or camlp4r. *) - let syn_args = [A"-syntax"; A "camlp4o"] in - let args = - (* Heuristic to identify syntax extensions: whether they end in - ".syntax"; some might not. - *) - if Filename.check_suffix pkg "syntax" || - List.mem pkg well_known_syntax then - syn_args @ base_args - else - base_args - in - flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; - flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; - flag ["ocaml"; "doc"; "pkg_"^pkg] & S args; - flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args; - flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args; - end - (find_packages ()); + if not (conf.no_automatic_syntax) then begin + (* For each ocamlfind package one inject the -package option when + * compiling, computing dependencies, generating documentation and + * linking. *) + List.iter + begin fun pkg -> + let base_args = [A"-package"; A pkg] in + (* TODO: consider how to really choose camlp4o or camlp4r. *) + let syn_args = [A"-syntax"; A "camlp4o"] in + let (args, pargs) = + (* Heuristic to identify syntax extensions: whether they end in + ".syntax"; some might not. + *) + if Filename.check_suffix pkg "syntax" || + List.mem pkg well_known_syntax then + (syn_args @ base_args, syn_args) + else + (base_args, []) + in + flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; + flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; + flag ["ocaml"; "doc"; "pkg_"^pkg] & S args; + flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args; + flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args; + + (* TODO: Check if this is allowed for OCaml < 3.12.1 *) + flag ["ocaml"; "compile"; "package("^pkg^")"] & S pargs; + flag ["ocaml"; "ocamldep"; "package("^pkg^")"] & S pargs; + flag ["ocaml"; "doc"; "package("^pkg^")"] & S pargs; + flag ["ocaml"; "infer_interface"; "package("^pkg^")"] & S pargs; + end + (find_packages ()); + end; (* Like -package but for extensions syntax. Morover -syntax is useless * when linking. *) @@ -546,12 +557,13 @@ module MyOCamlbuildBase = struct (* When ocaml link something that use the C library, then one need that file to be up to date. + This holds both for programs and for libraries. *) - dep ["link"; "ocaml"; "program"; tag_libstubs lib] - [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; + dep ["link"; "ocaml"; 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)]; + dep ["compile"; "ocaml"; tag_libstubs lib] + [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; (* TODO: be more specific about what depends on headers *) (* Depends on .h files *) @@ -580,18 +592,18 @@ module MyOCamlbuildBase = struct () - let dispatch_default t = + let dispatch_default conf t = dispatch_combine [ dispatch t; - MyOCamlbuildFindlib.dispatch; + MyOCamlbuildFindlib.dispatch conf; ] end -# 594 "myocamlbuild.ml" +# 606 "myocamlbuild.ml" open Ocamlbuild_plugin;; let package_default = { @@ -614,8 +626,10 @@ let package_default = } ;; -let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; +let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false} + +let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;; -# 620 "myocamlbuild.ml" +# 634 "myocamlbuild.ml" (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default;; diff --git a/setup.ml b/setup.ml index 37554af..bcfd405 100644 --- a/setup.ml +++ b/setup.ml @@ -1,9 +1,9 @@ (* setup.ml generated for the first time by OASIS v0.4.4 *) (* OASIS_START *) -(* DO NOT EDIT (digest: c5500ae2b7bd9c1d63f3645f22fb3c39) *) +(* DO NOT EDIT (digest: a6d2eaa310d0342df9f69123c98c3100) *) (* - Regenerated by OASIS v0.4.4 + Regenerated by OASIS v0.4.5 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) @@ -242,11 +242,9 @@ module OASISString = struct 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 + let buf = Buffer.create (String.length s) in + String.iter (fun c -> Buffer.add_char buf (f c)) s; + Buffer.contents buf end @@ -1729,6 +1727,13 @@ module OASISFeatures = struct (fun () -> s_ "Allows the OASIS section comments and digest to be omitted in \ generated files.") + + let no_automatic_syntax = + create "no_automatic_syntax" alpha + (fun () -> + s_ "Disable the automatic inclusion of -syntax camlp4o for packages \ + that matches the internal heuristic (if a dependency ends with \ + a .syntax or is a well known syntax).") end module OASISUnixPath = struct @@ -2099,16 +2104,6 @@ module OASISLibrary = struct lst in - (* The headers that should be compiled along *) - let headers = - if lib.lib_pack then - [] - else - find_modules - lib.lib_modules - "cmi" - in - (* The .cmx that be compiled along *) let cmxs = let should_be_built = @@ -2134,12 +2129,32 @@ module OASISLibrary = struct [] in + (* The headers and annot/cmt files that should be compiled along *) + let headers = + let sufx = + if lib.lib_pack + then [".cmti"; ".cmt"; ".annot"] + else [".cmi"; ".cmti"; ".cmt"; ".annot"] + in + List.map + begin + List.fold_left + begin fun accu s -> + let dot = String.rindex s '.' in + let base = String.sub s 0 dot in + List.map ((^) base) sufx @ accu + end + [] + end + (find_modules lib.lib_modules "cmi") + in + (* Compute what libraries should be built *) let acc_nopath = (* Add the packed header file if required *) let add_pack_header acc = if lib.lib_pack then - [cs.cs_name^".cmi"] :: acc + [cs.cs_name^".cmi"; cs.cs_name^".cmti"; cs.cs_name^".cmt"] :: acc else acc in @@ -2499,13 +2514,13 @@ module OASISFindlib = struct in let library_name_of_findlib_name = - Lazy.lazy_from_fun - (fun () -> - (* Revert findlib_name_of_library_name. *) - MapString.fold - (fun k v mp -> MapString.add v k mp) - fndlb_name_of_lib_name - MapString.empty) + lazy begin + (* Revert findlib_name_of_library_name. *) + MapString.fold + (fun k v mp -> MapString.add v k mp) + fndlb_name_of_lib_name + MapString.empty + end in let library_name_of_findlib_name fndlb_nm = try @@ -2875,7 +2890,7 @@ module OASISFileUtil = struct end -# 2878 "setup.ml" +# 2893 "setup.ml" module BaseEnvLight = struct (* # 22 "src/base/BaseEnvLight.ml" *) @@ -2980,7 +2995,7 @@ module BaseEnvLight = struct end -# 2983 "setup.ml" +# 2998 "setup.ml" module BaseContext = struct (* # 22 "src/base/BaseContext.ml" *) @@ -5391,7 +5406,7 @@ module BaseSetup = struct end -# 5394 "setup.ml" +# 5409 "setup.ml" module InternalConfigurePlugin = struct (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *) @@ -5827,6 +5842,17 @@ module InternalInstallPlugin = struct lst in + let make_fnames modul sufx = + List.fold_right + begin fun sufx accu -> + (String.capitalize modul ^ sufx) :: + (String.uncapitalize modul ^ sufx) :: + accu + end + sufx + [] + in + (** Install all libraries *) let install_libs pkg = @@ -5847,27 +5873,29 @@ module InternalInstallPlugin = struct 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 library %s") - modul cs.cs_name; - acc - end) + begin fun acc modul -> + begin + try + [List.find + OASISFileUtil.file_exists_case + (List.map + (Filename.concat path) + (make_fnames modul [".mli"; ".ml"]))] + with Not_found -> + warning + (f_ "Cannot find source header for module %s \ + in library %s") + modul cs.cs_name; + [] + end + @ + List.filter + OASISFileUtil.file_exists_case + (List.map + (Filename.concat path) + (make_fnames modul [".annot";".cmti";".cmt"])) + @ acc + end acc lib.lib_modules in @@ -5915,27 +5943,29 @@ module InternalInstallPlugin = struct 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) + begin fun acc modul -> + begin + try + [List.find + OASISFileUtil.file_exists_case + (List.map + (Filename.concat path) + (make_fnames modul [".mli"; ".ml"]))] + with Not_found -> + warning + (f_ "Cannot find source header for module %s \ + in object %s") + modul cs.cs_name; + [] + end + @ + List.filter + OASISFileUtil.file_exists_case + (List.map + (Filename.concat path) + (make_fnames modul [".annot";".cmti";".cmt"])) + @ acc + end acc obj.obj_modules in @@ -6240,7 +6270,7 @@ module InternalInstallPlugin = struct end -# 6243 "setup.ml" +# 6273 "setup.ml" module OCamlbuildCommon = struct (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *) @@ -6298,6 +6328,11 @@ module OCamlbuildCommon = struct else []; + if bool_of_string (tests ()) then + ["-tag"; "tests"] + else + []; + if bool_of_string (profile ()) then ["-tag"; "profile"] else @@ -6613,7 +6648,7 @@ module OCamlbuildDocPlugin = struct end -# 6616 "setup.ml" +# 6651 "setup.ml" module CustomPlugin = struct (* # 22 "src/plugins/custom/CustomPlugin.ml" *) @@ -6761,7 +6796,7 @@ module CustomPlugin = struct end -# 6764 "setup.ml" +# 6799 "setup.ml" open OASISTypes;; let setup_t = @@ -6825,7 +6860,7 @@ let setup_t = alpha_features = []; beta_features = []; name = "openflow"; - version = "0.6.2"; + version = "0.7.0"; license = OASISLicense.DEP5License (OASISLicense.DEP5Unit @@ -7254,8 +7289,8 @@ let setup_t = plugin_data = [] }; oasis_fn = Some "_oasis"; - oasis_version = "0.4.4"; - oasis_digest = Some "^2\190\030\242\233\249[]\22028Q#i\140"; + oasis_version = "0.4.5"; + oasis_digest = Some "\2363\193\240\220:G\239\193\026\158\139 r7\179"; oasis_exec = None; oasis_setup_args = []; setup_update = false @@ -7263,6 +7298,6 @@ let setup_t = let setup () = BaseSetup.setup setup_t;; -# 7267 "setup.ml" +# 7302 "setup.ml" (* OASIS_STOP *) let () = setup ();;