# $Id: Portfile 79991 2011-07-01 08:49:20Z ryandesign@macports.org $

PortSystem              1.0

name                    chromium-bsu
version                 0.9.15
categories              games
platforms               darwin
maintainers             ryandesign openmaintainer
license                 MIT

description             fast paced, arcade-style, top-scrolling space shooter.
long_description        ${description}

homepage                http://chromium-bsu.sourceforge.net/
master_sites            sourceforge:project/chromium-bsu/Chromium%20B.S.U.%20source%20code/${version}

checksums               sha1    819107ecb8d0194c0827bc16dec252d30199d7e9 \
                        rmd160  2909f2f0da0cb2272b9bf25bf6474d46a346512c

depends_build           port:pkgconfig

depends_lib             path:lib/pkgconfig/sdl.pc:libsdl \
                        port:libsdl_image \
                        port:libsdl_mixer \
                        port:ftgl

post-patch {
    reinplace "s|\"../data\"|\"${prefix}/share/${name}\"|g" \
        ${worksrcpath}/src/main.cpp \
        ${worksrcpath}/src/define.h
}

configure.args          --disable-glc \
                        --disable-glpng \
                        --enable-ftgl \
                        --enable-sdl \
                        --enable-sdlimage \
                        --disable-glut \
                        --disable-openal \
                        --enable-sdlmixer

configure.ldflags-append -lintl

platform darwin {
    depends_build-append port:makeicns
    set appname {Chromium B.S.U.}
    post-extract {
        copy ${filespath}/Info.plist.in ${workpath}/Info.plist
    }
    post-patch {
        reinplace "s|@APPNAME@|${appname}|g" ${workpath}/Info.plist
        reinplace "s|@NAME@|${name}|g" ${workpath}/Info.plist
        reinplace "s|@VERSION@|${version}|g" ${workpath}/Info.plist
    }
    post-build {
        system "${prefix}/bin/makeicns -in ${worksrcpath}/misc/chromium-bsu.png -out ${workpath}/${name}.icns"
    }
    post-destroot {
        xinstall -d ${destroot}${applications_dir}/${appname}.app/Contents/MacOS \
            ${destroot}${applications_dir}/${appname}.app/Contents/Resources
        xinstall -m 644 ${workpath}/Info.plist ${destroot}${applications_dir}/${appname}.app/Contents
        ln -s ${prefix}/bin/chromium-bsu \
            ${destroot}${applications_dir}/${appname}.app/Contents/MacOS/${appname}
        xinstall -m 644 ${workpath}/${name}.icns ${destroot}${applications_dir}/${appname}.app/Contents/Resources/
    }
}

livecheck.distname      Chromium%20B.S.U.%20source%20code
livecheck.url           http://sourceforge.net/projects/chromium-bsu/files/${livecheck.distname}
livecheck.regex         files/${livecheck.distname}/(\[0-9.\]+)/
