Skip to content

Commit

Permalink
Add an option package to select the OCaml network stack
Browse files Browse the repository at this point in the history
Add a new option package to ensure lwIP is disabled
  • Loading branch information
shym committed Dec 13, 2024
1 parent 106b02c commit fe08c4a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
22 changes: 18 additions & 4 deletions gen_opams.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ let version_ocaml_unikraft = "0.0.1"
let version_unikraft = "0.17.0"
let archs = [ "arm64"; "x86_64" ]
let backends = [ ("fc", "FireCracker"); ("qemu", "QEMU") ]
let options = [ ("debug", "debugging"); ("lwip", "the lwIP library") ]

let options =
[
("debug", "debugging", []);
("lwip", "the lwIP library", [ "network-stack" ]);
("ocaml-net-stack", "OCaml network stack", [ "network-stack" ]);
]

let with_package package_name gen =
let filename = Printf.sprintf "%s.opam" package_name in
Expand Down Expand Up @@ -40,7 +46,7 @@ depends: [
depopts: [|}
version_unikraft long_name arch;
List.iter
(fun (opt, _) ->
(fun (opt, _, _) ->
Printf.fprintf out "\n \"ocaml-unikraft-option-%s\"" opt)
options;
Printf.fprintf out
Expand Down Expand Up @@ -90,7 +96,7 @@ extra-source "musl-1.2.3.tar.gz" {
short_name arch)

let option_package option =
let short_name, long_name = option in
let short_name, long_name, conflicts = option in
let package_name = Printf.sprintf "ocaml-unikraft-option-%s" short_name in
with_package package_name (fun out ->
Printf.fprintf out
Expand All @@ -101,7 +107,15 @@ synopsis:
authors: "Samuel Hym"
license: "MIT"
|}
version_unikraft long_name)
version_unikraft long_name;
match conflicts with
| [] -> ()
| _ ->
Printf.fprintf out "conflict-class: [\n";
List.iter
(Printf.fprintf out " \"ocaml-unikraft-%s\"\n")
conflicts;
Printf.fprintf out "]\n")

let toolchain_package arch =
let package_name = Printf.sprintf "ocaml-unikraft-toolchain-%s" arch in
Expand Down
1 change: 1 addition & 0 deletions ocaml-unikraft-backend-fc-arm64.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
depopts: [
"ocaml-unikraft-option-debug"
"ocaml-unikraft-option-lwip"
"ocaml-unikraft-option-ocaml-net-stack"
]
build: [
[
Expand Down
1 change: 1 addition & 0 deletions ocaml-unikraft-backend-fc-x86_64.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
depopts: [
"ocaml-unikraft-option-debug"
"ocaml-unikraft-option-lwip"
"ocaml-unikraft-option-ocaml-net-stack"
]
build: [
[
Expand Down
1 change: 1 addition & 0 deletions ocaml-unikraft-backend-qemu-arm64.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
depopts: [
"ocaml-unikraft-option-debug"
"ocaml-unikraft-option-lwip"
"ocaml-unikraft-option-ocaml-net-stack"
]
build: [
[
Expand Down
1 change: 1 addition & 0 deletions ocaml-unikraft-backend-qemu-x86_64.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
depopts: [
"ocaml-unikraft-option-debug"
"ocaml-unikraft-option-lwip"
"ocaml-unikraft-option-ocaml-net-stack"
]
build: [
[
Expand Down
3 changes: 3 additions & 0 deletions ocaml-unikraft-option-lwip.opam
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ synopsis:
"Virtual package to enable the lwIP library in the Unikraft backends"
authors: "Samuel Hym"
license: "MIT"
conflict-class: [
"ocaml-unikraft-network-stack"
]
13 changes: 13 additions & 0 deletions ocaml-unikraft-option-ocaml-net-stack.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
opam-version: "2.0"
name: "ocaml-unikraft-option-ocaml-net-stack"
maintainer: "[email protected]"
homepage: "https://github.com/shym/ocaml-unikraft/"
bug-reports: "https://github.com/shym/ocaml-unikraft/issues"
version: "0.17.0"
synopsis:
"Virtual package to enable OCaml network stack in the Unikraft backends"
authors: "Samuel Hym"
license: "MIT"
conflict-class: [
"ocaml-unikraft-network-stack"
]

0 comments on commit fe08c4a

Please sign in to comment.