1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-23 11:15:13 +03:00
aports/community/ocaml/APKBUILD
2021-06-24 16:32:24 +02:00

117 lines
2.8 KiB
Text

# Contributor: Borys Zhukov <mp5@mp5.im>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=ocaml
pkgver=4.12.0
pkgrel=0
pkgdesc="Main implementation of the Caml programming language"
url="https://ocaml.org/"
# riscv64: make[4]: *** [Makefile:181: dynlink_compilerlibs/binutils.cmo] Segmentation fault
# mips64: "native-code compiler is not supported"
arch="all !mips64 !riscv64"
license="LGPL-2.1-or-later-WITH-linking-exception"
depends="$pkgname-runtime=$pkgver-r$pkgrel gcc"
makedepends="gdbm-dev libc-dev ncurses-dev zlib-dev binutils-dev"
subpackages="
$pkgname-doc
$pkgname-dev
$pkgname-ocamldoc
$pkgname-compiler-libs:_compiler_libs
$pkgname-runtime
"
source="https://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/ocaml-$pkgver.tar.gz
fix-configure-musl.patch
"
# 32bit archs
case "$CARCH" in
armv7|armhf|mips|x86) options="$options textrels" ;;
esac
build() {
./configure \
--prefix /usr \
--bindir /usr/bin \
--libdir /usr/lib/ocaml \
--mandir /usr/share/man \
CC="${CC:-gcc}" \
AS="${CC:-gcc} -c" \
ASPP="${CC:-gcc} -c"
make world.opt
}
check() {
make ocamlopt
make ocamltest
make tests
}
package() {
make DESTDIR="$pkgdir" install
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
install -Dm644 Changes "$pkgdir"/usr/share/doc/$pkgname/Changes
cd "$pkgdir"
# Remove annotation files and sources.
find usr/lib/ocaml \
\( -name '*.cmt' -o -name '*.cmti' -o -name '*.ml' \) \
-a -delete
# To be consistent with other binaries.
mv usr/bin/ocamldoc usr/bin/ocamldoc.byte
ln -s ocamldoc.opt usr/bin/ocamldoc
}
dev() {
pkgdesc="OCaml bytecode executables"
_submv 'usr/bin/*.byte'
}
ocamldoc() {
pkgdesc="Documentation generator for OCaml"
depends="$pkgname=$pkgver-r$pkgrel"
replaces="$pkgname" # for backward compatibility
_submv usr/bin/ocamldoc\*
_submv usr/lib/ocaml/ocamldoc
}
_compiler_libs() {
pkgdesc="Compiler libraries for OCaml"
depends="$pkgname=$pkgver-r$pkgrel"
replaces="$pkgname" # for backward compatibility
_submv usr/lib/ocaml/compiler-libs
}
runtime() {
pkgdesc="OCaml runtime environment"
depends=""
replaces="$pkgname" # for backward compatibility
_submv usr/bin/ocamlrun
local i; for i in \
'*.cmo' \
'*.cmi' \
'*.cma' \
'stublibs' \
'threads/*.cmi' \
'threads/*.cma'
do
_submv "usr/lib/ocaml/$i"
done
}
_submv() {
local path="$1"
mkdir -p "$subpkgdir"/${path%/*}
mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
rmdir -p "$pkgdir"/${path%/*} 2>/dev/null || true
}
sha512sums="7c9e4ebe9c6e3f04eca9b837b70f3dcfda7d81d033f4fb6d0c507cd40c82115c0dde0907444f60c406a301fafe1a48d0bca01ee6af192fd08458d3b1bee7f717 ocaml-4.12.0.tar.gz
444092ae137e290d459656dc56b36397572508e2dc59684446fb65ef37e467fc8ccb06e9d1f344cdb595854ffed0b8060dc969bfa477a26c297fee4a67727dda fix-configure-musl.patch"