1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-17 05:05:14 +03:00
aports/community/ocaml-findlib/APKBUILD
Celeste 4519380326 community/ocaml-findlib: split ocamlfind executable into its own subpackage
this solves the conflict between ocaml-runtime and ocaml5-runtime,
allowing ocamlfind to be used with either OCaml 4 or OCaml 5
2025-04-18 04:00:49 +00:00

113 lines
2.6 KiB
Text

# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=ocaml-findlib
_pkgname=findlib
pkgver=1.9.6
pkgrel=5
pkgdesc="OCaml package manager"
url="http://projects.camlcity.org/projects/findlib.html"
arch="all"
license="MIT"
depends="ocamlfind=$pkgver-r$pkgrel ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel ocaml"
makedepends="ocaml-compiler-libs ocaml-ocamldoc m4 ncurses-dev"
subpackages="ocamlfind $pkgname-dev $pkgname-doc"
source="http://download.camlcity.org/download/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
# 32bit archs
case "$CARCH" in
arm*|x86) options="$options textrels" ;;
riscv64|loongarch64)
# Install ocamlfind executable only, because buildrepo will
# only build APKBUILDs that have $pkgname as directory name,
# and building the -dev libs will make this an ocaml5-findlib
subpackages="ocamlfind $pkgname-doc"
depends="${depends/ocaml-runtime/}"
makedepends="${makedepends//ocaml-/ocaml5-}"
;;
esac
build() {
./configure \
-bindir /usr/bin \
-mandir /usr/share/man \
-sitelib /usr/lib/ocaml \
-config /etc/$_pkgname.conf \
-no-camlp4
make -j1 all opt
}
check() {
local l; for l in unix str threads; do
OCAMLFIND_CONF=./findlib.conf ./itest $l
done
}
package() {
pkgdesc="$pkgdesc (library)"
case "$CARCH" in
riscv64|loongarch64)
make install-config install-doc prefix="$pkgdir"
install -Dvm755 src/findlib/ocamlfind_opt \
"$pkgdir"/usr/bin/ocamlfind
;;
*)
make install prefix="$pkgdir"
;;
esac
mkdir -p "$pkgdir"/usr/share/doc/$_pkgname/
install -m 644 doc/README doc/QUICKSTART \
"$pkgdir"/usr/share/doc/$_pkgname/
}
ocamlfind() {
depends=""
amove \
etc/findlib.conf \
usr/bin/ocamlfind
}
dev() {
local sitelib="usr/lib/ocaml/$_pkgname"
default_dev
cd "$pkgdir"
mkdir -p "$subpkgdir"/$sitelib
mv $sitelib/*.mli \
$sitelib/Makefile.config \
$sitelib/Makefile.packages \
"$subpkgdir"/$sitelib/
}
prepare_py_provides() {
local datadir="${subpkgdir:-$pkgdir}"
local pkgbasedir=${pkgbasedir:-"$startdir/pkg"}
local controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname}
command -v ocaml4-abuild-find >/dev/null || return 0
options_has "!tracedeps" && return 0
ocaml4-abuild-find provides \
"$datadir"/usr/lib/ocaml \
"$controldir" \
"$pkgver-r$pkgrel"
}
scan_python3_dependency() {
local controldir="$2" datadir="$3"
command -v ocaml4-abuild-find >/dev/null || return 0
ocaml4-abuild-find requires \
"$datadir"/usr/lib/ocaml \
"$controldir"
}
sha512sums="
cfaf1872d6ccda548f07d32cc6b90c3aafe136d2aa6539e03143702171ee0199add55269bba894c77115535dc46a5835901a5d7c75768999e72db503bfd83027 findlib-1.9.6.tar.gz
"