PortSystem      1.0

name            daapd
version         0.2.4b
revision        1
categories      audio net
license         GPL-2
maintainers     nomaintainer
description     A DAAP server emulating an iTunes server.
long_description    daapd scans a directory for music files (mp3, aac, \
            uncompressed) and makes them available via the Apple \
            proprietary protocol DAAP. DAAP clients can browse \
            the directory and retrieve individual files, either \
            by streaming or by downloading them.

homepage        http://www.deleet.de/projekte/daap/daapd/
master_sites    ${homepage}
extract.suffix  .tgz

checksums           md5     3a83294a9eb88b27bae7f5dd06394c49 \
                    sha1    0903303f155c19ae12cdc78be05799508156a16b \
                    rmd160  899b37b3872623ef918f7faa4eb8bad2dfc5b369

depends_lib         port:zlib \
                    port:libid3tag \
                    port:howl

patchfiles          patch-daapd.cc patch-daapd.8 patch-daaplib-src-makefile \
                    patch-select.h patch-makefile patch-ip_acl.c \
                    patch-libhttpd-Site.mm.in

post-extract {
    # Convert DOS to UNIX line endings so we can patch
    reinplace "s|\r||g" ${worksrcpath}/daaplib/src/makefile
}

if {${configure.compiler} != "gcc-4.0"} {
    configure.cxxflags-append -ffriend-injection
}

post-patch {
    reinplace s|@PREFIX@|${prefix}|g    ${worksrcpath}/daapd.cc \
                        ${worksrcpath}/daapd.8 \
                        ${worksrcpath}/daaplib/src/makefile \
                        ${worksrcpath}/makefile
    reinplace s|@CXX@|${configure.cxx}|g    ${worksrcpath}/makefile \
                        ${worksrcpath}/daaplib/src/makefile
    reinplace "s|@CFLAGS@|${configure.cxxflags} ${configure.cxx_archflags}|g" \
                        ${worksrcpath}/makefile \
                        ${worksrcpath}/daaplib/src/makefile
}

destroot {
    xinstall -m 755 ${worksrcpath}/daapd ${destroot}${prefix}/sbin/
    xinstall -m 644 ${worksrcpath}/daaplib/src/libdaaplib.a ${destroot}${prefix}/lib/
    xinstall -m 644 ${worksrcpath}/daapd.conf ${destroot}${prefix}/etc/daapd.conf.dist
    xinstall -m 644 ${worksrcpath}/daapd.8 ${destroot}${prefix}/share/man/man8/
}

use_configure   no
use_parallel_build no

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