SUMMARY="Apache Portable Runtime Library"
HOMEPAGE="http://apr.apache.org/"
SOURCE_URI="http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz"
CHECKSUM_SHA256="538d593d805c36985fc6d200d31bf6c1b5f90df2a50b917902743a13bbc10e05"
COPYRIGHT="2012 The Apache Software Foundation."
LICENSE="Apache v2"
REVISION="7"
ARCHITECTURES="x86_gcc2 x86 x86_64"

PATCHES="apr-1.4.6.patch"

PROVIDES="
	apr = $portVersion compat >= 1
	lib:libapr_1 = 0.4.6 compat >= 0
	"
REQUIRES="
	haiku
	"
BUILD_REQUIRES="
	"
BUILD_PREREQUIRES="
	haiku_devel
	cmd:aclocal
	cmd:autoconf
	cmd:gcc
	cmd:ld
	cmd:libtoolize
	cmd:make
	"


BUILD()
{
	libtoolize -fci
	touch libtool.m4
	aclocal -I build
	autoconf
	runConfigure ./configure \
		--with-installbuilddir=$prefix/data/apr

	# TODO: fix this hack (by finding out why top_builddir seems to be unset)!
	ln -sfn $sourceDir/libtool /libtool

	make $jobArgs
}

INSTALL()
{
	make install

	# prepare develop/lib
	prepareInstalledDevelLibs libapr-1
	fixPkgconfig

	# fix apr-1-config
	fixDevelopLibDirReferences $binDir/apr-1-config

	# remove superfluous .exp file
	rm $libDir/apr.exp

	# devel package
	packageEntries devel \
		$binDir \
		$dataDir \
		$developDir
}

TEST()
{
	make test
}

# ----- description ----------------------------------------------------------

DESCRIPTION="
The mission of the Apache Portable Runtime (APR) project is to create and \
maintain software libraries that provide a predictable and consistent \
interface to underlying platform-specific implementations. The primary goal is \
to provide an API to which software developers may code and be assured of \
predictable if not identical behaviour regardless of the platform on which \
their software is built, relieving them of the need to code special-case \
conditions to work around or take advantage of platform-specific deficiencies \
or features.
To give a brief overview, the primary core subsystems of APR 1.x include the \
following:
- atomic operations
- dynamic Shared Object loading
- file I/O
- locks (mutexes, condition variables, etc)
- memory management (high performance allocators)
- memory-mapped files
- multicast Sockets
- network I/O
- shared memory
- thread and Process management
- various data structures (tables, hashes, priority queues, etc)
"

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	apr_devel = portVersion compat >= 1
	cmd:apr_1_config = portVersion compat >= 1
	devel:libapr_1 = 0.4.6 compat >= 0
	"
REQUIRES_devel="
	apr == $portVersion base
	"
