# $Id: Portfile 90187 2012-02-25 18:26:50Z rmstonecipher@macports.org $

PortSystem 1.0

name             live555
version          2012.02.04
categories       multimedia
license          LGPL-2.1+
maintainers      nomaintainer
description      LIVE555 Streaming Media
long_description \
  This code forms a set of C++ libraries for multimedia streaming, using open\
  standard protocols (RTP/RTCP, RTSP, SIP). These libraries - which can be\
  compiled for Unix (including Linux and Mac OS X), Windows, and QNX (and\
  other POSIX-compliant systems) - can be used to build streaming\
  applications.
homepage         http://www.live555.com/liveMedia/
platforms        darwin
master_sites     ${homepage}public/

checksums           rmd160  0ff1f656d7244b94820a7ee299d7c96003791b00 \
                    sha256  bd55b78d72d8a7b32a69d54f1a852ea7c4e666b90272a74091105b8c9292eccd

distname         live.${version}
universal_variant no
worksrcdir       live

set files_0      ${workpath}/files-0.txt
set files_1      ${workpath}/files-1.txt
set files_new    ${workpath}/files-new.txt

configure.cmd    ./genMakefiles
configure.pre_args {}

post-configure {
    ui_debug "Create a list of files: \[${files_0}\]"
    system -W ${worksrcpath} "find -s . ! -type d > ${files_0}"
}

build.args-append   C_COMPILER='${configure.cc} [get_canonical_archflags]' \
                    CPLUSPLUS_COMPILER='${configure.cxx} [get_canonical_archflags]' \
                    LINK='${configure.cxx} [get_canonical_archflags] -o '

post-build {
    ui_debug "Create an updated list of files: \[${files_1}\]"
    system -W ${worksrcpath} "find -s . ! -type d > ${files_1}"
    
    ui_debug "Create a list of new files: \[${files_new}\]"
    system "comm -1 -3 ${files_0} ${files_1} > ${files_new}"
}

destroot {
    set dst ${destroot}${prefix}/lib/live
    
    ui_debug "Copy worksrcpath into destroot"
    file copy ${worksrcpath} ${dst}
    
    ui_debug "Delete everything but *.hh and *.h files listed in \[${files_0}\]"
    system -W ${dst} "grep -v -e '\\.h\$' -e '\\.hh\$' ${files_0} | xargs rm"
    
    ui_debug "Delete every *.o file listed in \[${files_new}\]"
    system -W ${dst} "grep -e '\\.o\$' ${files_new} | xargs rm"
}

platform macosx {
        configure.args  macosx
}
platform linux {
        configure.args  linux
}

livecheck.type      regex
livecheck.url       ${homepage}public/
livecheck.regex     live\\.(\[0-9a-z.\]+)\\.tar\\.gz
