# $Id: Portfile 58210 2009-09-24 06:56:08Z ryandesign@macports.org $

PortSystem              1.0

name                    alienblaster
version                 1.1.0
categories              games
platforms               darwin
maintainers             nomaintainer

description             action loaded 2D arcade shooter for up to two players
long_description        ${description}

homepage                http://www.schwardtnet.de/alienblaster/
master_sites            ${homepage}archives/
extract.suffix          .tgz

checksums               md5 27412a868f7d4ae0949036aeb29a6691

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

worksrcdir              ${name}

configure {
    reinplace "s|./images|${prefix}/share/${name}/images|g" \
        ${worksrcpath}/src/global.h \
        ${worksrcpath}/src/global.cc \
        ${worksrcpath}/cfg/level1.cfg \
        ${worksrcpath}/cfg/level2.cfg \
        ${worksrcpath}/cfg/levelArcade.cfg
    reinplace "s|=images/|=${prefix}/share/${name}/images/|g" \
        ${worksrcpath}/cfg/level1.cfg \
        ${worksrcpath}/cfg/level2.cfg \
        ${worksrcpath}/cfg/levelArcade.cfg
    reinplace "s|./cfg|${prefix}/etc/${name}|g" \
        ${worksrcpath}/src/global.h \
        ${worksrcpath}/src/global.cc
    reinplace "s|./sound|${prefix}/share/${name}/sound|g" \
        ${worksrcpath}/src/global.h \
        ${worksrcpath}/src/global.cc
}

destroot {
    xinstall -m 755 -s ${worksrcpath}/alienblaster ${destroot}${prefix}/bin
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/sound ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/images ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/cfg ${destroot}${prefix}/etc/${name}
}

platform darwin {
    post-destroot {
        xinstall -m 755 -d ${destroot}${applications_dir}/AlienBlaster.app/Contents/MacOS
        ln -s ${prefix}/bin/alienblaster ${destroot}${applications_dir}/AlienBlaster.app/Contents/MacOS/AlienBlaster
    }
}
