# $Id: Portfile 75470 2011-01-26 01:58:23Z raimue@macports.org $

PortSystem 1.0

name		HandBrake
version		0.9.5
platforms	macosx
categories	aqua multimedia
maintainers	nomaintainer
description	DVD to MPEG4 converter
long_description	HandBrake is a GPL'd multi-platform, heavily \
			multithreaded DVD to MPEG-4 converter. \
			- Can encode directly from DVDs (even encrypted ones) \
			- Outputs MP4, AVI or OGM files \
			- Outputs AAC, MP3 or Vorbis audio \
			- Supports 2-pass encoding \
			- Supports encoding of two audio tracks \
			- Includes a bitrate calculator \
			- Supports picture cropping and scaling
homepage	http://handbrake.fr/

use_bzip2 yes
master_sites    http://handbrake.fr/rotation.php?file=${distname}${extract.suffix}&dummy=:src \
                http://download.handbrake.fr/handbrake/contrib/:contrib
distfiles       ${distname}${extract.suffix}:src \
                a52dec-0.7.4.tar.gz:contrib \
                faac-1.28.tar.gz:contrib \
                faad2-2.7.tar.gz:contrib \
                ffmpeg-r25689.tar.bz2:contrib \
                fontconfig-2.8.0.tar.gz:contrib \
                freetype-2.3.9.tar.gz:contrib \
                lame-3.98.tar.gz:contrib \
                libass-0.9.9.tar.bz2:contrib \
                libbluray-0.0.1-pre-16-g1aab213.tar.gz:contrib \
                libdca-r81-strapped.tar.gz:contrib \
                libdvdnav-svn1168.tar.gz:contrib \
                libdvdread-svn1168.tar.gz:contrib \
                libmkv-0.6.4.1-0-ga80e593.tar.bz2:contrib \
                libogg-1.1.3.tar.gz:contrib \
                libsamplerate-0.1.4.tar.gz:contrib \
                libtheora-1.1.0.tar.bz2:contrib \
                libvorbis-aotuv_b5.tar.gz:contrib \
                libxml2-2.7.7.tar.gz:contrib \
                mp4v2-trunk-r355.tar.bz2:contrib \
                mpeg2dec-0.5.1.tar.gz:contrib \
                x264-r1834-a51816a.tar.gz:contrib
extract.only    ${distname}${extract.suffix}

checksums       ${distname}${extract.suffix} \
                    md5     e17d3663fc36a985fe43e188695e3196 \
                    sha1    6db599fe96a640e5355f1c92b8915f11c7cb45ad \
                    rmd160  7de96b74e93c9fb7c3fe83a425a7d512e9e811e0 \
                a52dec-0.7.4.tar.gz sha1 7c406b9b5351cdec56279b6d02f3f556711424d2 \
                faac-1.28.tar.gz sha1 d00b023a3642f81bb1fb13d962a65079121396ee \
                faad2-2.7.tar.gz sha1 80eaaa5cc576c35dd28863767b795c50cbcc0511 \
                ffmpeg-r25689.tar.bz2 sha1 0bf31c93575b8f0bd4b38592261bce4f9b9b8d8e \
                fontconfig-2.8.0.tar.gz sha1 570fb55eb14f2c92a7b470b941e9d35dbfafa716 \
                freetype-2.3.9.tar.gz sha1 2c82a4f87b076c13d878129c8651645803585ff4 \
                lame-3.98.tar.gz sha1 2908edcf0628512c407aadad317866826c6df5c7 \
                libass-0.9.9.tar.bz2 sha1 e95923d7833f9ec8aa4f826a6fe113ea30404ad5 \
                libbluray-0.0.1-pre-16-g1aab213.tar.gz sha1 571150392d95f283e4c5e6ea8bdc77218ea962cc \
                libdca-r81-strapped.tar.gz sha1 aace1f940184fad9ec033de48f7d1efc3d0c0ffa \
                libdvdnav-svn1168.tar.gz sha1 2e0b1cb2e215f231fcf7b94f8be6a4a4a6643e94 \
                libdvdread-svn1168.tar.gz sha1 f6db5b9b5cce837e0c3dfd34f9c434b243bfc6fa \
                libmkv-0.6.4.1-0-ga80e593.tar.bz2 sha1 c709548804ea697069d7156d0f9391f86d5da6a5 \
                libogg-1.1.3.tar.gz sha1 9ce317cfe225e121deee68cd81db39f15b602caa \
                libsamplerate-0.1.4.tar.gz sha1 d6974129497ba141d43c36826a23deb6c0b3e5d8 \
                libtheora-1.1.0.tar.bz2 sha1 fb1686a8318d79f889f248ff774265d0ec4c6430 \
                libvorbis-aotuv_b5.tar.gz sha1 ec446e9d2c480210ec8c5a02e479e52336450e3d \
                libxml2-2.7.7.tar.gz sha1 8592824a2788574a172cbddcdc72f734ff87abe3 \
                mp4v2-trunk-r355.tar.bz2 sha1 18a10807c5a05e0361e77d126599f8717ad7c8f5 \
                mpeg2dec-0.5.1.tar.gz sha1 c39a95d18e133cd81e890fd7672f592ed41fadfc \
                x264-r1834-a51816a.tar.gz sha1 33028199108ed71cb4f1b5ae755ef8a2e5f6e7d3

depends_build   port:python26 \
                bin:curl:curl \
                port:yasm
set python.bin  ${prefix}/bin/python2.6

post-extract {
    file mkdir ${worksrcpath}/download
    file copy \
        ${distpath}/a52dec-0.7.4.tar.gz \
        ${distpath}/faac-1.28.tar.gz \
        ${distpath}/faad2-2.7.tar.gz \
        ${distpath}/ffmpeg-r25689.tar.bz2 \
        ${distpath}/fontconfig-2.8.0.tar.gz \
        ${distpath}/freetype-2.3.9.tar.gz \
        ${distpath}/lame-3.98.tar.gz \
        ${distpath}/libass-0.9.9.tar.bz2 \
        ${distpath}/libbluray-0.0.1-pre-16-g1aab213.tar.gz \
        ${distpath}/libdca-r81-strapped.tar.gz \
        ${distpath}/libdvdnav-svn1168.tar.gz \
        ${distpath}/libdvdread-svn1168.tar.gz \
        ${distpath}/libmkv-0.6.4.1-0-ga80e593.tar.bz2 \
        ${distpath}/libogg-1.1.3.tar.gz \
        ${distpath}/libsamplerate-0.1.4.tar.gz \
        ${distpath}/libtheora-1.1.0.tar.bz2 \
        ${distpath}/libvorbis-aotuv_b5.tar.gz \
        ${distpath}/libxml2-2.7.7.tar.gz \
        ${distpath}/mp4v2-trunk-r355.tar.bz2 \
        ${distpath}/mpeg2dec-0.5.1.tar.gz \
        ${distpath}/x264-r1834-a51816a.tar.gz \
        ${worksrcpath}/download
}

configure.cmd   ${python.bin} make/configure.py
configure.pre_args
configure.args  --fetch=curl --arch=${configure.build_arch}

# +universal would be possible, but not implemented yet
# see ${worksrcpath}/doc/BUILD-Mac for details
universal_variant no

build.dir ${worksrcpath}/build
build.target

destroot {
    file copy ${worksrcpath}/build/${name}.app ${destroot}${applications_dir}/${name}.app
}
