diff --git a/.travis.yml b/.travis.yml
index a9b5f3e..7aa8256 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,7 @@ env:
global:
- OPAM_DEPENDS="cstruct quickcheck ounit pa_ounit textutils core async"
- CONFIG_FLAGS="--enable-tests --enable-quickcheck --enable-async"
- - FRENETIC_DEPENDS="ocaml-packet ocaml-topology"
+ - FRENETIC_DEPENDS="ocaml-packet"
matrix:
- OCAML_VERSION=4.01.0 OPAM_VERSION=1.1.0
notifications:
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..661c890
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,171 @@
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU General Public License version 3, as published by the Free
+Software Foundation (included below).
+
+-------------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/README.md b/README.md
index 38a04eb..1e4fcdf 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,7 @@
OCaml OpenFlow
==============
-A serialization library for OpenFlow, with support for writing Lwt-based
-OpenFlow controllers.
-
+A serialization and protocol library for OpenFlow.
This library supports almost all of OpenFlow 1.0 and also has some experimental
support for OpenFlow 1.3.
@@ -11,27 +9,38 @@ support for OpenFlow 1.3.
[![Build Status](https://travis-ci.org/frenetic-lang/ocaml-openflow.png)](https://travis-ci.org/frenetic-lang/ocaml-openflow)
-Building from Source
---------------------
+Installation
+------------
-If you want to write a lwt-based controller:
+You can install the latest release from [OPAM][http://opam.ocamlpro.com/] using
+the following command:
- $ opam install openflow lwt
+ $ opam install openflow
-This installed the `openflow.lwt` subpackage.
+To install the async subpackage, simply ensure that async is installed before
+or after installing the library:
-If you just want serialization support:
+ $ opam install async
- $ opam install openflow
+Development
+-----------
+To build from source, first ensure that you've installed all dependencies,
+which are listed in the `_oasis` file under the openflow, async, and quickcheck
+`Library` sections. Then, run the following commands:
-Hacking
--------
+ ./configure --enable-tests --enable-quickcheck --enable-async
+ $ make
+ $ make test
+ $ make install
+
+While developing, you may want to install your latest changes for testing with
+other packages. `make install` will fail when trying to reinstall, so use this
+command instead:
-The `_oasis` file specifies all the dependencies. If you're hacking on the
-library, you should install the dependencies needed to build the main
-library, the sub-packages, and the test suite.
+ $ make reinstall
- $ opam install ocamlfind cstruct quickcheck ounit pa_ounit lwt
- $ ./configure --enable-tests --enable-quickcheck --enable-lwt
+License
+-------
+LGPLv3, see LICENSE file for its text.
diff --git a/_oasis b/_oasis
index c7d743a..968409c 100644
--- a/_oasis
+++ b/_oasis
@@ -1,7 +1,7 @@
OASISFormat: 0.3
OCamlVersion: >= 4.01.0
Name: openflow
-Version: 0.2.0
+Version: 0.3.0
Synopsis: Serialization library for OpenFlow
Authors: https://github.com/frenetic-lang/ocaml-openflow/contributors
License: LGPL
@@ -74,13 +74,13 @@ Library quickcheck
Path: quickcheck
Build$: flag(tests) || flag(quickcheck)
BuildDepends:
- quickcheck,
- openflow
+ quickcheck,
+ openflow
Modules:
- Arbitrary_Base,
- Arbitrary_OpenFlow,
- Arbitrary_OpenFlow0x01,
- Arbitrary_SDN_Types
+ Arbitrary_Base,
+ Arbitrary_OpenFlow,
+ Arbitrary_OpenFlow0x01,
+ Arbitrary_SDN_Types
Executable testtool
Path: test
diff --git a/_tags b/_tags
index 9e454a8..286a54b 100644
--- a/_tags
+++ b/_tags
@@ -1,5 +1,5 @@
# OASIS_START
-# DO NOT EDIT (digest: 872119f14ab3f21a5c84730a2ca36fe5)
+# DO NOT EDIT (digest: e1e26434aaae617000c026272165c731)
# 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
@@ -15,131 +15,129 @@
"_darcs": not_hygienic
# Library openflow
"lib/openflow.cmxs": use_openflow
+: package(threads)
: package(core)
-: package(cstruct)
-: package(cstruct.syntax)
: package(packet)
: package(sexplib.syntax)
: package(str)
-: package(threads)
+: package(cstruct)
+: package(cstruct.syntax)
# Library async
"async/async.cmxs": use_async
-: package(async)
+: use_openflow
+: package(threads)
: package(core)
-: package(cstruct)
-: package(cstruct.async)
-: package(cstruct.syntax)
+: package(async)
: package(packet)
+: package(cstruct.async)
: package(sexplib.syntax)
: package(str)
-: package(threads)
-: use_openflow
+: package(cstruct)
+: package(cstruct.syntax)
# Library quickcheck
"quickcheck/quickcheck.cmxs": use_quickcheck
+: use_openflow
+: package(threads)
: package(core)
-: package(cstruct)
-: package(cstruct.syntax)
: package(packet)
: package(quickcheck)
: package(sexplib.syntax)
: package(str)
-: package(threads)
-: use_openflow
+: package(cstruct)
+: package(cstruct.syntax)
# Executable testtool
+"test/Test.byte": use_quickcheck
+"test/Test.byte": use_openflow
+"test/Test.byte": package(threads)
"test/Test.byte": package(core)
-"test/Test.byte": package(cstruct)
-"test/Test.byte": package(cstruct.syntax)
+"test/Test.byte": package(packet)
"test/Test.byte": package(oUnit)
"test/Test.byte": package(pa_ounit)
"test/Test.byte": package(pa_ounit.syntax)
-"test/Test.byte": package(packet)
"test/Test.byte": package(quickcheck)
"test/Test.byte": package(sexplib.syntax)
"test/Test.byte": package(str)
-"test/Test.byte": package(threads)
-"test/Test.byte": use_openflow
-"test/Test.byte": use_quickcheck
+"test/Test.byte": package(cstruct)
+"test/Test.byte": package(cstruct.syntax)
+: use_quickcheck
+: use_openflow
+: package(threads)
: package(core)
-: package(cstruct)
-: package(cstruct.syntax)
+: package(packet)
: package(oUnit)
: package(pa_ounit)
: package(pa_ounit.syntax)
-: package(packet)
: package(quickcheck)
: package(sexplib.syntax)
: package(str)
-: package(threads)
-: use_openflow
-: use_quickcheck
+: package(cstruct)
+: package(cstruct.syntax)
# Executable ping_test
-"ping-test/PingTest.byte": package(async)
+"ping-test/PingTest.byte": use_async
+"ping-test/PingTest.byte": use_openflow
+"ping-test/PingTest.byte": package(threads)
"ping-test/PingTest.byte": package(core)
-"ping-test/PingTest.byte": package(cstruct)
+"ping-test/PingTest.byte": package(async)
+"ping-test/PingTest.byte": package(packet)
"ping-test/PingTest.byte": package(cstruct.async)
-"ping-test/PingTest.byte": package(cstruct.syntax)
"ping-test/PingTest.byte": package(oUnit)
"ping-test/PingTest.byte": package(pa_ounit)
"ping-test/PingTest.byte": package(pa_ounit.syntax)
-"ping-test/PingTest.byte": package(packet)
"ping-test/PingTest.byte": package(sexplib.syntax)
"ping-test/PingTest.byte": package(str)
-"ping-test/PingTest.byte": package(threads)
-"ping-test/PingTest.byte": use_async
-"ping-test/PingTest.byte": use_openflow
-: package(async)
+"ping-test/PingTest.byte": package(cstruct)
+"ping-test/PingTest.byte": package(cstruct.syntax)
+: use_async
+: use_openflow
+: package(threads)
: package(core)
-: package(cstruct)
+: package(async)
+: package(packet)
: package(cstruct.async)
-: package(cstruct.syntax)
: package(oUnit)
: package(pa_ounit)
: package(pa_ounit.syntax)
-: package(packet)
: package(sexplib.syntax)
: package(str)
-: package(threads)
-: use_async
-: use_openflow
+: package(cstruct)
+: package(cstruct.syntax)
# Executable Hypervisor
-"examples/Hypervisor.byte": package(async)
+"examples/Hypervisor.byte": use_async
+"examples/Hypervisor.byte": use_openflow
+"examples/Hypervisor.byte": package(threads)
"examples/Hypervisor.byte": package(core)
-"examples/Hypervisor.byte": package(cstruct)
-"examples/Hypervisor.byte": package(cstruct.async)
-"examples/Hypervisor.byte": package(cstruct.syntax)
+"examples/Hypervisor.byte": package(async)
"examples/Hypervisor.byte": package(packet)
+"examples/Hypervisor.byte": package(cstruct.async)
"examples/Hypervisor.byte": package(sexplib.syntax)
"examples/Hypervisor.byte": package(str)
-"examples/Hypervisor.byte": package(threads)
-"examples/Hypervisor.byte": use_async
-"examples/Hypervisor.byte": use_openflow
+"examples/Hypervisor.byte": package(cstruct)
+"examples/Hypervisor.byte": package(cstruct.syntax)
# Executable learning_switch
-"examples/Learning_Switch.byte": package(async)
+"examples/Learning_Switch.byte": use_async
+"examples/Learning_Switch.byte": use_openflow
+"examples/Learning_Switch.byte": package(threads)
"examples/Learning_Switch.byte": package(core)
-"examples/Learning_Switch.byte": package(cstruct)
-"examples/Learning_Switch.byte": package(cstruct.async)
-"examples/Learning_Switch.byte": package(cstruct.syntax)
+"examples/Learning_Switch.byte": package(async)
"examples/Learning_Switch.byte": package(packet)
+"examples/Learning_Switch.byte": package(cstruct.async)
"examples/Learning_Switch.byte": package(sexplib.syntax)
"examples/Learning_Switch.byte": package(str)
-"examples/Learning_Switch.byte": package(threads)
-"examples/Learning_Switch.byte": use_async
-"examples/Learning_Switch.byte": use_openflow
-: package(async)
+"examples/Learning_Switch.byte": package(cstruct)
+"examples/Learning_Switch.byte": package(cstruct.syntax)
+: use_async
+: use_openflow
+: package(threads)
: package(core)
-: package(cstruct)
-: package(cstruct.async)
-: package(cstruct.syntax)
+: package(async)
: package(packet)
+: package(cstruct.async)
: package(sexplib.syntax)
: package(str)
-: package(threads)
-: use_async
-: use_openflow
+: package(cstruct)
+: package(cstruct.syntax)
# OASIS_STOP
: syntax_camlp4o
-: syntax_camlp4o
: syntax_camlp4o
: syntax_camlp4o
: syntax_camlp4o
-: syntax_camlp4o
diff --git a/lib/META b/lib/META
index c7e5411..a14bef4 100644
--- a/lib/META
+++ b/lib/META
@@ -1,6 +1,6 @@
# OASIS_START
-# DO NOT EDIT (digest: 1c838b69b24adcd8387ed95f9166c840)
-version = "0.2.0"
+# DO NOT EDIT (digest: c6492aee0dc64a6c8fdb707e88fe46ef)
+version = "0.3.0"
description = "Serialization library for OpenFlow"
requires = "str cstruct cstruct.syntax packet core sexplib.syntax threads"
archive(byte) = "openflow.cma"
@@ -9,7 +9,7 @@ archive(native) = "openflow.cmxa"
archive(native, plugin) = "openflow.cmxs"
exists_if = "openflow.cma"
package "quickcheck" (
- version = "0.2.0"
+ version = "0.3.0"
description = "Serialization library for OpenFlow"
requires = "quickcheck openflow"
archive(byte) = "quickcheck.cma"
@@ -20,7 +20,7 @@ package "quickcheck" (
)
package "async" (
- version = "0.2.0"
+ version = "0.3.0"
description = "Serialization library for OpenFlow"
requires = "async openflow cstruct.async threads sexplib.syntax"
archive(byte) = "async.cma"
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 999d232..db714e0 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -1,5 +1,5 @@
(* OASIS_START *)
-(* DO NOT EDIT (digest: 0033a12558b72c01d3b44bdf3aef3fdf) *)
+(* DO NOT EDIT (digest: e55731d28dfe72908834e5aad8131d7a) *)
module OASISGettext = struct
(* # 22 "src/oasis/OASISGettext.ml" *)
@@ -204,27 +204,26 @@ module BaseEnvLight = struct
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 =
- var_expand (MapString.find name env) 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)
let var_choose lst env =
@@ -234,7 +233,7 @@ module BaseEnvLight = struct
end
-# 237 "myocamlbuild.ml"
+# 236 "myocamlbuild.ml"
module MyOCamlbuildFindlib = struct
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
@@ -307,22 +306,6 @@ module MyOCamlbuildFindlib = struct
let find_syntaxes () = ["camlp4o"; "camlp4r"]
- let well_known_syntax = [
- "camlp4.quotations.o";
- "camlp4.quotations.r";
- "camlp4.exceptiontracer";
- "camlp4.extend";
- "camlp4.foldgenerator";
- "camlp4.listcomprehension";
- "camlp4.locationstripper";
- "camlp4.macro";
- "camlp4.mapgenerator";
- "camlp4.metagenerator";
- "camlp4.profiler";
- "camlp4.tracer"
- ]
-
-
let dispatch =
function
| Before_options ->
@@ -348,17 +331,13 @@ module MyOCamlbuildFindlib = struct
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
+ (* Heuristic to identify syntax extensions: whether they end in
+ * ".syntax"; some might not *)
+ if Filename.check_suffix pkg "syntax"
+ then syn_args @ base_args
+ else base_args
in
flag ["ocaml"; "compile"; "pkg_"^pkg] & S args;
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
@@ -552,14 +531,10 @@ module MyOCamlbuildBase = struct
(* Add flags *)
List.iter
(fun (tags, cond_specs) ->
- let spec = BaseEnvLight.var_choose cond_specs env in
- let rec eval_specs =
- function
- | S lst -> S (List.map eval_specs lst)
- | A str -> A (BaseEnvLight.var_expand str env)
- | spec -> spec
+ let spec =
+ BaseEnvLight.var_choose cond_specs env
in
- flag tags & (eval_specs spec))
+ flag tags & spec)
t.flags
| _ ->
()
@@ -576,7 +551,7 @@ module MyOCamlbuildBase = struct
end
-# 579 "myocamlbuild.ml"
+# 554 "myocamlbuild.ml"
open Ocamlbuild_plugin;;
let package_default =
{
@@ -601,6 +576,6 @@ let package_default =
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
-# 605 "myocamlbuild.ml"
+# 580 "myocamlbuild.ml"
(* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;;
diff --git a/setup.ml b/setup.ml
index 4255ac1..b2dd0ce 100644
--- a/setup.ml
+++ b/setup.ml
@@ -1,9 +1,9 @@
(* setup.ml generated for the first time by OASIS v0.3.0 *)
(* OASIS_START *)
-(* DO NOT EDIT (digest: 4c979ffb1b1ad68a9d587b995eaa74f3) *)
+(* DO NOT EDIT (digest: 5a22a486a846c58a0e8a300480422849) *)
(*
- Regenerated by OASIS v0.4.2
+ Regenerated by OASIS v0.4.1
Visit http://oasis.forge.ocamlcore.org for more information and
documentation about functions used in this file.
*)
@@ -52,7 +52,6 @@ module OASISContext = struct
type t =
{
- (* TODO: replace this by a proplist. *)
quiet: bool;
info: bool;
debug: bool;
@@ -89,31 +88,19 @@ module OASISContext = struct
{!default with quiet = true}
- let fspecs () =
- (* TODO: don't act on default. *)
- let ignore_plugins = ref false in
+ let args () =
["-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";
-
- "-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}
+ (s_ " Output debug message")]
end
module OASISString = struct
@@ -299,13 +286,6 @@ module OASISUtils = struct
Hashtbl.hash (String.lowercase s)
end)
- module SetStringCsl =
- Set.Make
- (struct
- type t = string
- let compare = compare_csl
- end)
-
let varname_of_string ?(hyphen='_') s =
if String.length s = 0 then
@@ -940,6 +920,7 @@ module OASISLicense = struct
| DEP5And of license_dep_5 list
+
type t =
| DEP5License of license_dep_5
| OtherLicense of string (* URL *)
@@ -2782,7 +2763,7 @@ module OASISFileUtil = struct
end
-# 2785 "setup.ml"
+# 2766 "setup.ml"
module BaseEnvLight = struct
(* # 22 "src/base/BaseEnvLight.ml" *)
@@ -2857,27 +2838,26 @@ module BaseEnvLight = struct
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 =
- var_expand (MapString.find name env) 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)
let var_choose lst env =
@@ -2887,15 +2867,15 @@ module BaseEnvLight = struct
end
-# 2890 "setup.ml"
+# 2870 "setup.ml"
module BaseContext = struct
(* # 22 "src/base/BaseContext.ml" *)
- (* TODO: get rid of this module. *)
+
open OASISContext
- let args () = fst (fspecs ())
+ let args = args
let default = default
@@ -5026,14 +5006,11 @@ module BaseSetup = struct
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 -> default_oasis_fn
+ | None -> "_oasis"
in
let oasis_exec =
match t.oasis_exec with
@@ -5131,8 +5108,7 @@ module BaseSetup = struct
try
match t.oasis_digest with
| Some dgst ->
- if Sys.file_exists oasis_fn &&
- dgst <> Digest.file default_oasis_fn then
+ if Sys.file_exists oasis_fn && dgst <> Digest.file "_oasis" then
begin
do_update ();
true
@@ -5298,7 +5274,7 @@ module BaseSetup = struct
end
-# 5301 "setup.ml"
+# 5277 "setup.ml"
module InternalConfigurePlugin = struct
(* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
@@ -6147,7 +6123,7 @@ module InternalInstallPlugin = struct
end
-# 6150 "setup.ml"
+# 6126 "setup.ml"
module OCamlbuildCommon = struct
(* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
@@ -6159,15 +6135,10 @@ module OCamlbuildCommon = struct
open OASISGettext
open BaseEnv
open BaseStandardVar
- open OASISTypes
-
-
- type extra_args = string list
-
-
- let ocamlbuild_clean_ev = "ocamlbuild-clean"
+ let ocamlbuild_clean_ev =
+ "ocamlbuild-clean"
let ocamlbuildflags =
@@ -6290,7 +6261,27 @@ module OCamlbuildPlugin = struct
ref (fun lst -> lst)
- let build extra_args pkg argv =
+ type ocamlbuild_plugin =
+ {
+ plugin_tags: string option;
+ extra_args: string list;
+ }
+
+
+ let check_ocaml_version version pkg =
+ match pkg.ocaml_version with
+ | Some ocaml_version ->
+ let min_ocaml_version = OASISVersion.version_of_string version in
+ OASISVersion.comparator_ge min_ocaml_version ocaml_version
+ | None ->
+ false
+
+
+ let ocamlbuild_supports_ocamlfind = check_ocaml_version "3.12.1"
+ let ocamlbuild_supports_plugin_tags = check_ocaml_version "4.01"
+
+
+ let build t pkg argv =
(* Return the filename in build directory *)
let in_build_dir fn =
Filename.concat
@@ -6434,13 +6425,33 @@ module OCamlbuildPlugin = struct
(BaseBuilt.register bt bnm lst)
in
- (* Run the hook *)
- let cond_targets = !cond_targets_hook cond_targets in
+ let cond_targets =
+ (* Run the hook *)
+ !cond_targets_hook cond_targets
+ in
- (* Run a list of target... *)
- run_ocamlbuild (List.flatten (List.map snd cond_targets) @ extra_args) argv;
- (* ... and register events *)
- List.iter check_and_register (List.flatten (List.map fst cond_targets))
+ let extra_args =
+ match t.plugin_tags with
+ | Some tags -> "-plugin-tags" :: ("'" ^ tags ^ "'") :: t.extra_args
+ | None -> t.extra_args
+ in
+ let extra_args =
+ if ocamlbuild_supports_ocamlfind pkg then
+ "-use-ocamlfind" :: extra_args
+ else
+ extra_args
+ in
+
+ (* Run a list of target... *)
+ run_ocamlbuild
+ (List.flatten
+ (List.map snd cond_targets)
+ @ extra_args)
+ argv;
+ (* ... and register events *)
+ List.iter
+ check_and_register
+ (List.flatten (List.map fst cond_targets))
let clean pkg extra_args =
@@ -6477,18 +6488,12 @@ module OCamlbuildDocPlugin = struct
- type run_t =
- {
- extra_args: string list;
- run_path: unix_filename;
- }
-
- let doc_build run pkg (cs, doc) argv =
+ let doc_build path pkg (cs, doc) argv =
let index_html =
OASISUnixPath.make
[
- run.run_path;
+ path;
cs.cs_name^".docdir";
"index.html";
]
@@ -6497,11 +6502,11 @@ module OCamlbuildDocPlugin = struct
OASISHostPath.make
[
build_dir argv;
- OASISHostPath.of_unix run.run_path;
+ OASISHostPath.of_unix path;
cs.cs_name^".docdir";
]
in
- run_ocamlbuild (index_html :: run.extra_args) argv;
+ run_ocamlbuild [index_html] argv;
List.iter
(fun glb ->
BaseBuilt.register
@@ -6512,7 +6517,7 @@ module OCamlbuildDocPlugin = struct
["*.html"; "*.css"]
- let doc_clean run pkg (cs, doc) argv =
+ let doc_clean t pkg (cs, doc) argv =
run_clean argv;
BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name
@@ -6520,7 +6525,7 @@ module OCamlbuildDocPlugin = struct
end
-# 6523 "setup.ml"
+# 6528 "setup.ml"
module CustomPlugin = struct
(* # 22 "src/plugins/custom/CustomPlugin.ml" *)
@@ -6668,13 +6673,15 @@ module CustomPlugin = struct
end
-# 6671 "setup.ml"
+# 6676 "setup.ml"
open OASISTypes;;
let setup_t =
{
BaseSetup.configure = InternalConfigurePlugin.configure;
- build = OCamlbuildPlugin.build ["-use-ocamlfind"];
+ build =
+ OCamlbuildPlugin.build
+ {OCamlbuildPlugin.plugin_tags = None; extra_args = []};
test =
[
("all_tests",
@@ -6732,7 +6739,7 @@ let setup_t =
alpha_features = [];
beta_features = [];
name = "openflow";
- version = "0.2.0";
+ version = "0.3.0";
license =
OASISLicense.DEP5License
(OASISLicense.DEP5Unit
@@ -7154,8 +7161,8 @@ let setup_t =
plugin_data = []
};
oasis_fn = Some "_oasis";
- oasis_version = "0.4.2";
- oasis_digest = Some "\245\194|WNqZ\203\195\170\179Y1\213\170j";
+ oasis_version = "0.4.1";
+ oasis_digest = Some "\201\145qF\136S\028r\015\248\166\000z\01804";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
@@ -7163,6 +7170,6 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;;
-# 7167 "setup.ml"
+# 7174 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;