commit:     1cab272249d1ab098a17a023cc5b1d3a83eaeaf0
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 31 19:00:21 2023 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Tue Jan 31 19:10:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cab2722

dev-ml/extlib: update EAPI 7 -> 8

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 dev-ml/extlib/extlib-1.7.7-r1.ebuild               | 60 ++++++++++++++++++++++
 .../files/0001-Add-support-for-OCaml-4.12.patch    | 25 +++++++++
 ...niv_param-was-removed-for-OCaml-pre-4.00-.patch | 38 ++++++++++++++
 3 files changed, 123 insertions(+)

diff --git a/dev-ml/extlib/extlib-1.7.7-r1.ebuild 
b/dev-ml/extlib/extlib-1.7.7-r1.ebuild
new file mode 100644
index 000000000000..b21b2aaa3217
--- /dev/null
+++ b/dev-ml/extlib/extlib-1.7.7-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit findlib vcs-clean
+
+DESCRIPTION="Standard library extensions for O'Caml"
+HOMEPAGE="https://github.com/ygrek/ocaml-extlib";
+SRC_URI="https://github.com/ygrek/ocaml-extlib/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux 
~ppc-macos"
+IUSE="doc +ocamlopt"
+
+# See bug #704146
+BDEPEND=">=dev-ml/cppo-1.6.6"
+RDEPEND="dev-lang/ocaml:=[ocamlopt?]"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.7.7-no-git.patch
+       "${FILESDIR}"/0001-Add-support-for-OCaml-4.12.patch
+       
"${FILESDIR}"/0002-caml_hash_univ_param-was-removed-for-OCaml-pre-4.00-.patch
+)
+
+S="${WORKDIR}/ocaml-${P}"
+
+src_prepare() {
+       default
+       egit_clean
+}
+
+src_compile() {
+       cd src || die
+       emake -j1 all
+       if use ocamlopt; then
+               emake opt cmxs
+       fi
+
+       if use doc; then
+               emake doc
+       fi
+}
+
+src_test() {
+       emake -j1 test
+}
+
+src_install() {
+       findlib_src_install
+
+       # install documentation
+       dodoc README.md
+
+       if use doc; then
+               dodoc -r src/doc/
+       fi
+}

diff --git a/dev-ml/extlib/files/0001-Add-support-for-OCaml-4.12.patch 
b/dev-ml/extlib/files/0001-Add-support-for-OCaml-4.12.patch
new file mode 100644
index 000000000000..8a2d076f8224
--- /dev/null
+++ b/dev-ml/extlib/files/0001-Add-support-for-OCaml-4.12.patch
@@ -0,0 +1,25 @@
+From 3b2073701aed50cd768e0a4cd3c776c7a3a54d7e Mon Sep 17 00:00:00 2001
+From: Kate <[email protected]>
+Date: Thu, 5 Nov 2020 22:17:24 +0000
+Subject: [PATCH 1/2] Add support for OCaml 4.12
+
+---
+ src/extList.ml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/extList.ml b/src/extList.ml
+index 4f0057f..a1435ee 100644
+--- a/src/extList.ml
++++ b/src/extList.ml
+@@ -380,7 +380,7 @@ let combine l1 l2 =
+   loop dummy l1 l2;
+   dummy.tl
+ 
+-let sort ?(cmp=compare) = List.sort cmp
++let sort ?(cmp=Pervasives.compare) = List.sort cmp
+ 
+ #if OCAML < 406
+ let rec init size f =
+-- 
+2.30.0
+

diff --git 
a/dev-ml/extlib/files/0002-caml_hash_univ_param-was-removed-for-OCaml-pre-4.00-.patch
 
b/dev-ml/extlib/files/0002-caml_hash_univ_param-was-removed-for-OCaml-pre-4.00-.patch
new file mode 100644
index 000000000000..59a6843f3a15
--- /dev/null
+++ 
b/dev-ml/extlib/files/0002-caml_hash_univ_param-was-removed-for-OCaml-pre-4.00-.patch
@@ -0,0 +1,38 @@
+From 574e8eae2d358b6db62c2d062b194a7aa06ac02c Mon Sep 17 00:00:00 2001
+From: Kate <[email protected]>
+Date: Fri, 6 Nov 2020 14:10:26 +0000
+Subject: [PATCH 2/2] caml_hash_univ_param was removed for OCaml (pre-4.00
+ function)
+
+---
+ src/extHashtbl.ml | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/extHashtbl.ml b/src/extHashtbl.ml
+index 140e9c2..3c69df4 100644
+--- a/src/extHashtbl.ml
++++ b/src/extHashtbl.ml
+@@ -22,7 +22,7 @@
+ module Hashtbl =
+   struct
+ 
+-#if OCAML >= 400
++#if OCAML >= 400 && OCAML < 412
+   external old_hash_param :
+     int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc"
+ #endif
+@@ -114,7 +114,11 @@ module Hashtbl =
+     (* compatibility with old hash tables *)
+     if Obj.size (Obj.repr h) >= 3
+     then (seeded_hash_param 10 100 (h_conv h).seed key) land (Array.length 
(h_conv h).data - 1)
++  #if OCAML >= 412
++    else failwith "Old hash function not supported anymore"
++  #else
+     else (old_hash_param 10 100 key) mod (Array.length (h_conv h).data)
++  #endif
+ #else
+   let key_index h key = (hash key) mod (Array.length (h_conv h).data)
+ #endif
+-- 
+2.30.0
+

Reply via email to