From fa42f269e8a60a34e7d3bad33dc1be1ae5e87842 Mon Sep 17 00:00:00 2001
From: rubicon <5662-rubicon@users.gitlab.alpinelinux.org>
Date: Fri, 20 May 2022 14:07:34 +0800
Subject: [PATCH] testing/ocaml-gen: move from unmaintained as depends for
 ocaml-sedlex

---
 testing/ocaml-gen/APKBUILD                    | 64 +++++++++++++++++++
 testing/ocaml-gen/dont-use-external-seq.patch |  9 +++
 unmaintained/ocaml-gen/APKBUILD               | 53 ---------------
 3 files changed, 73 insertions(+), 53 deletions(-)
 create mode 100644 testing/ocaml-gen/APKBUILD
 create mode 100644 testing/ocaml-gen/dont-use-external-seq.patch
 delete mode 100644 unmaintained/ocaml-gen/APKBUILD

diff --git a/testing/ocaml-gen/APKBUILD b/testing/ocaml-gen/APKBUILD
new file mode 100644
index 000000000000..eb74360ec186
--- /dev/null
+++ b/testing/ocaml-gen/APKBUILD
@@ -0,0 +1,64 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer:
+pkgname=ocaml-gen
+_pkgname=gen
+pkgver=1.0
+pkgrel=0
+pkgdesc="Simple, efficient iterators for OCaml"
+url="https://github.com/c-cube/gen/"
+arch="all !riscv64"  # limited by ocaml aport
+license="BSD-2-Clause"
+depends="ocaml-runtime"
+depends_dev="$pkgname=$pkgver-r$pkgrel"
+makedepends="dune dune-configurator ocaml"
+checkdepends="ocaml-ounit-dev ocaml-qcheck-dev ocaml-qtest-dev"
+options="!check"
+subpackages="$pkgname-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/c-cube/gen/archive/v$pkgver.tar.gz
+	dont-use-external-seq.patch
+	"
+builddir="$srcdir/$_pkgname-$pkgver"
+_ocamldir=usr/lib/ocaml
+
+# 32-bit archs
+case "$CARCH" in
+	arm*|x86) options="$options textrels" ;;
+esac
+
+build() {
+	dune build --release --verbose
+}
+
+check() {
+	dune runtest --verbose
+}
+
+package() {
+	dune install \
+		--destdir="$pkgdir" \
+		--docdir=/.omit
+	rm -Rf "$pkgdir"/.omit
+}
+
+dev() {
+	default_dev
+
+	cd "$pkgdir"
+
+	local path; for path in $(find $_ocamldir \( \
+			-name '*.cmt' -o \
+			-name '*.cmti' -o \
+			-name '*.cmx' -o \
+			-name '*.cmxa' -o \
+			-name '*.ml' -o \
+			-name '*.mli' \
+		\))
+	do
+		amove "$path"
+	done
+}
+
+sha512sums="
+fb4ec2ab35a1aba0dcc8439b11f14a0a785d939f661f505aec88a6f2ca6ca87e14ddfda860d9c180b215190b76690de87040c144582f069224f7e58d37ef48a0  ocaml-gen-1.0.tar.gz
+d9e4bc65357c4f83e39418a14e299e7626229545fac4c5e38e172f5dcb1e47abf651af77bc7ccdcc6ccaf15a2d9856c166f62b8a3882a781865ea5aacd4ed0de  dont-use-external-seq.patch
+"
diff --git a/testing/ocaml-gen/dont-use-external-seq.patch b/testing/ocaml-gen/dont-use-external-seq.patch
new file mode 100644
index 000000000000..9f26a3ab4edb
--- /dev/null
+++ b/testing/ocaml-gen/dont-use-external-seq.patch
@@ -0,0 +1,9 @@
+--- a/src/dune
++++ b/src/dune
+@@ -21,5 +21,5 @@
+   (modules Gen GenLabels GenM GenClone GenMList GenM_intf Gen_intf GenLabels_intf GenShims_)
+   (flags :standard -warn-error -a+8 -safe-string -nolabels)
+   (ocamlopt_flags :standard (:include flambda.flags))
+-  (libraries bytes seq))
++  (libraries bytes))
+ 
diff --git a/unmaintained/ocaml-gen/APKBUILD b/unmaintained/ocaml-gen/APKBUILD
deleted file mode 100644
index bfd67cf9610e..000000000000
--- a/unmaintained/ocaml-gen/APKBUILD
+++ /dev/null
@@ -1,53 +0,0 @@
-# Contributor: Jakub Jirutka <jakub@jirutka.cz>
-# Maintainer:
-pkgname=ocaml-gen
-_pkgname=gen
-pkgver=0.5.2
-pkgrel=1
-pkgdesc="Simple, efficient iterators for OCaml"
-url="https://github.com/c-cube/gen/"
-arch="all !x86 !armhf !armv7 !s390x !mips !mips64"  # limited by ocaml aport
-license="BSD-2-Clause"
-depends="ocaml-runtime"
-makedepends="dune ocaml ocaml-findlib opam"
-options="!check"  # XXX: tests require additional dependencies we don't have yet
-subpackages="$pkgname-dev"
-source="$pkgname-$pkgver.tar.gz::https://github.com/c-cube/$_pkgname/archive/$pkgver/gen-$pkgver.tar.gz"
-builddir="$srcdir/$_pkgname-$pkgver"
-
-build() {
-	jbuilder build @install
-}
-
-check() {
-	jbuilder runtest
-}
-
-package() {
-	mkdir -p "$pkgdir"/usr/lib/ocaml
-	jbuilder install \
-		--destdir="$pkgdir" \
-		--prefix=/usr \
-		--libdir=/usr/lib/ocaml
-
-	# There's just a readme and changelog.
-	rm -Rf "$pkgdir"/usr/doc
-
-	# Remove annotation files and sources.
-	cd "$pkgdir"/usr/lib/ocaml/$_pkgname
-	rm -f *.cmt* *.ml
-}
-
-dev() {
-	default_dev
-
-	depends="$pkgname=$pkgver-r$pkgrel"
-	local sitelib="usr/lib/ocaml/$_pkgname"
-
-	mkdir -p "$subpkgdir"/$sitelib
-
-	cd "$pkgdir"/$sitelib
-	mv *.cmx *.cmxa *.mli "$subpkgdir"/$sitelib/
-}
-
-sha512sums="c84e5ea0c9b3a678b6a5c935eacf91265a79b68a48375c44aa5f159d4cb02283c1be0786e172a153666c670bc7ee37b931004b8747a99e5f4ab90ca63e097ff5  ocaml-gen-0.5.2.tar.gz"
-- 
GitLab