# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem      1.0

name            libwww
version         5.4.0
revision        3
categories      www
license         W3C
platforms       darwin
maintainers     nomaintainer
description     The W3C WWW Reference Library
homepage        http://www.w3.org/Library/

long_description \
    Libwww is a general-purpose Web API written in C for Unix and Windows (Win32). \
    With a highly extensible and layered API, it can accommodate many different types \
    of applications including clients, robots, etc.

master_sites    http://www.w3.org/Library/Distribution/ \
                macports:lt:lt
distname        w3c-${distname}
extract.suffix  .tgz
extract.only    ${distfiles}

depends_build	port:pkgconfig
depends_lib	port:openssl
distfiles-append    ltconfig13:lt \
                    ltmain13:lt

checksums       ${distname}${extract.suffix} \
                    md5 c3734ca6caa405707e134cc8c6d7e422 \
                ltconfig13 \
                    md5 ea53f42a550c9f9e653758a8ed91574e \
                ltmain13 \
                    md5 e094ae92724c4015dbab97de151c2525

patchfiles      patch-configure.diff \
                libwww-config.in.diff

post-patch {
    system "cp ${distpath}/ltconfig13 ${worksrcpath}/config/ltconfig"
    system "cp ${distpath}/ltmain13 ${worksrcpath}/config/ltmain.sh"
	reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure
}

configure.args  --enable-shared \
                --enable-static \
                --with-zlib \
                --with-ssl
configure.ccache no

pre-build {
    if {[variant_isset universal]} {
        reinplace "s|dynamiclib|dynamiclib ${configure.universal_ldflags}|" ${worksrcpath}/libtool
    } else {
        reinplace "s|dynamiclib|dynamiclib ${configure.ld_archflags}|" ${worksrcpath}/libtool
    }
}

variant expat description {builds against expat} {
    depends_build-append    port:expat
    configure.args-append   --with-expat
}

livecheck.type  regex
livecheck.url   http://www.w3.org/Library/Distribution/
livecheck.regex "w3c-${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"