# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apr
pkgver=1.6.3
pkgrel=0
pkgdesc="The Apache Portable Runtime"
url="http://apr.apache.org/"
arch="all"
license="Apache-2.0"
depends=""
depends_dev="util-linux-dev bash"
makedepends="$depends_dev"
subpackages="$pkgname-dev"
source="http://www.apache.org/dist/$pkgname/$pkgname-$pkgver.tar.bz2
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--datadir=/usr/share \
		--enable-nonportable-atomics \
		--with-devrandom=/dev/urandom \
		|| return 1
	make || return 1
}

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

# basicly everything thats not a *.so* file belongs to the -dev package
# we override the pre-defined func.
dev() {
	local i
	depends="$pkgname $depends_dev"
	mkdir -p "$subpkgdir"
	mv "$pkgdir"/* "$subpkgdir"/
	mkdir -p "$pkgdir"/usr/lib
	mv "$subpkgdir"/usr/lib/*.so* "$pkgdir"/usr/lib/
	return 0
}

sha512sums="f6b8679ae7fafff793c825c78775c84a646267c441710a50664589850e13148719b4eab48ab6e7c95b7aed085cff831115687434a7b160dcc2faa0eae63ac996  apr-1.6.3.tar.bz2"
