# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:et:sw=4:ts=4:sts=4

PortSystem 1.0

name                ushare
version             1.1a
revision            4
categories          net multimedia
platforms           darwin
supported_archs     x86_64
# libdlna does not support i386
maintainers         nomaintainer
description         a UPnP (TM) A/V & DLNA Media Server
long_description \
    uShare is a UPnP (TM) A/V & DLNA Media Server. It implements the server \
    component that provides UPnP media devices with information on available \
    multimedia files. uShare uses the built-in http server of libupnp to \
    stream the files to clients.

depends_build       path:bin/pkg-config:pkgconfig
depends_lib         port:gettext \
                    port:libupnp \
                    port:libdlna

configure.args-append   --disable-strip \
                        --enable-dlna

homepage            http://ushare.geexbox.org/
license             GPL-2+
master_sites        ${homepage}releases
use_bzip2           yes
checksums           md5 5bbcdbf1ff85a9710fa3d4e82ccaa251

patchfiles          patch-configure.diff
# following prevents segfaults
patchfiles-append   patch-add_std_includes.diff
# following required due to libupnp changes
patchfiles-append   patch-ushare-upnp-build-fix.diff

configure.cflags-append     -std=gnu89 -I${prefix}/include -I${worksrcpath}
configure.ldflags-append    -lintl

post-destroot {
    file delete ${destroot}${prefix}/etc/init.d/ushare
    file rename ${destroot}${prefix}/etc/ushare.conf \
        ${destroot}${prefix}/etc/ushare.conf.sample
}

universal_variant no

startupitem.create      yes
startupitem.netchange   yes
startupitem.executable  ${prefix}/bin/uShare --cfg=${prefix}/etc/ushare.conf

notes "
****  ${name}  ****
Before running ${name}, you must configure it by creating and editing:
>>  ${prefix}/etc/ushare.conf
${prefix}/etc/ushare.conf.sample is provided as a template.

Note that ${name} runs as root.  This poses a security risk and you should not use
${name} on internet-facing machine

When loaded, you may be able to configure ${name} with a web browser at
>>  <ip.addr.of.host>:<port>/web/ushare.html
"