# -*- 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

PortSystem      1.0
PortGroup       openssl 1.0

name            serf1
version         1.3.10
revision        1

categories      www
maintainers     nomaintainer
license         Apache-2

description     C-based HTTP client library
long_description \
    The serf library is a C-based HTTP client library built upon the \
    Apache Portable Runtime (APR) library.  It multiplexes \
    connections, running the read/write communication asynchronously. \
    Memory copies and transformations are kept to a minimum to provide \
    high performance operation.

homepage        https://serf.apache.org
master_sites    https://archive.apache.org/dist/serf/
distname        serf-${version}
use_bzip2       yes

checksums       rmd160  052944943a99e7927eaa946611c79dc800098dc7 \
                sha256  be81ef08baa2516ecda76a77adf7def7bc3227eeb578b9a33b45f7b41dc064e6 \
                size    147744

patchfiles      patch-SConstruct.diff \
                patch-ssl_buckets.c.diff \
                patch-SConstruct-respect-DEVELOPER_DIR.diff \
                patch-SConstruct-openssl-library-ordering.diff

openssl.branch  3

depends_build-append \
                port:scons

depends_lib-append \
                port:apr \
                port:apr-util \
                port:zlib

use_configure   no

variant universal {}

build.cmd       ${prefix}/bin/scons

build.args      CC=${configure.cc} \
                CPPFLAGS="${configure.cppflags}" \
                CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
                LINKFLAGS="${configure.ldflags} [get_canonical_archflags ld]"

platform darwin {
    # Workaround scons buggy lack of MACOSX_DEPLOYMENT_TARGET propagation:
    build.args-append   CC="MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target} ${configure.cc}"
}

build.target    APR=${prefix} \
                APU=${prefix} \
                OPENSSL=[openssl::install_area] \
                PREFIX=${prefix}

destroot.cmd    ${build.cmd}
destroot.args   --install-sandbox=${destroot}
destroot.destdir

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}

    xinstall -m 0644 -W ${worksrcpath} CHANGES LICENSE \
        NOTICE README ${destroot}${docdir}
    }

livecheck.url   [lindex ${master_sites} 0]
livecheck.type  regex
livecheck.regex serf-(\\d+(?:\\.\\d+)*)
