# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py-egenix-mx-base
_pkgname=egenix-mx-base
pkgver=3.2.9
pkgrel=0
pkgdesc="eGenix.com mx Base collection of Python extensions"
url="https://www.egenix.com/products/python/mxBase/"
arch="all"
license="Custom"
depends=""
depends_dev=""
makedepends="python2-dev"
install=""
subpackages="$pkgname-doc $pkgname-dev"
source="http://downloads.egenix.com/python/$_pkgname-$pkgver.tar.gz"

builddir="$srcdir"/$_pkgname-$pkgver

build() {
	cd "$builddir"
	python2 setup.py build || return 1
}

package() {
	cd "$builddir"
	python2 setup.py install --prefix=/usr --root="$pkgdir" --skip-build || return 1
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

dev() {
	default_dev
	PYLIBDIR="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" || return 1
	PYINCDIR="$(python -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())')" || return 1
	cd "$subpkgdir/$PYLIBDIR"
	for file in $(find . -name '*.h'); do
		mkdir -p "$subpkgdir/$PYINCDIR/mx" || return 1
		mv "$file" "$subpkgdir/$PYINCDIR/mx" || return 1
	done
	rm -rf "$subpkgdir/usr/lib"
}

md5sums="b6f6612a95a857659e20968f496dfcc2  egenix-mx-base-3.2.9.tar.gz"
sha256sums="1c6b67688e7a231c6c1da09b7a6a2210745c3f2507bdda70e2639faedbf68977  egenix-mx-base-3.2.9.tar.gz"
sha512sums="ff3b6ba90e9729004e7b18511a69529698b7d6089f08b686a0930d8f065323933e9fb97f2ed7a5b24c4bca0ddad1983773144b5dd9ee401859a2ffbfcfc79025  egenix-mx-base-3.2.9.tar.gz"
