# $Id$

PortSystem 1.0

name		libfetch
version		9.0.0-RELEASE
revision 1
categories	net
maintainers	afb
description	FreeBSD file fetching library
long_description	These functions implement a high-level library for retrieving and \
			uploading files using Uniform Resource Locators (URLs).
platforms	darwin freebsd
license		BSD
use_bzip2	yes
homepage	http://www.freebsd.org/
master_sites	macports
checksums	md5 93032be6c3d61a5629deab5e5660801e \
		sha1 1059a18b860dc42e84931f5f914a81e3452bb204 \
		rmd160 27190ff9b524992e7eb8f0e96f79c3153d92d1eb
variant universal {}
build.type	bsd
build.env	CC=${configure.cc} \
		CFLAGS="${configure.cppflags} ${configure.cflags} [get_canonical_archflags]" \
		LDFLAGS="${configure.ldflags} [get_canonical_archflags]"
build.args	-DMK_INET6_SUPPORT -DMK_OPENSSL
worksrcdir	${name}
use_configure	no
set libver	6
destroot	{
		xinstall -m 644 -c ${worksrcpath}/fetch.h ${destroot}${prefix}/include
		xinstall -m 644 -c ${worksrcpath}/fetch.3 ${destroot}${prefix}/share/man/man3 }

depends_lib	path:lib/libssl.dylib:openssl
depends_build	bin:bsdmake:bsdmake
patchfiles	patch-common.c patch-http.c

platform darwin {
	patchfiles-append	patch-Makefile patch-common.h
	post-build {
		# need to add libdir, do it afterwards instead of messing with make
		system "install_name_tool -id ${prefix}/lib/libfetch.${libver}.dylib \
			${worksrcpath}/libfetch.${libver}.dylib"
	}
	pre-destroot {
		xinstall -m 644 -c ${worksrcpath}/libfetch.${libver}.dylib \
			${destroot}${prefix}/lib
		ln -sf libfetch.${libver}.dylib ${destroot}${prefix}/lib/libfetch.dylib
	}
}

platform freebsd {
	pre-destroot {
		xinstall -m 644 -c ${worksrcpath}/libfetch.so.${libver} \
			${destroot}${prefix}/lib
		ln -sf libfetch.so.${libver} ${destroot}${prefix}/lib/libfetch.so
	}
}