# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apr
pkgver=1.5.2
pkgrel=1
pkgdesc="The Apache Portable Runtime"
url="http://apr.apache.org/"
arch="all"
license="ASL 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
}

md5sums="4e9769f3349fe11fc0a5e1b224c236aa  apr-1.5.2.tar.bz2"
sha256sums="7d03ed29c22a7152be45b8e50431063736df9e1daa1ddf93f6a547ba7a28f67a  apr-1.5.2.tar.bz2"
sha512sums="d1156ad16abf07887797777b56c2147c890f16d8445829b3e3b4917950d24c5fd2f8febd439992467a5ea0511da562c0fb4a7cfd8a235ab55882388bfa2b919d  apr-1.5.2.tar.bz2"