From bdaedbe38ce73f874004afdb49658caaaf014b35 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Fri, 28 Sep 2018 15:28:36 +0000 Subject: [PATCH] ocamlPackages.ocaml_lwt: 3.3.0 -> 4.1.0 --- pkgs/development/ocaml-modules/cohttp/lwt.nix | 4 +-- .../development/ocaml-modules/conduit/lwt.nix | 4 +-- .../lwt/{default.nix => 3.x.nix} | 0 pkgs/development/ocaml-modules/lwt/4.x.nix | 35 +++++++++++++++++++ .../ocaml-modules/lwt_log/default.nix | 15 ++++++-- .../ocaml-modules/lwt_ssl/default.nix | 4 +++ .../ocaml-modules/ojquery/default.nix | 4 +-- pkgs/top-level/ocaml-packages.nix | 34 +++++++++++++----- 8 files changed, 82 insertions(+), 18 deletions(-) rename pkgs/development/ocaml-modules/lwt/{default.nix => 3.x.nix} (100%) create mode 100644 pkgs/development/ocaml-modules/lwt/4.x.nix diff --git a/pkgs/development/ocaml-modules/cohttp/lwt.nix b/pkgs/development/ocaml-modules/cohttp/lwt.nix index 1630bfd131e..741df5b0614 100644 --- a/pkgs/development/ocaml-modules/cohttp/lwt.nix +++ b/pkgs/development/ocaml-modules/cohttp/lwt.nix @@ -1,4 +1,4 @@ -{ stdenv, ocaml, findlib, dune, cohttp, lwt3, uri, ppx_sexp_conv }: +{ stdenv, ocaml, findlib, dune, cohttp, ocaml_lwt, uri, ppx_sexp_conv }: if !stdenv.lib.versionAtLeast cohttp.version "0.99" then cohttp @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { buildInputs = [ ocaml findlib dune uri ppx_sexp_conv ]; - propagatedBuildInputs = [ cohttp lwt3 ]; + propagatedBuildInputs = [ cohttp ocaml_lwt ]; buildPhase = "dune build -p cohttp-lwt"; } diff --git a/pkgs/development/ocaml-modules/conduit/lwt.nix b/pkgs/development/ocaml-modules/conduit/lwt.nix index 5b085239cfd..69d7132a83a 100644 --- a/pkgs/development/ocaml-modules/conduit/lwt.nix +++ b/pkgs/development/ocaml-modules/conduit/lwt.nix @@ -1,4 +1,4 @@ -{ stdenv, ocaml, findlib, dune, ppx_sexp_conv, conduit, lwt3 }: +{ stdenv, ocaml, findlib, dune, ppx_sexp_conv, conduit, ocaml_lwt }: if !stdenv.lib.versionAtLeast conduit.version "1.0" then conduit @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { buildInputs = [ ocaml findlib dune ppx_sexp_conv ]; - propagatedBuildInputs = [ conduit lwt3 ]; + propagatedBuildInputs = [ conduit ocaml_lwt ]; buildPhase = "dune build -p conduit-lwt"; } diff --git a/pkgs/development/ocaml-modules/lwt/default.nix b/pkgs/development/ocaml-modules/lwt/3.x.nix similarity index 100% rename from pkgs/development/ocaml-modules/lwt/default.nix rename to pkgs/development/ocaml-modules/lwt/3.x.nix diff --git a/pkgs/development/ocaml-modules/lwt/4.x.nix b/pkgs/development/ocaml-modules/lwt/4.x.nix new file mode 100644 index 00000000000..f43a65065b9 --- /dev/null +++ b/pkgs/development/ocaml-modules/lwt/4.x.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchzip, pkgconfig, ncurses, libev, dune +, ocaml, findlib, cppo +, ocaml-migrate-parsetree, ppx_tools_versioned, result +}: + +let inherit (stdenv.lib) optional versionAtLeast; in + +stdenv.mkDerivation rec { + version = "4.1.0"; + name = "ocaml${ocaml.version}-lwt-${version}"; + + src = fetchzip { + url = "https://github.com/ocsigen/lwt/archive/${version}.tar.gz"; + sha256 = "16wnc61kfj54z4q8sn9f5iik37pswz328hcz3z6rkza3kh3s6wmm"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ ocaml findlib dune cppo + ocaml-migrate-parsetree ppx_tools_versioned + ] ++ optional (!versionAtLeast ocaml.version "4.07") ncurses; + propagatedBuildInputs = [ libev result ]; + + configurePhase = "ocaml src/util/configure.ml -use-libev true"; + buildPhase = "jbuilder build -p lwt"; + inherit (dune) installPhase; + + meta = { + homepage = "https://ocsigen.org/lwt/"; + description = "A cooperative threads library for OCaml"; + maintainers = [ stdenv.lib.maintainers.vbgl ]; + license = stdenv.lib.licenses.lgpl21; + inherit (ocaml.meta) platforms; + }; +} + diff --git a/pkgs/development/ocaml-modules/lwt_log/default.nix b/pkgs/development/ocaml-modules/lwt_log/default.nix index 42ff2f26b7d..a3d34b190b8 100644 --- a/pkgs/development/ocaml-modules/lwt_log/default.nix +++ b/pkgs/development/ocaml-modules/lwt_log/default.nix @@ -1,10 +1,19 @@ -{ stdenv, ocaml, findlib, dune, lwt }: +{ stdenv, fetchFromGitHub, ocaml, findlib, dune, lwt }: + +if !stdenv.lib.versionAtLeast ocaml.version "4.02" +then throw "lwt_log is not available for OCaml ${ocaml.version}" +else stdenv.mkDerivation rec { - version = "1.0.0"; + version = "1.1.0"; name = "ocaml${ocaml.version}-lwt_log-${version}"; - inherit (lwt) src; + src = fetchFromGitHub { + owner = "aantron"; + repo = "lwt_log"; + rev = version; + sha256 = "1c58gkqfvyf2j11jwj2nh4iq999wj9xpnmr80hz9d0nk9fv333pi"; + }; buildInputs = [ ocaml findlib dune ]; diff --git a/pkgs/development/ocaml-modules/lwt_ssl/default.nix b/pkgs/development/ocaml-modules/lwt_ssl/default.nix index 8fbec7cd4df..a06e7252986 100644 --- a/pkgs/development/ocaml-modules/lwt_ssl/default.nix +++ b/pkgs/development/ocaml-modules/lwt_ssl/default.nix @@ -1,5 +1,9 @@ { stdenv, fetchzip, ocaml, findlib, dune, ssl, lwt }: +if !stdenv.lib.versionAtLeast ocaml.version "4.02" +then throw "lwt_ssl is not available for OCaml ${ocaml.version}" +else + stdenv.mkDerivation rec { version = "1.1.2"; name = "ocaml${ocaml.version}-lwt_ssl-${version}"; diff --git a/pkgs/development/ocaml-modules/ojquery/default.nix b/pkgs/development/ocaml-modules/ojquery/default.nix index 8cf5819c900..6b0eefe195f 100644 --- a/pkgs/development/ocaml-modules/ojquery/default.nix +++ b/pkgs/development/ocaml-modules/ojquery/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, ocaml, findlib, ocamlbuild, js_of_ocaml, js_of_ocaml-camlp4, camlp4, lwt3, react }: +{ stdenv, fetchgit, ocaml, findlib, ocamlbuild, js_of_ocaml, js_of_ocaml-camlp4, camlp4, ocaml_lwt, react }: if stdenv.lib.versionAtLeast ocaml.version "4.06" then throw "ojquery is not available for OCaml ${ocaml.version}" @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { }; buildInputs = [ ocaml findlib ocamlbuild js_of_ocaml-camlp4 camlp4 ]; - propagatedBuildInputs = [ js_of_ocaml lwt3 react ]; + propagatedBuildInputs = [ js_of_ocaml ocaml_lwt react ]; createFindlibDestdir = true; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index a6214abbc36..7de4bf3fad4 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -238,7 +238,16 @@ let easy-format = callPackage ../development/ocaml-modules/easy-format { }; - eliom = callPackage ../development/ocaml-modules/eliom { }; + eliom = callPackage ../development/ocaml-modules/eliom { + js_of_ocaml-lwt = js_of_ocaml-lwt.override { + ocaml_lwt = lwt3; + lwt_log = lib.overrideDerivation + (lwt_log.override { lwt = lwt3; }) + (_: { inherit (lwt3) src; }); + }; + lwt_react = lwt_react.override { lwt = lwt3; }; + lwt_ssl = lwt_ssl.override { lwt = lwt3; }; + }; elpi = callPackage ../development/ocaml-modules/elpi { }; @@ -401,25 +410,27 @@ let lwt2 = callPackage ../development/ocaml-modules/lwt/legacy.nix { }; lwt3 = if lib.versionOlder "4.02" ocaml.version - then callPackage ../development/ocaml-modules/lwt { } + then callPackage ../development/ocaml-modules/lwt/3.x.nix { } else throw "lwt3 is not available for OCaml ${ocaml.version}"; - ocaml_lwt = if lib.versionOlder "4.02" ocaml.version then lwt3 else lwt2; + lwt4 = callPackage ../development/ocaml-modules/lwt/4.x.nix { }; + + ocaml_lwt = if lib.versionOlder "4.02" ocaml.version then lwt4 else lwt2; lwt_log = callPackage ../development/ocaml-modules/lwt_log { - lwt = lwt3; + lwt = lwt4; }; lwt_ppx = callPackage ../development/ocaml-modules/lwt/ppx.nix { - lwt = lwt3; + lwt = ocaml_lwt; }; lwt_react = callPackage ../development/ocaml-modules/lwt_react { - lwt = lwt3; + lwt = ocaml_lwt; }; lwt_ssl = callPackage ../development/ocaml-modules/lwt_ssl { - lwt = lwt3; + lwt = ocaml_lwt; }; macaque = callPackage ../development/ocaml-modules/macaque { }; @@ -535,7 +546,10 @@ let ocplib-simplex = callPackage ../development/ocaml-modules/ocplib-simplex { }; - ocsigen_server = callPackage ../development/ocaml-modules/ocsigen-server { }; + ocsigen_server = callPackage ../development/ocaml-modules/ocsigen-server { + lwt_react = lwt_react.override { lwt = lwt3; }; + lwt_ssl = lwt_ssl.override { lwt = lwt3; }; + }; ocsigen-start = callPackage ../development/ocaml-modules/ocsigen-start { }; @@ -545,7 +559,9 @@ let odoc = callPackage ../development/ocaml-modules/odoc { }; - ojquery = callPackage ../development/ocaml-modules/ojquery { }; + ojquery = callPackage ../development/ocaml-modules/ojquery { + ocaml_lwt = lwt3; + }; omd = callPackage ../development/ocaml-modules/omd { };