# -*- 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 115019 2013-12-22 09:29:46Z ryandesign@macports.org $

PortSystem          1.0

name                gpac
version             0.5.0
revision            4
categories          multimedia
platforms           darwin
maintainers         nomaintainer
license             LGPL-2+

description         multimedia framework for research and academic purposes
long_description    GPAC is an Open Source multimedia framework for \
                    research and academic purposes. The project \
                    covers different aspects of multimedia, with a \
                    focus on presentation technologies (graphics, \
                    animation and interactivity). Includes MP4Box and \
                    Osmo4.

homepage            http://gpac.wp.mines-telecom.fr/
master_sites        sourceforge:project/gpac/GPAC/GPAC%20${version}

use_zip             yes

checksums           rmd160  106f589a52f147bd8f00ffced2b252f81ed3f053 \
                    sha256  5e067850618783d3ba4d9035bcea6727855f3a87a007960ab1f0f980a552f3cb

depends_build       port:pkgconfig \
                    port:zlib

depends_lib         port:a52dec \
                    port:faad2 \
                    path:lib/libavcodec.dylib:ffmpeg \
                    port:jpeg \
                    port:libmad \
                    port:libogg \
                    port:libpng \
                    port:libsdl \
                    port:libtheora \
                    port:libvorbis \
                    port:openjpeg \
                    port:openssl \
                    port:jack \
                    port:xvid \
                    port:mesa \
                    port:xorg-libXv

worksrcdir          ${name}

post-extract {
    file attributes ${worksrcpath}/configure -permissions a+x
}

patchfiles          patch-configure.diff \
                    patch-ffmpeg-2.0.diff

# This project's build system misuses the prefix "cpp" to refer to the C++ compiler instead of the C preprocessor.
# https://sourceforge.net/p/gpac/bugs/287/
# Unfortunately setting cc and cpp doesn't actually do anything.
# https://sourceforge.net/p/gpac/bugs/286/

# external spidermonkey (--use-js=no) is not recognized because it doesn't provide a pkg-config file and build fails with local copy
# pulseaudio is recognized if installed but build fails

configure.args      --cc="${configure.cc}" \
                    --cpp="${configure.cxx}" \
                    --extra-cflags="${configure.cc_archflags}" \
                    --extra-ldflags="${configure.ld_archflags}" \
                    --mandir=${prefix}/share/man \
                    --X11-path=${prefix} \
                    --disable-pulseaudio \
                    --use-js=no

# use the RightCompiler

build.args-append    CC="${configure.cc}"

# This project's build system detects CPU and endianness at configure time.
# muniversal is worth a try.
universal_variant   no

use_parallel_build  no

livecheck.regex     {/GPAC%20([0-9.]+)}
