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

PortSystem          1.0

name                mplayer-devel
conflicts           MPlayer

# svn info svn://svn.mplayerhq.hu/mplayer/trunk
version             38435

# https://git.videolan.org/?p=ffmpeg.git;a=shortlog
set ffmpeg_branch   master
set ffmpeg_ver      7aa9684db39a8ecf444b3af1c74c225757d8e49f

revision            0
categories          multimedia
license             GPL-2+
maintainers         {kencu @kencu} {jeremyhu @jeremyhu}

description         versatile movie player - development version
long_description    ${name} plays most movie files in popular and less popular formats. \
                    This version tracks a recent upstream mplayer commit.

homepage            https://www.mplayerhq.hu/

fetch.type          svn
depends_fetch-append bin:git:git
worksrcdir          trunk

fetch {
    system "svn export -r${version} --ignore-externals svn://svn.mplayerhq.hu/mplayer/trunk ${worksrcpath}/"

    # 10000 should be deep enough to find out checkout within a year
    # however, see https://trac.macports.org/ticket/57390
    system "git clone -b ${ffmpeg_branch} --depth 20000 git://git.videolan.org/ffmpeg.git ${worksrcpath}/ffmpeg"
    system "cd ${worksrcpath}/ffmpeg && git checkout -f ${ffmpeg_ver}"
}

# fix i386 builds
patchfiles          patch-mplayer-i386.diff

depends_build-append \
                    port:pkgconfig \
                    port:yasm

depends_lib-append  path:include/turbojpeg.h:libjpeg-turbo \
                    path:lib/libspeex.dylib:speex \
                    path:lib/pkgconfig/gnutls.pc:gnutls \
                    port:aom \
                    port:bzip2 \
                    port:dav1d \
                    port:fontconfig \
                    port:freetype \
                    port:fribidi \
                    port:lame \
                    port:libiconv \
                    port:libpng \
                    port:libxml2 \
                    port:lzo2 \
                    port:ncurses \
                    port:zlib

configure.args      --cc=${configure.cc} \
                    --host-cc=${configure.cc} \
                    --enable-freetype \
                    --enable-menu


foreach option {

3dfx aa alsa apple-ir arts bl bluray caca cddb cdparanoia dart dga1 dga2 direct3d directfb \
directx dvb dvdnav dvdread dxr2 dxr3 esd faac faad fbdev ggi gif gui jack joystick kai kva \
ladspa liba52 libbs2b libdca libdv libnut libvorbis lirc live macosx-finder mad mga mng \
mpg123 musepack nas nemesi ossaudio pulse pvr qtx quartz radio  radio-capture  s3fb sdl \
sgiaudio smb sndio sunaudio svga tdfxfb tdfxvid theora toolame  tv-bsdbt848 tv-dshow \
tv-v4l1 tv-v4l2 twolame v4l2 vdpau vesa vidix vstream wii win32dll win32waveout x11 \
x264 xmga xmms xv xvid xvmc xvr100 zr

} {
    configure.args-append --disable-${option}
}
