# $Id: Portfile 63553 2010-02-08 15:34:43Z dluke@macports.org $

PortSystem	1.0

name		neon
version		0.29.3
revision	1
categories	www
maintainers	geeklair.net:dluke
description	An HTTP and WebDAV client library with a C interface
platforms	darwin freebsd

long_description \
	neon is an HTTP and WebDAV client library with a C language API. \
	It provides a high-level interface to HTTP and WebDAV methods and a \
	low-level interface to HTTP request handling, easily allowing the \
	implementation of new methods.

homepage	http://www.webdav.org/neon/
master_sites	${homepage}

depends_lib	port:expat \
		port:gettext \
		port:libiconv \
		port:openssl \
		port:zlib

checksums	md5	ba1015b59c112d44d7797b62fe7bee51 \
		sha1	f84152dd08fc7d3bffadea0bc45ea738d3a873c3 \
		rmd160	6825afe3e6a0cda1b6702b2a5876e9c2b4f5e935

use_parallel_build	yes

configure.args	--with-ssl \
		--enable-shared \
		--with-expat \
		--without-libproxy \
		--mandir=${prefix}/share/man 

pre-test {
	set x {}

	fs-traverse dir ${worksrcpath} {
		if {[file tail ${dir}] == ".libs" && [file isdirectory ${dir}]} {
			lappend x ${dir}
			continue
		}
	}

	test.env-append DYLD_LIBRARY_PATH=[join ${x} ":"]
}

post-configure {
	if {[variant_isset universal]} {
		system "cd ${worksrcpath} && ed - config.h < ${filespath}/config.h.ed && touch stamp-h1"
	}
}

post-destroot {
	if {[variant_isset universal]} {
		if {${configure.universal_cppflags} != ""} {
			reinplace "s|${configure.universal_cppflags}||g" \
				${destroot}${prefix}/bin/neon-config \
				${destroot}${prefix}/lib/pkgconfig/neon.pc
		}
		reinplace "s|${configure.universal_ldflags}||g" \
			${destroot}${prefix}/bin/neon-config \
			${destroot}${prefix}/lib/pkgconfig/neon.pc
	}
}

test.run	yes
test.target	check

livecheck.type	regex
livecheck.url	${homepage}
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)
