# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           perl5 1.0

name                mediaserv
version             0.05
revision            7
categories          net
license             Artistic-1
maintainers         nomaintainer
platforms           darwin

description         On-demand transcoding server for videos, targetting \
                    the Nokia Internet Tablets.
long_description    mediaserv is a simple web server which exposes video \
                    content on your desktop PC or server to your Nokia \
                    Internet Tablet (such as the Nokia 770, Nokia N800 or \
                    Nokia N810).  When content is accessed, it transcodes \
                    the video "Just In Time" and streams it to your \
                    Internet Tablet.  RSS feeds for directories are also \
                    provided, listing the most recently updated content, \
                    and compatible with Nokia's beta Video Center \
                    application.

homepage            http://mediautils.garage.maemo.org/mediaserv.html
master_sites        https://garage.maemo.org/frs/download.php/2632

checksums           rmd160  78e824cd8b28effc58543e75aaf63e2cdc958941 \
                    sha256  4c5ed56e63752adb21e136c4ae0de2a3ed712aaa6f77f08984eed261ed26ecea

worksrcdir          ${name}

perl5.branches      5.28

depends_run         port:perl${perl5.major} \
                    port:p${perl5.major}-libwww-perl \
                    port:p${perl5.major}-xml-rss \
                    port:p${perl5.major}-datetime \
                    port:tablet-encode \
                    path:bin/mplayer:mplayer-devel

patchfiles          patch-install_sh.diff \
                    patch-mediaserv.diff

post-patch {
    reinplace "s|/usr/bin/perl|${perl5.bin}|g" \
        ${worksrcpath}/mediaserv
    reinplace "s|@@STATIC_DIR@@|${prefix}/share/${name}|g" \
        ${worksrcpath}/install.sh
}

use_configure       no

build               {}

destroot {
    xinstall -m 755 ${worksrcpath}/mediaserv \
        ${destroot}${prefix}/bin/mediaserv
    xinstall -m 755 ${worksrcpath}/install.sh \
        ${destroot}${prefix}/bin/mediaserv-install
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    xinstall -m 644 {*}[glob ${worksrcpath}/resources/*] \
        ${destroot}${prefix}/share/${name}
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/README.txt \
        ${destroot}${prefix}/share/doc/${name}/README.txt
}

livecheck.type      regex
livecheck.url       https://garage.maemo.org/frs/?group_id=455
livecheck.regex     mediaserv-\(\[0-9\]+\.\[0-9\]+\)\.tar\.gz