# $Id: Portfile 91362 2012-03-30 20:21:06Z jeremyhu@macports.org $

PortSystem	1.0

name		apr
version		1.4.6
revision        1
categories	devel
maintainers	geeklair.net:dluke
platforms	darwin
description	The apache group's portability library
license		Apache-2

long_description	The Apache Portable Runtime is a library of C data \
			structures and routines, forming a system portability \
			layer that covers as many operating systems as \
			possible, including Unices, Win32, BeOS, and OS/2.

homepage	http://apr.apache.org/
master_sites	apache:apr

use_bzip2	yes
checksums	md5	ffee70a111fd07372982b0550bbb14b7 \
		sha1	1a72fc9d89a378590ef243399396169426d1f6cf \
		rmd160	ca496323a921f71ed28695ede94ff4fc00df9b0d

# XCode 3.x's gcc-4.0 generates bad code in apr's translation which can be caught by enabling
# debugging in apr, apr-util, and subversion with LANG="en_US.UTF-8"
# Assertion failed: (node->next == NULL), function put_xlate_handle_node, file subversion/libsvn_subr/utf.c, line 378.
if {${configure.compiler} == "gcc-4.0" && [vercmp ${xcodeversion} 3.0] >= 0} {
    configure.compiler gcc-4.2
}

use_parallel_build	yes
configure.ccache	no
#configure's tests don't work right for sed/gsed if we just set SED here
configure.env   ac_cv_prog_AWK=awk ac_cv_path_SED=sed lt_ECHO=/bin/echo lt_cv_path_SED=sed
configure.args	--with-installbuilddir=${prefix}/share/apr-1/build \
		--enable-nonportable-atomics \
		ac_cv_func_setpgrp_void=no

patchfiles	apr_h_patch.diff

test.run	yes
test.target	check
test.env	DYLD_LIBRARY_PATH=${worksrcpath}/.libs
pre-test	{
	use_parallel_build	no
}

if {[variant_isset universal]} {
	post-destroot {
		reinplace -E {s|-arch [a-z0-9_]+||g} \
			${destroot}${prefix}/share/apr-1/build/apr_rules.mk \
			${destroot}${prefix}/share/apr-1/build/libtool
	}
}

livecheck.type  regex
livecheck.url   http://apache.org/dist/apr/
livecheck.regex {APR (\d+(?:\.\d+)*) is the latest available version}
