# $Id: Portfile 89889 2012-02-14 05:03:02Z rmstonecipher@macports.org $

PortSystem 1.0

name            esound
version         0.2.41
revision        3
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      audio
platforms       darwin
maintainers     nomaintainer
license         LGPL-2
description     Enlightened Sound Daemon (ESD)
long_description \
    EsounD, the Enlightened Sound Daemon, is a server process that mixes \
    several audio streams for playback by a single audio device.  For example, \
    if you're listening to music on a CD and you receive a sound-related event \
    from ICQ, the two applications won't have to jockey for the use of your \
    sound card.
homepage        http://www.tux.org/~ricdude/EsounD.html

master_sites    gnome:sources/esound/${branch}/
depends_lib     port:audiofile
use_bzip2       yes

checksums       md5 8d9aad3d94d15e0d59ba9dc0ea990c6c \
                sha1 6c343483b3789f439277935eaad7e478bee685ea \
                rmd160 72597ea46e507008e3a43efaaf5b4b9ef62b896f

configure.args  --enable-ipv6

post-patch {
    reinplace "s|int esd_spawn_wait_ms=100;|int esd_spawn_wait_ms=999;|" \
              ${worksrcpath}/esd_config.c
    reinplace "s|spawn_wait_ms=100|spawn_wait_ms=999|" \
              ${worksrcpath}/esd.conf

    if {${os.major} >= 9} {
            # esound tries to get the host name from the DISPLAY environment variable
            # See http://trac.macports.org/ticket/13848
            reinplace "s|len = strcspn( display, \":\" );|len = strcspn( display, \":/\" );|" \
                    ${worksrcpath}/esdlib.c
    }
}

depends_build   port:pkgconfig

platform puredarwin {
    configure.args-append   --disable-local-sound
}

livecheck.type  regex
livecheck.url   http://ftp.gnome.org/pub/gnome/sources/${name}/${branch}/
livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
