Skip to content

Commit

Permalink
add ixy support
Browse files Browse the repository at this point in the history
  • Loading branch information
bonkf committed Mar 8, 2019
1 parent f2c9347 commit c42d709
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ module Project = struct
Key.(abstract target);
Key.(abstract warn_error);
Key.(abstract target_debug);
Key.(abstract ixy);
Key.(abstract no_depext);
]
method! packages =
Expand Down
26 changes: 17 additions & 9 deletions lib/mirage_impl_network.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ let network_conf (intf : string Key.key) =
method module_name = "Netif"
method! keys = [ key ]
method! packages =
Key.match_ Key.(value target) @@ function
| `Unix -> [ package ~min:"2.6.0" ~max:"3.0.0" "mirage-net-unix" ]
| `MacOSX -> [ package ~min:"1.6.0" ~max:"2.0.0" "mirage-net-macosx" ]
| `Xen -> [ package ~min:"1.10.0" ~max:"2.0.0" "mirage-net-xen"]
| `Qubes ->
[ package ~min:"1.10.0" ~max:"2.0.0" "mirage-net-xen" ;
Mirage_impl_qubesdb.pkg ]
| `Virtio | `Hvt | `Muen | `Genode ->
[ package ~min:"0.4.2" ~max:"0.5.0" "mirage-net-solo5" ]
let choose target ixy =
match target, ixy with
| `Unix, true ->
[ package "mirage-net-ixy" ]
| `Unix, false ->
[ package ~min:"2.6.0" ~max:"3.0.0" "mirage-net-unix" ]
| `MacOSX, _ -> [ package ~min:"1.6.0" ~max:"2.0.0" "mirage-net-macosx" ]
| `Xen, _ -> [ package ~min:"1.10.0" ~max:"2.0.0" "mirage-net-xen"]
| `Qubes, _ ->
[ package ~min:"1.10.0" ~max:"2.0.0" "mirage-net-xen" ;
Mirage_impl_qubesdb.pkg ]
| `Virtio, _ | `Hvt, _ | `Muen, _ | `Genode, _ ->
[ package ~min:"0.4.2" ~max:"0.5.0" "mirage-net-solo5" ] in
Functoria_key.((pure choose)
$ Key.(value target)
$ Key.(value ixy))

method! connect _ modname _ =
Fmt.strf "%s.connect %a" modname Key.serialize_call key
method! configure i =
Expand Down
7 changes: 7 additions & 0 deletions lib/mirage_key.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ let target_debug =
let key = Arg.flag ~stage:`Configure doc in
Key.create "target_debug" key

let ixy =
let doc = "Enables target-specific support for ixy. Supported \
targets: unix." in
let doc = Arg.info ~docs:mirage_section ~docv:"IXY" ~doc ["ixy"] in
let key = Arg.flag ~stage:`Configure doc in
Key.create "ixy" key

let no_depext =
let doc = "Disable call to depext when generating Makefile." in
let doc = Arg.info ~docs:mirage_section ~docv:"BOOL" ~doc ["no-depext"] in
Expand Down
4 changes: 4 additions & 0 deletions lib/mirage_key.mli
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ val warn_error: bool key
val target_debug: bool key
(** [-g]. Enables target-specific support for debugging. *)

val ixy: bool key
(** [-ixy]. Enables target-specific support for ixy.
{{https://github.com/ixy-languages/ixy.ml}} *)

val no_depext: bool key
(** [--no-depext]. Disables opam depext in depend target of generated Makefile. *)

Expand Down

0 comments on commit c42d709

Please sign in to comment.