# -*- 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

PortSystem          1.0
PortGroup           makefile 1.0

name                M2VDownsizer
version             1.1
revision            0

categories          multimedia
license             GPL-2
maintainers         {hotmail.com:amtor @RobK88} \
                    openmaintainer

description         MPEG-2 video stream recompressesion

long_description    ${name} is a tool that re-compresses MPEG-2 (or m2v) video \
                    streams.  In other words, ${name} will perform a complete \
                    decompression and recompression of MPEG-2 video streams for the \
                    best possible video quality.\
                    \n \
                    \n${name} accepts the raw MPEG-2 (or m2v) video data (not VOB) \
                    from the standard input and writes the recompressed video frames \
                    to the standard output.\
                    \n \
                    \nBe forewarned!  Decompression and recompression could take \
                    hours for large MPEG-2 video streams!  It is recommended that one \
                    first tries transcoding MPEG-2 streams using M2VRequantiser since \
                    transcoding is a lot faster and produces excellent results for most \
                    MPEG-2 video streams.  ${name} is only intended to be used for \
                    large MPEG-2 video streams when transcoding does not produce \
                    acceptable results.

homepage            https://web.archive.org/web/20120508050929if_/http://www.metakine.com/
master_sites        ${homepage}files

depends_lib-append  port:libmpeg2

checksums           rmd160 d662bfe195b59f5815bfdccaf3f81dae46d4e0d8 \
                    sha256 316a931810116d70a07cb57a80ae8483fa949bd575beee222a9a8e375c4d8590 \
                    size 371928

distname            ${name}
dist_subdir         ${name}/${version}
extract.suffix      .tgz

post-extract {
     copy ${filespath}/Makefile ${worksrcpath}
     copy ${filespath}/${name}.1 ${worksrcpath}
     file mkdir ${worksrcpath}/obj/utils
     file mkdir ${worksrcpath}/obj/altivec
     file mkdir ${worksrcpath}/obj/mpeg2enc
     file mkdir ${worksrcpath}/obj/main
}

patchfiles-append   1001-Replace-MPProcessors-Patch.diff \
                    1002-libmpeg2-Linkage-Patch.diff \
                    1003-Patch-config.h.diff \
                    1004-Fix-Includes-in-mjpeg_logging.diff

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin
    xinstall -m 0644 ${filespath}/${name}.1 ${destroot}${prefix}/share/man/man1
}
