# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 108364 2013-07-21 13:31:56Z ryandesign@macports.org $

PortSystem          1.0

name                youtube-dl
version             2013.07.19
categories          net
platforms           darwin
maintainers         ryandesign openmaintainer
supported_archs     noarch
license             public-domain

description         command-line program to download videos from YouTube.com and other sites

long_description    ${name} is a small ${description}.

homepage            http://rg3.github.com/youtube-dl/
master_sites        http://youtube-dl.org/downloads/${version}

checksums           rmd160  faee7d3da687a579a08c0ffc3729dc6e1bc9b3d6 \
                    sha256  bbe600377bd59131271c26ad05f86de809553b298f83bb32cf648e409513b7a9

depends_build       bin:zip:zip

depends_run         port:python27

worksrcdir          ${name}

post-extract {
    # Force the script to be regenerated by make.
    delete ${worksrcpath}/${name}
}

post-patch {
    reinplace "s|#!/usr/bin/env python|#!${prefix}/bin/python2.7|g" ${worksrcpath}/Makefile
}

use_configure       no

destroot.args       PREFIX=${prefix} \
                    MANDIR=${prefix}/share/man \
                    SYSCONFDIR=${prefix}/etc

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} LICENSE README.md ${destroot}${docdir}
}

livecheck.type      regex
livecheck.url       http://rg3.github.com/youtube-dl/update/versions.json
livecheck.regex     {"latest":\s*"([0-9.]+)"}
