#Packager: Shador <futur~DOT~andy~AT~googlemail.com>

pkgname=ocaml
pkgver=3.12.1
pkgrel=1ab
source=("http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.bz2"
        "install.patch")
sourcetemplate="http://gaia.homelinux.org/salix/slkbuilds/$pkgname/"
docs=("readme" "install" "license" "changes" "upgrading" "version")
url='http://caml.inria.fr/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (Objective Caml system)"
"The Objective Caml system is the main implementation of the Caml"
"language. It features a powerful module system and a full-fledged"
"object-oriented layer. It comes with a native-code compiler that"
"supports numerous architectures, for high performance; a bytecode"
"compiler, for increased portability; and an interactive loop, for"
"experimentation and rapid development."
)


build() {
	set -e

	cd $startdir/src/$pkgname-$pkgver
	PREFIX=/usr
	DESTDIR=$startdir/pkg
	patch -p1 -i $startdir/src/install.patch
	./configure \
		--prefix ${PREFIX} \
		--libdir ${PREFIX}/lib${LIBDIRSUFFIX}/ocaml \
		--mandir ${PREFIX}/man
	make world.opt || return 1
	sed -e 's,\(PREFIX\|BINDIR\|LIBDIR\|STUBLIBDIR\|MANDIR\)=\([^\$]\),\1='$DESTDIR'\2,' -i config/Makefile
	make install

	set +e
}