From 31b3f7e5e859dab9e6f718a3187812378abc2ac0 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 4 Jul 2017 13:56:39 -0400 Subject: [PATCH] Port to jbuilder Removes the previous topkg/ocamlbuild setup in favor of jbuilder/topkg. This splits tls into 3 packages: tls, tls-lwt, and tls-mirage. Since we're still using topkg, the publishing workflow should be the same as before. Users of tls shouldn't notice any breakage, as the META is still preserving the old tls.{mirage,lwt} as subpackages. However, these will now require the appropriate opam sub packages to be installed to work. --- META.tls.template | 11 +++++++++ doc/api.odocl | 8 ------- lib/jbuild | 8 +++++++ lib/tls.mllib | 1 - lib/tls.mlpack | 16 -------------- lwt/examples/jbuild | 21 ++++++++++++++++++ lwt/jbuild | 8 +++++++ lwt/tls-lwt.mllib | 2 -- mirage/jbuild | 8 +++++++ mirage/tls-mirage.mllib | 1 - opam | 49 ----------------------------------------- pkg/META | 30 ------------------------- pkg/pkg.ml | 33 +-------------------------- tests/jbuild | 10 +++++++++ tls-lwt.opam | 28 +++++++++++++++++++++++ tls-mirage.opam | 31 ++++++++++++++++++++++++++ tls.opam | 30 +++++++++++++++++++++++++ 17 files changed, 156 insertions(+), 139 deletions(-) create mode 100644 META.tls.template delete mode 100644 doc/api.odocl create mode 100644 lib/jbuild delete mode 100644 lib/tls.mllib delete mode 100644 lib/tls.mlpack create mode 100644 lwt/examples/jbuild create mode 100644 lwt/jbuild delete mode 100644 lwt/tls-lwt.mllib create mode 100644 mirage/jbuild delete mode 100644 mirage/tls-mirage.mllib delete mode 100644 opam delete mode 100644 pkg/META create mode 100644 tests/jbuild create mode 100644 tls-lwt.opam create mode 100644 tls-mirage.opam create mode 100644 tls.opam diff --git a/META.tls.template b/META.tls.template new file mode 100644 index 00000000..05dab4ee --- /dev/null +++ b/META.tls.template @@ -0,0 +1,11 @@ +# JBUILDER_GEN + +package "mirage" ( + description = "Deprecated. Use tls-mirage" + requires = "tls-mirage" +) + +package "lwt" ( + description = "Deprecated. Use tls-lwt" + requires = "tls-lwt" +) \ No newline at end of file diff --git a/doc/api.odocl b/doc/api.odocl deleted file mode 100644 index 4905e856..00000000 --- a/doc/api.odocl +++ /dev/null @@ -1,8 +0,0 @@ -lib/Engine -lib/Config -lib/Packet -lib/Ciphersuite -lib/Core -lwt/Tls_lwt -lwt/X509_lwt -mirage/Tls_mirage diff --git a/lib/jbuild b/lib/jbuild new file mode 100644 index 00000000..2c8e3a58 --- /dev/null +++ b/lib/jbuild @@ -0,0 +1,8 @@ +(jbuild_version 1) + +(library + ((name tls) + (public_name tls) + (synopsis "Transport layer security (TLS 1.x) purely in OCaml") + (preprocess (pps (ppx_cstruct ppx_sexp_conv -no-check))) + (libraries (cstruct nocrypto result x509 sexplib)))) \ No newline at end of file diff --git a/lib/tls.mllib b/lib/tls.mllib deleted file mode 100644 index acd35e66..00000000 --- a/lib/tls.mllib +++ /dev/null @@ -1 +0,0 @@ -Tls \ No newline at end of file diff --git a/lib/tls.mlpack b/lib/tls.mlpack deleted file mode 100644 index 26278d33..00000000 --- a/lib/tls.mlpack +++ /dev/null @@ -1,16 +0,0 @@ -Tracing -Ciphersuite -Packet -Core -Reader -Writer -Config -Engine -Control -Crypto -Utils -State -Handshake_common -Handshake_crypto -Handshake_server -Handshake_client diff --git a/lwt/examples/jbuild b/lwt/examples/jbuild new file mode 100644 index 00000000..fe0bd2fe --- /dev/null +++ b/lwt/examples/jbuild @@ -0,0 +1,21 @@ +(jbuild_version 1) + +(executables + ((names + (starttls_server + echo_server + echo_server_sni + echo_client + test_server + test_client)) + (libraries (tls-lwt str)))) + +(alias + ((name DEFAULT) + (deps + (starttls_server.exe + echo_server.exe + echo_server_sni.exe + echo_client.exe + test_server.exe + test_client.exe)))) \ No newline at end of file diff --git a/lwt/jbuild b/lwt/jbuild new file mode 100644 index 00000000..afe09bc1 --- /dev/null +++ b/lwt/jbuild @@ -0,0 +1,8 @@ +(jbuild_version 1) + +(library + ((name tls_lwt) + (public_name tls-lwt) + (synopsis "Effectful lwt layer for TLS") + (libraries (lwt lwt.unix tls nocrypto.lwt x509)) + (wrapped false))) \ No newline at end of file diff --git a/lwt/tls-lwt.mllib b/lwt/tls-lwt.mllib deleted file mode 100644 index 02527e96..00000000 --- a/lwt/tls-lwt.mllib +++ /dev/null @@ -1,2 +0,0 @@ -Tls_lwt -X509_lwt diff --git a/mirage/jbuild b/mirage/jbuild new file mode 100644 index 00000000..a2c5071c --- /dev/null +++ b/mirage/jbuild @@ -0,0 +1,8 @@ +(jbuild_version 1) + +(library + ((name tls_mirage) + (public_name tls-mirage) + (synopsis "Effectful mirage layer for TLS") + (wrapped false) + (libraries (tls mirage-flow-lwt mirage-kv-lwt mirage-clock lwt ptime)))) \ No newline at end of file diff --git a/mirage/tls-mirage.mllib b/mirage/tls-mirage.mllib deleted file mode 100644 index 47c70918..00000000 --- a/mirage/tls-mirage.mllib +++ /dev/null @@ -1 +0,0 @@ -Tls_mirage diff --git a/opam b/opam deleted file mode 100644 index 489d17ce..00000000 --- a/opam +++ /dev/null @@ -1,49 +0,0 @@ -opam-version: "1.2" -name: "tls" -homepage: "https://github.com/mirleft/ocaml-tls" -dev-repo: "https://github.com/mirleft/ocaml-tls.git" -bug-reports: "https://github.com/mirleft/ocaml-tls/issues" -doc: "https://mirleft.github.io/ocaml-tls/doc" -author: ["David Kaloper " "Hannes Mehnert "] -maintainer: ["Hannes Mehnert " "David Kaloper "] -license: "BSD2" - -build: [ - [ "ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" - "--tests" "false" - "--with-lwt" "%{lwt:installed}%" - "--with-mirage" "%{mirage-flow-lwt+mirage-kv-lwt+mirage-clock:installed}%" ] -] -build-test: [ - ["ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" "--tests" "true"] - ["ocaml" "pkg/pkg.ml" "test"] -] - -depends: [ - "ocamlfind" {build} - "ocamlbuild" {build} - "topkg" {build} - "ppx_tools" {build} - "ppx_sexp_conv" {build} - "result" - "cstruct" {>= "1.9.0"} - "sexplib" - "nocrypto" {>= "0.5.4"} - "x509" {>= "0.5.0"} - "ounit" {test} - "ptime" {>= "0.8.1"} (* only necessary for mirage subpackage, but unable to express this here *) -] -depopts: [ - "lwt" - "mirage-flow-lwt" - "mirage-kv-lwt" - "mirage-clock" -] -conflicts: [ - "lwt" {<"2.4.8"} - "mirage-net-xen" {<"1.3.0"} - "mirage-types" {<"3.0.0"} -] - -tags: [ "org:mirage"] -available: [ ocaml-version >= "4.02.2" ] diff --git a/pkg/META b/pkg/META deleted file mode 100644 index a32febad..00000000 --- a/pkg/META +++ /dev/null @@ -1,30 +0,0 @@ -version = "%%VERSION_NUM%%" -description = "Transport layer security (TLS 1.x) purely in OCaml" -requires = "cstruct sexplib result nocrypto x509" -archive(byte) = "tls.cma" -plugin(byte) = "tls.cma" -archive(native) = "tls.cmxa" -plugin(native) = "tls.cmxs" -exists_if = "tls.cma" - -package "mirage" ( - version = "%%VERSION_NUM%%" - description = "Effectful mirage layer for TLS" - requires = "x509 tls mirage-flow-lwt mirage-kv-lwt mirage-clock lwt ptime" - archive(byte) = "tls-mirage.cma" - plugin(byte) = "tls-mirage.cma" - archive(native) = "tls-mirage.cmxa" - plugin(native) = "tls-mirage.cmxs" - exists_if = "tls-mirage.cma" -) - -package "lwt" ( - version = "%%VERSION_NUM%%" - description = "Effectful lwt layer for TLS" - requires = "x509 tls lwt lwt.unix cstruct.lwt nocrypto.lwt" - archive(byte) = "tls-lwt.cma" - plugin(byte) = "tls-lwt.cma" - archive(native) = "tls-lwt.cmxa" - plugin(native) = "tls-lwt.cmxs" - exists_if = "tls-lwt.cma" -) diff --git a/pkg/pkg.ml b/pkg/pkg.ml index 17f3154a..1a04c2b4 100755 --- a/pkg/pkg.ml +++ b/pkg/pkg.ml @@ -1,33 +1,2 @@ -#!/usr/bin/env ocaml #use "topfind" -#require "topkg" -open Topkg - -let lwt = Conf.with_pkg ~default:false "lwt" -let mirage = Conf.with_pkg ~default:false "mirage" - -let opams = - let lint_deps_excluding = - Some ["ounit"; "oUnit"; "ppx_tools"] - in - [Pkg.opam_file ~lint_deps_excluding "opam"] - -let () = - Pkg.describe ~opams "tls" @@ fun c -> - let lwt = Conf.value c lwt - and mirage = Conf.value c mirage - in - let exts = Exts.(cmx @ library @ exts [".cmi" ; ".cmt" ]) in - Ok [ - Pkg.lib ~exts "lib/tls" ; - Pkg.mllib ~cond:lwt "lwt/tls-lwt.mllib" ; - Pkg.mllib ~cond:mirage "mirage/tls-mirage.mllib" ; - Pkg.test "tests/unittestrunner" ; - Pkg.test ~run:false "tests/feedback" ; - Pkg.test ~run:false ~cond:lwt "lwt/examples/starttls_server" ; - Pkg.test ~run:false ~cond:lwt "lwt/examples/echo_server" ; - Pkg.test ~run:false ~cond:lwt "lwt/examples/echo_server_sni" ; - Pkg.test ~run:false ~cond:lwt "lwt/examples/echo_client" ; - Pkg.test ~run:false ~cond:lwt "lwt/examples/test_server" ; - Pkg.test ~run:false ~cond:lwt "lwt/examples/test_client" ; - ] +#require "topkg-jbuilder.auto" diff --git a/tests/jbuild b/tests/jbuild new file mode 100644 index 00000000..aa7dfda2 --- /dev/null +++ b/tests/jbuild @@ -0,0 +1,10 @@ +(jbuild_version 1) + +(executable + ((name unittestrunner) + (libraries (tls nocrypto cstruct-unix oUnit)))) + +(alias + ((name runtest) + (deps (unittestrunner.exe)) + (action (run ${<})))) \ No newline at end of file diff --git a/tls-lwt.opam b/tls-lwt.opam new file mode 100644 index 00000000..c8527f44 --- /dev/null +++ b/tls-lwt.opam @@ -0,0 +1,28 @@ +opam-version: "1.2" +homepage: "https://github.com/mirleft/ocaml-tls" +dev-repo: "https://github.com/mirleft/ocaml-tls.git" +bug-reports: "https://github.com/mirleft/ocaml-tls/issues" +doc: "https://mirleft.github.io/ocaml-tls/doc" +author: ["David Kaloper " "Hannes Mehnert "] +maintainer: ["Hannes Mehnert " "David Kaloper "] +license: "BSD2" + +build: [ + ["jbuilder" "subst" "-n" name] {pinned} + ["jbuilder" "build" "-p" name "-j" jobs] +] +build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] + +depends: [ + "jbuilder" {build & >= "1.0+beta10"} + "tls" + "lwt" {>= "2.4.8"} + "result" + "cstruct" {>= "1.9.0"} + "sexplib" + "nocrypto" {>= "0.5.4"} + "x509" {>= "0.5.0"} +] + +tags: [ "org:mirage"] +available: [ ocaml-version >= "4.02.3" ] \ No newline at end of file diff --git a/tls-mirage.opam b/tls-mirage.opam new file mode 100644 index 00000000..45c98517 --- /dev/null +++ b/tls-mirage.opam @@ -0,0 +1,31 @@ +opam-version: "1.2" +homepage: "https://github.com/mirleft/ocaml-tls" +dev-repo: "https://github.com/mirleft/ocaml-tls.git" +bug-reports: "https://github.com/mirleft/ocaml-tls/issues" +doc: "https://mirleft.github.io/ocaml-tls/doc" +author: ["David Kaloper " "Hannes Mehnert "] +maintainer: ["Hannes Mehnert " "David Kaloper "] +license: "BSD2" + +build: [ + ["jbuilder" "subst" "-n" name] {pinned} + ["jbuilder" "build" "-p" name "-j" jobs] +] +build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] + +depends: [ + "jbuilder" {build & >= "1.0+beta10"} + "tls" + "result" + "lwt" {>= "2.4.8"} + "cstruct" {>= "1.9.0"} + "mirage-net-xen" {>= "1.3.0"} + "mirage-types" {>= "3.0.0"} + "sexplib" + "nocrypto" {>= "0.5.4"} + "x509" {>= "0.5.0"} + "ptime" {>= "0.8.1"} +] + +tags: [ "org:mirage"] +available: [ ocaml-version >= "4.02.3" ] \ No newline at end of file diff --git a/tls.opam b/tls.opam new file mode 100644 index 00000000..a5454e97 --- /dev/null +++ b/tls.opam @@ -0,0 +1,30 @@ +opam-version: "1.2" +homepage: "https://github.com/mirleft/ocaml-tls" +dev-repo: "https://github.com/mirleft/ocaml-tls.git" +bug-reports: "https://github.com/mirleft/ocaml-tls/issues" +doc: "https://mirleft.github.io/ocaml-tls/doc" +author: ["David Kaloper " "Hannes Mehnert "] +maintainer: ["Hannes Mehnert " "David Kaloper "] +license: "BSD2" + +build: [ + ["jbuilder" "subst" "-n" name] {pinned} + ["jbuilder" "build" "-p" name "-j" jobs] +] +build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] + +depends: [ + "jbuilder" {build & >= "1.0+beta10"} + "ppx_sexp_conv" {build} + "ppx_cstruct" {build} + "result" + "cstruct" {>= "1.9.0"} + "sexplib" + "nocrypto" {>= "0.5.4"} + "x509" {>= "0.5.0"} + "ounit" {test} + "cstruct-unix" {test} +] + +tags: [ "org:mirage"] +available: [ ocaml-version >= "4.02.3" ]