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

name                log4cpp

categories          devel
license             LGPL-2.1
maintainers         {michaelld @michaelld} openmaintainer

description         configurable logging for C++

long_description    Log4cpp is library of C++ classes for flexible logging to \
                    files, syslog, IDSA and other destinations. It is modeled \
                    after the Log4j Java library, staying as close to their \
                    API as is reasonable.

version             1.1.4
checksums           rmd160  13e462afb5845f89071400b9ebe65eb510384c5e \
                    sha256  696113659e426540625274a8b251052cc04306d8ee5c42a0c7639f39ca90c9d6 \
                    size    637440

set branch          [join [lrange [split ${version} .] 0 1] .]

homepage            https://log4cpp.sourceforge.net/
master_sites        sourceforge:project/log4cpp/log4cpp-${branch}.x%20%28new%29/log4cpp-${branch}

worksrcdir          ${name}

post-extract {
    move ${worksrcpath}/configure.in ${worksrcpath}/configure.ac
}

patchfiles          patch-appenderMapStorageInitializer.diff \
                    patch-autogen.sh.diff \
                    patch-autoconf-1.13.diff \
                    patch-StringUtil.cpp.patch

compiler.cxx_standard \
                    2011

use_autoconf        yes
autoconf.cmd        ${worksrcpath}/autogen.sh

# Setting autoconf.cmd to a non-default value after setting 'use_autoconf yes'
# removes the automatic dependencies, so re-add them.
depends_build       port:autoconf \
                    port:automake \
                    port:libtool

# docs do not honor DESTDIR; keep them disabled for now

configure.args      --disable-doxygen \
                    --disable-dot \
                    --disable-html-docs \
                    --disable-latex-docs

# remove top-level include path, such that internal headers are used
# instead of any already-installed ones.

configure.cppflags-delete -I${prefix}/include

# remove top-level library path, such that internal libraries are used
# instead of any already-installed ones.

configure.ldflags-delete -L${prefix}/lib

# patch dynamically created libtool to remove "-undefine dynamic_lookup"

post-configure {
    reinplace "s@^allow_undefined_flag=.*@allow_undefined_flag=@g" \
        ${worksrcpath}/libtool
}

livecheck.regex     /${name}-(\[0-9.\]+)${extract.suffix}
