Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpaf-mirage: replace dune file written in OCaml with select form #18

Merged
merged 1 commit into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased
--------------

- httpaf-lwt-unix: replace the `dune` file (previously written in OCaml) with a
`(select)` form to avoid depending on `ocamlfind`
([#18](https://github.com/anmonteiro/httpaf/pull/18))
- httpaf-mirage: depend on `mirage-conduit` instead of `conduit-mirage`,
effectively placing a lower bound of OCaml 4.07 on httpaf-mirage
([#16](https://github.com/anmonteiro/httpaf/pull/16))
Expand Down
2 changes: 1 addition & 1 deletion httpaf-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build: [
]
depends: [
"ocaml" {>= "4.03.0"}
"dune" {build}
"dune"
"faraday-async"
"async"
"httpaf" {>= "0.5.0"}
Expand Down
3 changes: 1 addition & 2 deletions httpaf-lwt-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ depends: [
"faraday-lwt-unix"
"httpaf"
"httpaf-lwt"
"dune" {build}
"ocamlfind" {build}
"dune"
"lwt"
]
depopts: ["tls" "lwt_ssl"]
Expand Down
2 changes: 1 addition & 1 deletion httpaf-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build: [
depends: [
"ocaml" {>= "4.03.0"}
"httpaf"
"dune" {build}
"dune"
"lwt"
]
pin-depends: [
Expand Down
2 changes: 1 addition & 1 deletion httpaf-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ depends: [
"httpaf-lwt"
"conduit-mirage"
"cstruct"
"dune" {build}
"dune"
"lwt"
]
pin-depends: [
Expand Down
2 changes: 1 addition & 1 deletion httpaf.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build: [
]
depends: [
"ocaml" {>= "4.03.0"}
"dune" {build}
"dune"
"alcotest" {with-test}
"bigstringaf" {>= "0.4.0"}
"angstrom" {>= "0.9.0"}
Expand Down
46 changes: 15 additions & 31 deletions lwt-unix/dune
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
(* -*- tuareg -*- *)
(* This was inspired by `conduit-lwt-unix`'s dune file *)

let v ~ssl ~tls () =
let ssl, ssl_d =
if ssl then "ssl_io_real", "lwt_ssl "
else "ssl_io_dummy", ""
in
let tls, tls_d =
if tls then "tls_io_real", "tls.lwt "
else "tls_io_dummy", ""
in
Printf.sprintf {|
(rule (copy %s.ml ssl_io.ml))
(rule (copy %s.ml tls_io.ml))

(library
(name httpaf_lwt_unix)
(public_name httpaf-lwt-unix)
(libraries faraday-lwt-unix httpaf httpaf-lwt lwt.unix %s%s)
(libraries
faraday-lwt-unix
httpaf
httpaf-lwt
lwt.unix
(select
ssl_io.ml
from
(lwt_ssl -> ssl_io_real.ml)
(-> ssl_io_dummy.ml))
(select
tls_io.ml
from
(tls.lwt -> tls_io_real.ml)
(-> tls_io_dummy.ml)))
(modules httpaf_lwt_unix tls_io ssl_io)
(flags
(:standard -safe-string)))
|} ssl tls ssl_d tls_d

let main () =
let is_installed s = Printf.kprintf Sys.command "ocamlfind query %s" s = 0 in
let ssl = is_installed "lwt_ssl" in
let tls = is_installed "tls.lwt" in
Printf.printf
"Configuration\n\
\ ssl : %b\n\
\ tls : %b\n%!"
ssl tls;
v ~ssl ~tls ()

let () = Jbuild_plugin.V1.send @@ main ()