# Contributor: Eric Kidd <git@randomhacks.net>
# Maintainer:
pkgname=geos
pkgver=3.7.1
pkgrel=0
pkgdesc="GEOS is a library providing OpenGIS and JTS spatial operations in C++."
url="https://trac.osgeo.org/geos/"
# test fails on other archs
arch="x86 x86_64"
license="LGPL-2.1"
makedepends="swig python2-dev"
subpackages="py-$pkgname:py $pkgname-dev"
source="http://download.osgeo.org/geos/geos-$pkgver.tar.bz2"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-python

	# --enable-ruby produces a gem which crashes, and which seems to
	# mostly ignored in favor of the rgeo and ffi-geos modules, anyway.

	make
}

check() {
	cd "$builddir"

	make check
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install
	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

py() {
	pkgdesc="$pkgname Python bindings"

	cd "$builddir"
	install -d "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}

sha512sums="01e8087bcd3cb8f873adb7b56910e1575ccb3336badfdd3f13bc6792095b7010e5ab109ea0d0cd3d1459e2e526e83bcf64d6ee3f7eb47be75639becdaacd2a87  geos-3.7.1.tar.bz2"