aports/testing/ocaml5/APKBUILD
Celeste d85bd98be2 testing/ocaml5: upgrade to 5.1.0
also, fix `ocamlrun` not being able to find stublibs by
`amove`ing `ld.conf` into the ocaml5-runtime subpackage
2023-09-14 19:26:51 +00:00

114 lines
2.5 KiB
Plaintext

# Contributor: Borys Zhukov <mp5@mp5.im>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: omni <omni+alpine@hack.org>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=ocaml5
provides=ocaml
pkgver=5.1.0
pkgrel=0
pkgdesc="Main implementation of the Caml programming language"
url="https://ocaml.org/"
arch="all"
license="LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception"
depends="$pkgname-runtime=$pkgver-r$pkgrel gcc"
checkdepends="parallel"
subpackages="
$pkgname-doc
$pkgname-ocamldoc
$pkgname-compiler-libs:_compiler_libs
$pkgname-runtime
"
source="https://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/ocaml-$pkgver.tar.xz"
builddir="$srcdir/ocaml-$pkgver"
# The s390x native compiler is newly added in 5.1.x and still needs some work
case "$CARCH" in
s390x)
options="$options textrels !check"
export LDFLAGS="$LDFLAGS -Wl,-z,notext"
;;
esac
build() {
local _make _conf
case "$CARCH" in
# Current native compiler support in 5.1.x
# Disabling riscv64 here as it segfaults while building dynlink
aarch64|s390x|x86_64)
_make="world.opt"
_conf="--enable-native-compiler \
--enable-native-toplevel \
--disable-installing-bytecode-programs"
msg "Building native compiler for $CARCH"
;;
*)
_make="world"
_conf="--disable-native-compiler \
--disable-native-toplevel \
--enable-installing-bytecode-programs"
msg "Building bytecode compiler for $CARCH"
;;
esac
./configure \
--prefix /usr \
--bindir /usr/bin \
--libdir /usr/lib/ocaml \
--mandir /usr/share/man \
--docdir /usr/share/doc/$pkgname \
--disable-installing-source-artifacts \
$_conf \
CC="${CC:-gcc}" \
AS="${CC:-gcc} -c" \
ASPP="${CC:-gcc} -c"
make $_make
}
check() {
make ocamltest
make -C testsuite parallel
}
package() {
make DESTDIR="$pkgdir" install
}
ocamldoc() {
pkgdesc="$pkgdesc (documentation generator)"
depends="$pkgname=$pkgver-r$pkgrel"
amove usr/bin/ocamldoc*
amove usr/lib/ocaml/ocamldoc
}
_compiler_libs() {
pkgdesc="$pkgdesc (compiler libraries)"
depends="$pkgname=$pkgver-r$pkgrel"
provides="$pkgname-dev=$pkgver-r$pkgrel"
amove usr/lib/ocaml/compiler-libs
}
runtime() {
pkgdesc="$pkgdesc (runtime environment)"
depends=
amove usr/bin/ocamlrun*
amove usr/lib/ocaml/ld.conf
local i; for i in \
'*.cmo' \
'*.cmi' \
'*.cma' \
'stublibs' \
'threads/*.cmi' \
'threads/*.cma'
do
amove "usr/lib/ocaml/$i"
done
}
sha512sums="
23579b76592e225f2ddec58d78084dfd11befede18b61be71d3896fd72a90cc0fe4fb1f64a7dcbc83239ed69ec4254e13ab86fd810671851044c2a353da3adc5 ocaml-5.1.0.tar.xz
"