gnu: ocaml-ppx-variants-conv: Patch for building with ocaml-ppxlib.
authorXinglu Chen <public@yoctocell.xyz>
Mon, 6 Sep 2021 14:06:52 +0000 (16:06 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 6 Sep 2021 21:27:40 +0000 (23:27 +0200)
The patch will make it build when building it with ocaml-ppxlib@0.23.0.

* gnu/packages/patches/ocaml-ppx-variants-ppxlib-api-change.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/ocaml.scm (ocaml-ppx-variants-conv): Apply the patch.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
gnu/local.mk
gnu/packages/ocaml.scm
gnu/packages/patches/ocaml-ppx-variants-ppxlib-api-change.patch [new file with mode: 0644]

index f848a8c..2a56c4a 100644 (file)
@@ -1522,6 +1522,7 @@ dist_patch_DATA =                                         \
   %D%/packages/patches/ocaml-dose3-Fix-for-ocaml-4.06.patch    \
   %D%/packages/patches/ocaml-dose3-dont-make-printconf.patch   \
   %D%/packages/patches/ocaml-dose3-Install-mli-cmx-etc.patch   \
+  %D%/packages/patches/ocaml-ppx-variants-ppxlib-api-change.patch      \
   %D%/packages/patches/omake-fix-non-determinism.patch \
   %D%/packages/patches/oneko-remove-nonfree-characters.patch   \
   %D%/packages/patches/onnx-optimizer-system-library.patch     \
index b6c9559..b4ec016 100644 (file)
@@ -5340,6 +5340,10 @@ definitions.")
        (uri (git-reference
              (url "https://github.com/janestreet/ppx_variants_conv")
              (commit (string-append "v" version))))
+       (patches
+        (search-patches
+         ;; Fix build when building with ocaml-ppxlib@0.23.0.
+         "ocaml-ppx-variants-ppxlib-api-change.patch"))
        (file-name (git-file-name name version))
        (sha256
         (base32
diff --git a/gnu/packages/patches/ocaml-ppx-variants-ppxlib-api-change.patch b/gnu/packages/patches/ocaml-ppx-variants-ppxlib-api-change.patch
new file mode 100644 (file)
index 0000000..b437bfb
--- /dev/null
@@ -0,0 +1,42 @@
+From 6103f6fc56f978c847ba7c1f2d9f38ee93a5e337 Mon Sep 17 00:00:00 2001
+From: Sonja Heinze <sonjaleaheinze@gmail.com>
+Date: Tue, 9 Mar 2021 12:57:47 +0100
+Subject: [PATCH] Adapt to Ppxlib's API change
+
+Ppxlib is removing Lexer.keyword_table from the API in exchange for
+the more lightweight Keyword.is_keyword.
+
+Signed-off-by: Sonja Heinze <sonjaleaheinze@gmail.com>
+---
+Patch from <https://github.com/janestreet/ppx_variants_conv/pull/9>.
+
+ ppx_variants_conv.opam   | 2 +-
+ src/ppx_variants_conv.ml | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ppx_variants_conv.opam b/ppx_variants_conv.opam
+index 7e7148d..b56040f 100644
+--- a/ppx_variants_conv.opam
++++ b/ppx_variants_conv.opam
+@@ -15,7 +15,7 @@ depends: [
+   "base"        {>= "v0.14" & < "v0.15"}
+   "variantslib" {>= "v0.14" & < "v0.15"}
+   "dune"        {>= "2.0.0"}
+-  "ppxlib"      {>= "0.14.0"}
++  "ppxlib"      {>= "0.23.0"}
+ ]
+ synopsis: "Generation of accessor and iteration functions for ocaml variant types"
+ description: "
+diff --git a/src/ppx_variants_conv.ml b/src/ppx_variants_conv.ml
+index 8d60086..112fc78 100644
+--- a/src/ppx_variants_conv.ml
++++ b/src/ppx_variants_conv.ml
+@@ -66,7 +66,7 @@ end
+ let variant_name_to_string v =
+   let s = String.lowercase v in
+-  if Caml.Hashtbl.mem Lexer.keyword_table s
++  if Keyword.is_keyword s
+   then s ^ "_"
+   else s