From 56013d6071db66e97a6a7193594792b595610f3a Mon Sep 17 00:00:00 2001 From: Alexis Ballier Date: Wed, 7 Sep 2016 11:33:53 +0200 Subject: dev-ml/eliom: backport another patch from upstream to work with ocaml 4.03 Package-Manager: portage-2.3.0 --- dev-ml/eliom/eliom-5.0.0-r1.ebuild | 66 ------------------ dev-ml/eliom/eliom-5.0.0-r2.ebuild | 66 ++++++++++++++++++ dev-ml/eliom/files/oc43-2.patch | 136 +++++++++++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 66 deletions(-) delete mode 100644 dev-ml/eliom/eliom-5.0.0-r1.ebuild create mode 100644 dev-ml/eliom/eliom-5.0.0-r2.ebuild create mode 100644 dev-ml/eliom/files/oc43-2.patch (limited to 'dev-ml') diff --git a/dev-ml/eliom/eliom-5.0.0-r1.ebuild b/dev-ml/eliom/eliom-5.0.0-r1.ebuild deleted file mode 100644 index 8aaec1f4701e..000000000000 --- a/dev-ml/eliom/eliom-5.0.0-r1.ebuild +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI=5 - -inherit eutils multilib findlib - -DESCRIPTION="A web framework to program client/server applications" -HOMEPAGE="http://ocsigen.org/eliom/" -SRC_URI="https://github.com/ocsigen/eliom/archive/${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="LGPL-2.1-with-linking-exception" -SLOT="0/${PV}" -KEYWORDS="~amd64" -IUSE="doc +ocamlopt +ppx" - -RDEPEND=">=dev-lang/ocaml-4.00:=[ocamlopt?] - >=dev-ml/js_of_ocaml-2.5-r1:= - >=www-servers/ocsigenserver-2.5:= - >=dev-ml/tyxml-3.6:= - >=dev-ml/deriving-0.6:= - >=dev-ml/reactiveData-0.2:= - dev-ml/ocaml-ipaddr:= - dev-ml/react:= - dev-ml/ocaml-ssl:= - >=dev-ml/lwt-2.5.0:= - dev-ml/calendar:= - dev-ml/camlp4:= - ppx? ( >=dev-ml/ppx_tools-0.99.3:= )" -DEPEND="${RDEPEND} - dev-ml/ocamlbuild - dev-ml/opam" - -src_prepare() { - if has_version '>=dev-lang/ocaml-4.03' ; then - epatch "${FILESDIR}/"{camlp4,oc43}.patch - fi - has_version '>=dev-ml/tyxml-4' && epatch "${FILESDIR}/tyxml4.patch" -} - -src_compile() { - if use ocamlopt ; then - emake PPX=$(usex ppx true false) all - else - emake PPX=$(usex ppx true false) byte - fi - use doc && emake doc - emake man -} - -src_install() { - opam-installer \ - --prefix="${ED}/usr" \ - --libdir="${D}/$(ocamlc -where)" \ - --docdir="${ED}/usr/share/doc/${PF}" \ - --mandir="${ED}/usr/share/man" \ - || die - dodoc CHANGES README.md - if use doc ; then - docinto client/html - dodoc -r _build/src/lib/client/api.docdir/* - docinto server/html - dodoc -r _build/src/lib/server/api.docdir/* - fi -} diff --git a/dev-ml/eliom/eliom-5.0.0-r2.ebuild b/dev-ml/eliom/eliom-5.0.0-r2.ebuild new file mode 100644 index 000000000000..36923d1d2546 --- /dev/null +++ b/dev-ml/eliom/eliom-5.0.0-r2.ebuild @@ -0,0 +1,66 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit eutils multilib findlib + +DESCRIPTION="A web framework to program client/server applications" +HOMEPAGE="http://ocsigen.org/eliom/" +SRC_URI="https://github.com/ocsigen/eliom/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="LGPL-2.1-with-linking-exception" +SLOT="0/${PV}" +KEYWORDS="~amd64" +IUSE="doc +ocamlopt +ppx" + +RDEPEND=">=dev-lang/ocaml-4.00:=[ocamlopt?] + >=dev-ml/js_of_ocaml-2.5-r1:= + >=www-servers/ocsigenserver-2.5:= + >=dev-ml/tyxml-3.6:= + >=dev-ml/deriving-0.6:= + >=dev-ml/reactiveData-0.2:= + dev-ml/ocaml-ipaddr:= + dev-ml/react:= + dev-ml/ocaml-ssl:= + >=dev-ml/lwt-2.5.0:= + dev-ml/calendar:= + dev-ml/camlp4:= + ppx? ( >=dev-ml/ppx_tools-0.99.3:= )" +DEPEND="${RDEPEND} + dev-ml/ocamlbuild + dev-ml/opam" + +src_prepare() { + if has_version '>=dev-lang/ocaml-4.03' ; then + epatch "${FILESDIR}/"{camlp4,oc43,oc43-2}.patch + fi + has_version '>=dev-ml/tyxml-4' && epatch "${FILESDIR}/tyxml4.patch" +} + +src_compile() { + if use ocamlopt ; then + emake PPX=$(usex ppx true false) all + else + emake PPX=$(usex ppx true false) byte + fi + use doc && emake doc + emake man +} + +src_install() { + opam-installer \ + --prefix="${ED}/usr" \ + --libdir="${D}/$(ocamlc -where)" \ + --docdir="${ED}/usr/share/doc/${PF}" \ + --mandir="${ED}/usr/share/man" \ + || die + dodoc CHANGES README.md + if use doc ; then + docinto client/html + dodoc -r _build/src/lib/client/api.docdir/* + docinto server/html + dodoc -r _build/src/lib/server/api.docdir/* + fi +} diff --git a/dev-ml/eliom/files/oc43-2.patch b/dev-ml/eliom/files/oc43-2.patch new file mode 100644 index 000000000000..c7eb8e25a01a --- /dev/null +++ b/dev-ml/eliom/files/oc43-2.patch @@ -0,0 +1,136 @@ +commit 27c69ac5dfbc26744e304232bb8c0cf22d396082 +Author: Vasilis Papavasileiou +Date: Thu May 5 11:14:02 2016 -0400 + + Fix PPX for 4.03 (empty let bindings) + +diff --git a/src/ppx/ppx_eliom_client.ml b/src/ppx/ppx_eliom_client.ml +index 580d2b5..fb2d263 100644 +--- a/src/ppx/ppx_eliom_client.ml ++++ b/src/ppx/ppx_eliom_client.ml +@@ -89,21 +89,25 @@ module Pass = struct + ] + + let define_client_functions ~loc client_value_datas = +- let bindings = +- List.map +- (fun (_num, id, expr, args) -> +- let patt = Pat.var id in +- let typ = find_fragment id in +- let args = List.map Pat.var args in +- let expr = +- [%expr +- fun [%p pat_args args] -> ([%e expr] : [%t typ]) +- ] [@metaloc loc] +- in +- Vb.mk ~loc patt expr) +- client_value_datas +- in +- Str.value ~loc Nonrecursive bindings ++ match client_value_datas with ++ | [] -> ++ [] ++ | _ -> ++ let bindings = ++ List.map ++ (fun (_num, id, expr, args) -> ++ let patt = Pat.var id in ++ let typ = find_fragment id in ++ let args = List.map Pat.var args in ++ let expr = ++ [%expr ++ fun [%p pat_args args] -> ([%e expr] : [%t typ]) ++ ] [@metaloc loc] ++ in ++ Vb.mk ~loc patt expr) ++ client_value_datas ++ in ++ [Str.value ~loc Nonrecursive bindings] + + (* For injections *) + +@@ -139,8 +143,8 @@ module Pass = struct + let client_expr_data = flush_client_value_datas () in + open_client_section loc :: + register_client_closures client_expr_data @ +- [ define_client_functions loc client_expr_data ; +- item ; ++ define_client_functions loc client_expr_data @ ++ [ item ; + close_server_section loc ; + ] + +@@ -155,11 +159,13 @@ module Pass = struct + push_client_value_data num id expr + (List.map fst escaped_bindings); + +- match context with +- | `Server -> ++ match context, escaped_bindings with ++ | `Server, _ -> + (* We are in a server fragment, this code should always be discarded. *) + Exp.extension @@ AM.extension_of_error @@ Location.errorf "Eliom: ICE" +- | `Shared -> ++ | `Shared, [] -> ++ [%expr [%e frag_eid] ()][@metaloc loc] ++ | `Shared, _ -> + let bindings = + List.map + (fun (gen_id, expr) -> +diff --git a/src/ppx/ppx_eliom_server.ml b/src/ppx/ppx_eliom_server.ml +index 97f0b53..b5238ad 100644 +--- a/src/ppx/ppx_eliom_server.ml ++++ b/src/ppx/ppx_eliom_server.ml +@@ -85,6 +85,7 @@ module Pass = struct + let $gen_id$ = $orig_expr$ and ... + (Necessary for injections in shared section) *) + let bind_injected_idents injections = ++ assert (injections <> []); + let bindings = + List.map + (fun (txt, expr,_) -> +@@ -134,10 +135,15 @@ module Pass = struct + + let client_str item = + let all_injections = flush_injections () in +- let loc = item.pstr_loc in +- [ bind_injected_idents all_injections; ++ let ccs = ++ let loc = item.pstr_loc in + close_client_section loc all_injections +- ] ++ in ++ match all_injections with ++ | [] -> ++ [ ccs ] ++ | l -> ++ [ bind_injected_idents l ; ccs ] + + let server_str item = [ + item ; +@@ -146,12 +152,19 @@ module Pass = struct + + let shared_str item = + let all_injections = flush_injections () in +- let loc = item.pstr_loc in +- [ bind_injected_idents all_injections ; +- item ; +- close_server_section loc ; +- close_client_section loc all_injections ; +- ] ++ let cl = ++ let loc = item.pstr_loc in ++ [ ++ item; ++ close_server_section loc ; ++ close_client_section loc all_injections ; ++ ] ++ in ++ match all_injections with ++ | [] -> ++ cl ++ | l -> ++ bind_injected_idents l :: cl + + let fragment ?typ ~context:_ ~num ~id expr = + let typ = -- cgit v1.2.3-65-gdbad