# Contributor: Isaac Dunham <ibid.ag@gmail.com>
# Maintainer:
pkgname=libctl
pkgver=3.2.2
pkgrel=2
pkgdesc="Guile-based library implementing flexible control files for scientific simulations"
url="http://ab-initio.mit.edu/wiki/index.php/Libctl"
arch="all"
license="GPL"
depends=""
depends_dev="guile-dev gmp-dev"
makedepends="$depends_dev gc-dev gfortran"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="http://ab-initio.mit.edu/libctl/libctl-$pkgver.tar.gz
	gh-libguile.patch"

_builddir="$srcdir"/libctl-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-shared --disable-static \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="5fd7634dc9ae8e7fa70a68473b9cbb68  libctl-3.2.2.tar.gz
e28653da62d9aed4746025e83f7f5323  gh-libguile.patch"
sha256sums="8abd8b58bc60e84e16d25b56f71020e0cb24d75b28bc5db86d50028197c7efbc  libctl-3.2.2.tar.gz
03da4add062a949c791dfa722254bc4cb265ff9b8c64c12effd92bed32fdcdaa  gh-libguile.patch"
sha512sums="646456c23490eb3e63e845d4866b16bd1d92b210f2279342560888bb4764e474b97e17ff34beb672d43afe4d42bbcbddbcf8bb49cedc23b886061a93de10e6df  libctl-3.2.2.tar.gz
50a18aa5f42ef26b0d5c3f31a93f156adc4e1a0a37af2db123301e9ef1ac20106705df44e9949e02b605f42be962378b95c150f78614edfae7339c084dfb6522  gh-libguile.patch"
