# -*- 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 88781 2012-01-11 17:02:56Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           muniversal 1.0

name                librem
version             0.4.0
categories          net
platforms           darwin
maintainers         db.org:aeh
license             BSD

description         portable audio and video processing media library

long_description    ${name} is a ${description}.

homepage            http://www.creytiv.com/
master_sites        ${homepage}pub/

distname            rem-${version}

checksums           rmd160  05fe8353ed8d81a052424c4f0924170b1f2f4045 \
                    sha256  7b85a0945ad2632fcc950f5d29a1e38dc47e29bffa0063ec1176ad85df32e8fc

depends_lib         port:libre

use_configure       no

build.args          PREFIX=${prefix} SYSROOT_ALT=${prefix} CCACHE= \
                    LIBRE_MK=${prefix}/share/re/re.mk \
                    LIBRE_INC=${prefix}/include/re \
                    LIBRE_SO=${prefix}/lib
destroot.args       ${build.args}

if {[tbool configure.ccache]} {
    build.env-append CCACHE=ccache
}

if {[variant_isset universal]} {
    foreach arch ${configure.universal_archs} {
        lappend merger_build_env(${arch})    CC='${configure.cc} -arch ${arch}'
        lappend merger_destroot_env(${arch}) CC='${configure.cc} -arch ${arch}'
    }
} else {
    build.env-append    CC='${configure.cc} ${configure.cc_archflags}'
    destroot.env-append CC='${configure.cc} ${configure.cc_archflags}'
}

post-destroot {
    system "install_name_tool -id ${prefix}/lib/librem.dylib ${destroot}${prefix}/lib/librem.dylib"
}
