From 57012b79cf44dae4eca636b2cac1e24e2980b291 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Tue, 3 Sep 2019 14:55:38 -0700 Subject: [PATCH] httpaf-mirage: replace dune file written in OCaml with `select` form --- CHANGES.md | 3 +++ httpaf-async.opam | 2 +- httpaf-lwt-unix.opam | 3 +-- httpaf-lwt.opam | 2 +- httpaf-mirage.opam | 2 +- httpaf.opam | 2 +- lwt-unix/dune | 46 +++++++++++++++----------------------------- 7 files changed, 23 insertions(+), 37 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 774e973..b061e07 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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)) diff --git a/httpaf-async.opam b/httpaf-async.opam index c3139ee..1db2f7a 100644 --- a/httpaf-async.opam +++ b/httpaf-async.opam @@ -13,7 +13,7 @@ build: [ ] depends: [ "ocaml" {>= "4.03.0"} - "dune" {build} + "dune" "faraday-async" "async" "httpaf" {>= "0.5.0"} diff --git a/httpaf-lwt-unix.opam b/httpaf-lwt-unix.opam index c6fa589..3434c06 100644 --- a/httpaf-lwt-unix.opam +++ b/httpaf-lwt-unix.opam @@ -17,8 +17,7 @@ depends: [ "faraday-lwt-unix" "httpaf" "httpaf-lwt" - "dune" {build} - "ocamlfind" {build} + "dune" "lwt" ] depopts: ["tls" "lwt_ssl"] diff --git a/httpaf-lwt.opam b/httpaf-lwt.opam index 3afc8bd..0e3a0d3 100644 --- a/httpaf-lwt.opam +++ b/httpaf-lwt.opam @@ -15,7 +15,7 @@ build: [ depends: [ "ocaml" {>= "4.03.0"} "httpaf" - "dune" {build} + "dune" "lwt" ] pin-depends: [ diff --git a/httpaf-mirage.opam b/httpaf-mirage.opam index 15539fb..e030cc2 100644 --- a/httpaf-mirage.opam +++ b/httpaf-mirage.opam @@ -17,7 +17,7 @@ depends: [ "httpaf-lwt" "conduit-mirage" "cstruct" - "dune" {build} + "dune" "lwt" ] pin-depends: [ diff --git a/httpaf.opam b/httpaf.opam index 5575973..e52f257 100644 --- a/httpaf.opam +++ b/httpaf.opam @@ -12,7 +12,7 @@ build: [ ] depends: [ "ocaml" {>= "4.03.0"} - "dune" {build} + "dune" "alcotest" {with-test} "bigstringaf" {>= "0.4.0"} "angstrom" {>= "0.9.0"} diff --git a/lwt-unix/dune b/lwt-unix/dune index d25cae5..e4856b2 100644 --- a/lwt-unix/dune +++ b/lwt-unix/dune @@ -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 ()