# -*- 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 64763 2010-03-15 16:31:33Z nox@macports.org $

PortSystem 1.0

name        transcode
version     1.1.4
revision    3
epoch       1
categories  multimedia
maintainers cogweb.net:lionteeth devans
description Video and audio processing tools
long_description    transcode is a suite of tools, all of which are \
            command line utilities, for transcoding various \
            video, audio, and container formats, running on a \
            platform that supports shared libraries and threads.\
            \
            Decoding and encoding is done by modules that are \
            responsible for feeding transcode with raw video/ \
            audio streams (import modules) and encoding the frames \
            (export modules). \
            \
            It includes a variety of video and audio filters, \
            including (but not limited to) video de-interlacing, \
            audio resampling, framerate conversion, different \
            resizing algorithms, smoothing, sharpening, denoisifying, \
            and cutting.

homepage        http://www.transcoding.org

master_sites    http://download.berlios.de/tcforge/ \
                http://download2.berlios.de/tcforge/

use_bzip2       yes

checksums       md5     6ba277fde95c26d217a88bbe5e6dd994 \
                sha1    3d08f67c047b1b498a4a5183ad164c0641fcbc00 \
                rmd160  6afd10e67503a6a70ee9826a7e1c49a31c4a4e7e

depends_build   port:pkgconfig

depends_lib     port:xorg-libXv \
                port:xorg-libXaw \
                port:xpm \
                path:lib/libavcodec.dylib:ffmpeg \
                port:libmpeg2 \
                port:libdvdread \
                port:jpeg \
                port:lame

platforms       darwin

patchfiles      patch-configure.in.diff

use_autoreconf  yes
autoreconf.args --force


configure.args  --disable-mmx \
                --with-libavcodec-prefix=${prefix} \
                --with-libavformat-prefix=${prefix} \
                --with-libmpeg2-prefix=${prefix} \
                --with-libdvdread-prefix=${prefix} \
                --with-libjpeg-prefix=${prefix} \
                --with-lame-prefix=${prefix}

use_parallel_build  yes

# port:libmpeg2 is not universal
universal_variant no

# Optional components

variant mmx description {enable mmx optimizations} {
     configure.args-delete --disable-mmx
}

variant full requires a52dec faac freetype imagemagick libdv libogg libpostproc libquicktime libtheora libvorbis libxml2 lzo mjpegtools x264 xvid description {enable all optional components} {
}

variant a52dec description {enable support for decoding ATSC A/52 streams} {
    depends_lib-append port:a52dec
    configure.args-append --enable-a52 --with-a52-prefix=${prefix}
}

variant faac description {enable AAC encoding support via libfaac} {
    depends_lib-append port:faac
    configure.args-append --enable-faac --with-faac-prefix=${prefix}
}

variant freetype description {enable support for the FreeType font engine} {
    depends_lib-append port:freetype
    configure.args-append --enable-freetype2 --with-freetype2-prefix=${prefix}
}

variant imagemagick description {enable support for the manipulation of still images} {
    depends_lib-append port:ImageMagick
    configure.args-append --enable-imagemagick --with-imagemagick-prefix=${prefix}
}

variant libdv description {enable support for the Digital Video format via libdv} {
    depends_lib-append port:libdv
    configure.args-append --enable-libdv --with-libdv-prefix=${prefix}
}

variant libogg description {enable support for encoding and decoding ogg audio} {
    depends_lib-append port:libogg
    configure.args-append --enable-ogg --with-ogg-prefix=${prefix}
}

variant libpostproc description {enable libpostproc support from ffmpeg} {
    configure.args-append --enable-libpostproc --with-libpostproc-prefix=${prefix}
}

variant libquicktime description {enable support for QuickTime video} {
    depends_lib-append port:libquicktime
    configure.args-append --enable-libquicktime --with-libquicktime-prefix=${prefix}
}

variant libtheora description {enable support for the open video codec theora} {
    depends_lib-append port:libtheora
    configure.args-append --enable-theora --with-theora-prefix=${prefix}
}

variant libvorbis description {enable support for a fully open compressed audio format} {
    depends_lib-append port:libvorbis
    configure.args-append --enable-vorbis --with-vorbis-prefix=${prefix}
}

variant libxml2 description {enable support for the XML metalanguage} {
    depends_lib-append port:libxml2
    configure.args-append --enable-libxml2 --with-libxml2-prefix=${prefix}
}

variant lzo description {enable lossless data compression via lzo2} {
    depends_lib-append port:lzo2
    configure.args-append --enable-lzo --with-lzo-prefix=${prefix}
}

variant mjpegtools description {enable mjpegtools support} {
    depends_lib-append port:mjpegtools
    configure.args-append --enable-mjpegtools --with-mjpegtools-prefix=${prefix}
}

variant x264 description {enable support for encoding H264/AVC video} {
    depends_lib-append port:x264
    configure.args-append --enable-x264 --with-x264-prefix=${prefix}
}

variant xvid description {enable support for the open Xvid video codec} {
    depends_lib-append port:XviD
    configure.args-append --enable-xvid --with-xvid-prefix=${prefix}
}

variant experimental description {enable new, experimental or even incomplete components} {
    configure.args-append --enable-experimental
}

variant deprecated description {enable deprecated or even broken components} {
    configure.args-append --enable-deprecated
}

#
# Display options
#

variant libsdl description {enable Simple DirectMedia Layer display support} {
    depends_lib-append path:lib/pkgconfig/sdl.pc:libsdl
    configure.args-append --enable-sdl --with-sdl-prefix=${prefix}
}

variant no_x11 {
    depends_lib-delete port:xorg-libXv
    depends_lib-delete port:xorg-libXaw
    depends_lib-delete port:xpm
    configure.args-append --without-x
}

platform darwin {
    configure.args-append --build=${build_arch}-apple-darwin${os.major}
}

livecheck.type  regex
livecheck.url   http://download.berlios.de/tcforge/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
