# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           app 1.0

name                Maelstrom
version             3.0.7
revision            0
checksums           rmd160  f6eb516ead50e03e02d0a10f075ff7b1652cda15 \
                    sha256  93680322f4b04d4727ea8e0b461f259b604dc69e7465cb91d2b9aad378a9a036 \
                    size    1971558

categories          games
platforms           darwin
maintainers         {ryandesign @ryandesign} openmaintainer
license             GPL-2+

description         Ambrosia Software's 1992 Macintosh video game \
                    Maelstrom by Andrew Welch based on Asteroids and \
                    Blasteroids by Atari

long_description    You pilot your ship through the dreaded \"Maelstrom\" \
                    asteroid belt. Suddenly your best friend thrusts \
                    towards you and fires, directly at your cockpit. You \
                    raise your shields just in time, and the battle is \
                    joined. The deadliest stretch of space known to \
                    mankind has just gotten deadlier. Everywhere \
                    massive asteroids jostle for a chance to crush your \
                    ship, and deadly shinobi fighter patrols pursue you \
                    across the asteroid belt. But the deadliest of them \
                    all is your sister ship, assigned to you on patrol. \
                    The pilot, trained by your own Navy, battle hardened \
                    by months in the Maelstrom, is equipped with a twin of \
                    your own ship and intimate knowledge of your tactics. \
                    The lovely Stratocaster R&R facility never sounded so \
                    good, but as you fire full thrusters to dodge the \
                    latest barrage you begin to think you'll never get \
                    home...

homepage            https://www.libsdl.org/projects/Maelstrom/
master_sites        ${homepage}src/

depends_build       port:pkgconfig

depends_lib         port:libsdl2 \
                    port:libsdl2_net

app.executable      ${build.dir}/${name}
app.icon            icon.bmp
app.identifier      org.libsdl.${name}

set ac              ${applications_dir}/${app.name}.app/Contents
set docdir          ${prefix}/share/doc/${name}

# The project distributes a Mac app on a disk image, and I'm trying to
# reproduce that here as closely as possible (minus bundling libsdl2)
# but the project's build system does not appear to contain a way to
# create the app. I've asked the developer about this.
destroot {
    # The app portgroup installs the actual executable.
    # The app supports various command line switches so put a symlink in
    # bin to make this more discoverable.
    ln -s ${ac}/MacOS/${name} ${destroot}${prefix}/bin/[string tolower ${name}]
    system -W ${build.dir} "${build.cmd} install_gamedata \"target=${destroot}${ac}/Resources\""
    system -W ${build.dir} "${build.cmd} install_gamedocs \"target=${destroot}${prefix}/share/doc/${name}\""
}
