# -*- 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
PortGroup       xcode 1.0

name            libsdl_sound-framework
version         1.0.3
revision        1
categories      audio devel
license         LGPL-2.1+
maintainers     nomaintainer
description     handles decoding of several popular sound file formats

long_description \
    SDL_sound is a library that handles the decoding of several popular sound \
    file formats, such as .WAV and .MP3. It is meant to make the programmer's sound \
    playback tasks simpler.

homepage        http://icculus.org/SDL_sound/
master_sites    ${homepage}downloads/
distname        SDL_sound-${version}
dist_subdir     libsdl_sound

checksums       md5     aa09cd52df85d29bee87a664424c94b5 \
                sha1    1984bc20b2c756dc71107a5a0a8cebfe07e58cb1 \
                rmd160  8e56daa71f827a4a22e7071a4e4f37c21dd96105

depends_lib     port:libsdl-framework \
                port:libogg \
                port:libvorbis \
                port:libmikmod

post-extract {
    system "tar xzf ${worksrcpath}/PBProjects.tar.gz -C ${worksrcpath}"
}

patchfiles      patch-project.pbxproj.diff

post-patch {
    set pbxproj ${worksrcpath}/${xcode.project}/project.pbxproj

    reinplace s|@PREFIX@|${prefix}|g ${pbxproj}
    reinplace -E "/(MACOSX_DEPLOYMENT_TARGET|GCC_VERSION|SDKROOT)_ppc =/d" ${pbxproj}
    reinplace "s|~/Library/Frameworks|./build/Frameworks|g" ${pbxproj}
    reinplace "s|\$(HOME)/Library/Frameworks|${frameworks_dir}|g" ${pbxproj}
}

xcode.project   PBProjects/SDL_sound.pbproj
xcode.target    Framework

xcode.build.settings    FRAMEWORK_SEARCH_PATHS=${frameworks_dir} \
                        INSTALL_PATH=${frameworks_dir} \
                        LIBRARY_SEARCH_PATHS=${prefix}/lib

xcode.destroot.type             framework
xcode.destroot.settings    {*}${xcode.build.settings}

universal_variant   no

livecheck.type  regex
livecheck.regex {SDL_sound (\d+(?:\.\d+)*)}