# $Id: Portfile 38898 2008-08-02 08:46:13Z ryandesign@macports.org $

PortSystem              1.0

name                    openal
version                 1.0
categories              audio devel
platforms               darwin
maintainers             nomaintainer

description             OpenAL is a cross-platform 3D audio API
long_description        OpenAL is a cross-platform 3D audio API appropriate \
                        for use with gaming applications and many other types \
                        of audio applications.

homepage                http://www.openal.org/
master_sites            macports
#svn.url                 http://opensource.creative.com/repos/openal/tags/MacOSX1-2_Spec1-0/
checksums               sha1 156d26e6369b13efe9a525cb0db9e6078ecb05a9
use_bzip2               yes

worksrcdir              openal-1.0/macosx

patch {
    reinplace "s/CADebugMacros.cp/CADebugMacros.cpp/g" ${worksrcpath}/al_osx.pbproj/project.pbxproj
    reinplace "s/CADebugMacros.cp/CADebugMacros.cpp/g" ${worksrcpath}/al_osx.xcode/project.pbxproj
}

use_configure           no

build.type              pbx
build.target
build.args              -project al_osx.xcode
post-build {
    file copy ${filespath}/Makefile ${worksrcpath}
    system "cd ${worksrcpath} && make all PREFIX=${prefix}"
}

destroot {
    xinstall -m 755 -d ${destroot}${prefix}/include/openal
    xinstall -m 644 -W ${worksrcpath}/al al.h alc.h alctypes.h altypes.h \
        alut.h ${destroot}${prefix}/include/openal
    xinstall -m 644 ${worksrcpath}/libopenal1.0.0.dylib \
        ${destroot}${prefix}/lib
    system "cd ${destroot}${prefix}/lib \
        && ln -s libopenal1.0.0.dylib libopenal1.0.dylib \
        && ln -s libopenal1.0.0.dylib libopenal1.dylib \
        && ln -s libopenal1.0.0.dylib libopenal.dylib"
}
