Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ml/ppx_optcomp/, dev-ml/ppx_optcomp/files/
Date: Tue, 03 May 2016 09:14:48
Message-Id: 1462266832.bc71c7dce7157facf5fc5335bac1bbf9cc5a9d9b.aballier@gentoo
1 commit: bc71c7dce7157facf5fc5335bac1bbf9cc5a9d9b
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 1 18:09:14 2016 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Tue May 3 09:13:52 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc71c7dc
7
8 dev-ml/ppx_optcomp: fix build with ocaml 4.03
9
10 Package-Manager: portage-2.2.28
11 Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>
12
13 dev-ml/ppx_optcomp/files/oc43.patch | 93 +++++++++++++++++++++++++
14 dev-ml/ppx_optcomp/ppx_optcomp-113.33.00.ebuild | 6 +-
15 2 files changed, 98 insertions(+), 1 deletion(-)
16
17 diff --git a/dev-ml/ppx_optcomp/files/oc43.patch b/dev-ml/ppx_optcomp/files/oc43.patch
18 new file mode 100644
19 index 0000000..6203c07
20 --- /dev/null
21 +++ b/dev-ml/ppx_optcomp/files/oc43.patch
22 @@ -0,0 +1,93 @@
23 +diff -uNr ppx_optcomp-113.33.00/_oasis ppx_optcomp-113.33.00+4.03/_oasis
24 +--- ppx_optcomp-113.33.00/_oasis 2016-03-09 16:44:54.000000000 +0100
25 ++++ ppx_optcomp-113.33.00+4.03/_oasis 2016-03-22 15:13:51.000000000 +0100
26 +@@ -1,8 +1,8 @@
27 + OASISFormat: 0.4
28 +-OCamlVersion: >= 4.02.3
29 ++OCamlVersion: >= 4.03.0
30 + FindlibVersion: >= 1.3.2
31 + Name: ppx_optcomp
32 +-Version: 113.33.00
33 ++Version: 113.33.00+4.03
34 + Synopsis: Optional compilation for OCaml
35 + Authors: Jane Street Group, LLC <opensource@××××××××××.com>
36 + Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@××××××××××.com>
37 +diff -uNr ppx_optcomp-113.33.00/opam ppx_optcomp-113.33.00+4.03/opam
38 +--- ppx_optcomp-113.33.00/opam 2016-03-18 12:08:01.000000000 +0100
39 ++++ ppx_optcomp-113.33.00+4.03/opam 2016-03-22 17:51:37.000000000 +0100
40 +@@ -15,4 +15,4 @@
41 + "ppx_core"
42 + "ppx_tools" {>= "0.99.3"}
43 + ]
44 +-available: [ ocaml-version >= "4.02.3" ]
45 ++available: [ ocaml-version >= "4.03.0" ]
46 +diff -uNr ppx_optcomp-113.33.00/src/ppx_optcomp.ml ppx_optcomp-113.33.00+4.03/src/ppx_optcomp.ml
47 +--- ppx_optcomp-113.33.00/src/ppx_optcomp.ml 2016-03-09 16:44:54.000000000 +0100
48 ++++ ppx_optcomp-113.33.00+4.03/src/ppx_optcomp.ml 2016-03-22 15:13:51.000000000 +0100
49 +@@ -169,12 +169,19 @@
50 + Location.raise_errorf ~loc:e.pexp_loc "optcomp: expression not supported"
51 + ;;
52 +
53 ++let parse_int loc x =
54 ++ match int_of_string x with
55 ++ | v -> v
56 ++ | exception _ ->
57 ++ Location.raise_errorf ~loc "optcomp: invalid integer"
58 ++;;
59 ++
60 + let rec eval env e : Value.t =
61 + let loc = e.pexp_loc in
62 + match e.pexp_desc with
63 +- | Pexp_constant (Const_int x ) -> Int x
64 +- | Pexp_constant (Const_char x ) -> Char x
65 +- | Pexp_constant (Const_string (x, _)) -> String x
66 ++ | Pexp_constant (Pconst_integer (x, None)) -> Int (parse_int loc x)
67 ++ | Pexp_constant (Pconst_char x ) -> Char x
68 ++ | Pexp_constant (Pconst_string (x, _ )) -> String x
69 +
70 + | Pexp_construct ({ txt = Lident "true" ; _ }, None) -> Bool true
71 + | Pexp_construct ({ txt = Lident "false"; _ }, None) -> Bool false
72 +@@ -192,7 +199,7 @@
73 +
74 + | Pexp_apply ({ pexp_desc = Pexp_ident { txt = Lident s; _ }; _ }, args) -> begin
75 + let args =
76 +- List.map args ~f:(fun (l, x) -> if l <> "" then not_supported e else x)
77 ++ List.map args ~f:(fun (l, x) -> if l <> Asttypes.Nolabel then not_supported e else x)
78 + in
79 + match s, args with
80 + | "=" , [x; y] -> eval_cmp env ( = ) x y
81 +@@ -283,12 +290,13 @@
82 + | _ -> not_supported e
83 +
84 + and bind env patt value =
85 ++ let loc = patt.ppat_loc in
86 + match patt.ppat_desc, value with
87 + | Ppat_any, _ -> env
88 +
89 +- | Ppat_constant (Const_int x ), Int y when x = y -> env
90 +- | Ppat_constant (Const_char x ), Char y when x = y -> env
91 +- | Ppat_constant (Const_string (x, _)), String y when x = y -> env
92 ++ | Ppat_constant (Pconst_integer (x, None)), Int y when parse_int loc x = y -> env
93 ++ | Ppat_constant (Pconst_char x ), Char y when x = y -> env
94 ++ | Ppat_constant (Pconst_string (x, _ )), String y when x = y -> env
95 +
96 + | Ppat_construct ({ txt = Lident "true" ; _ }, None), Bool true -> env
97 + | Ppat_construct ({ txt = Lident "false"; _ }, None), Bool false -> env
98 +@@ -506,7 +514,7 @@
99 + | Pexp_construct (x, Some y) ->
100 + let id = var_of_lid x in
101 + Let (ppat_var ~loc:id.loc id, y)
102 +- | Pexp_apply (x, [("", y)]) ->
103 ++ | Pexp_apply (x, [(Nolabel, y)]) ->
104 + let id = var_of_expr x in
105 + Let (ppat_var ~loc:id.loc id, y)
106 + | _ ->
107 +@@ -517,7 +525,7 @@
108 + | LIDENT "import" -> begin
109 + let e = get_expr () in
110 + match e.pexp_desc with
111 +- | Pexp_constant (Const_string (s, _)) -> Import s
112 ++ | Pexp_constant (Pconst_string (s, _)) -> Import s
113 + | _ ->
114 + Location.raise_errorf ~loc:e.pexp_loc "optcomp: #import expect a string"
115 + end
116
117 diff --git a/dev-ml/ppx_optcomp/ppx_optcomp-113.33.00.ebuild b/dev-ml/ppx_optcomp/ppx_optcomp-113.33.00.ebuild
118 index a644d2d..f3ad68d 100644
119 --- a/dev-ml/ppx_optcomp/ppx_optcomp-113.33.00.ebuild
120 +++ b/dev-ml/ppx_optcomp/ppx_optcomp-113.33.00.ebuild
121 @@ -4,7 +4,7 @@
122
123 EAPI="5"
124
125 -inherit oasis
126 +inherit oasis eutils
127
128 DESCRIPTION="Optional compilation for OCaml"
129 HOMEPAGE="http://www.janestreet.com/ocaml"
130 @@ -20,6 +20,10 @@ DEPEND="dev-ml/ppx_tools:=
131
132 RDEPEND="${DEPEND}"
133
134 +src_prepare() {
135 + has_version '>=dev-lang/ocaml-4.03' && epatch "${FILESDIR}/oc43.patch"
136 +}
137 +
138 src_configure() {
139 emake setup.exe
140 OASIS_SETUP_COMMAND="./setup.exe" oasis_src_configure