# -*- 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
# $Id: Portfile 85666 2011-10-15 15:49:44Z ecronin@macports.org $

PortSystem 1.0

name            mediaserv
version         0.05
revision        2
categories      net
license         Artistic
maintainers     ecronin openmaintainer
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
livecheck.type  regex
livecheck.url   https://garage.maemo.org/frs/?group_id=455
livecheck.regex mediaserv-\(\[0-9\]+\.\[0-9\]+\)\.tar\.gz
checksums       md5 94c300a0e95c55dae42a61f77e4e41fe \
                sha1 53aa0d2d287bdf82c232e7e944d9212453dc47b0 \
                rmd160 78e824cd8b28effc58543e75aaf63e2cdc958941
worksrcdir      ${name}

depends_run     port:perl5.12 port:p5.12-libwww-perl port:p5.12-xml-rss \
                port:p5.12-datetime port:MPlayer port:tablet-encode

patchfiles      patch-mediaserv.diff patch-install_sh.diff
post-patch {
    reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|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}
    eval 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
}
