# -*- 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

name                lgeneral
version             1.1.1
categories          games
platforms           darwin
maintainers         nomaintainer
license             GPL-2+

description         Turn-based strategy engine heavily inspired by Panzer General

long_description    LGeneral is a turn-based strategy engine heavily \
                    inspired by Panzer General. You play single scenarios \
                    or whole campaigns turn by turn against a human player \
                    or the AI. Entrenchment, rugged defense, defensive \
                    fire, surprise contacts, surrender, unit supply, \
                    weather influence, reinforcements and other \
                    implementations contribute to the tactical and \
                    strategic depth of the game.

homepage            http://lgames.sourceforge.net/index.php?project=LGeneral
master_sites        sourceforge

distfiles           ${distname}.tar.gz \
                    lgc-pg-0.32.tar.gz \
                    ${name}-data-1.1.3.tar.gz

checksums           ${distname}.tar.gz md5 18b88069c91e7e7c75cc44a9aa90d0d9 \
                    lgc-pg-0.32.tar.gz md5 750d3e68bea1fde7935a357133026c9a \
                    ${name}-data-1.1.3.tar.gz md5 786feb83f163834a22e3e85e1970145f

depends_lib         lib:libsdl:libsdl \
                    lib:libsdl_mixer:libsdl_mixer

configure {
    set conf "CPPFLAGS=-I${prefix}/include CFLAGS=-I${prefix}/include \
        LDFLAGS=-L${prefix}/lib ./configure --prefix=${prefix}"
    system "cd ${worksrcpath} && ${conf} --disable-sdltest"
    system "cd ${workpath}/${name}-data-1.1.3 && ${conf}"
    system "cd ${workpath}/lgc-pg-0.32 && ${conf} --disable-sdltest"
    reinplace "s|,-export-dynamic||g" ${worksrcpath}/src/Makefile
}

build {
    system "cd ${worksrcpath} && ${build.cmd} all"
    system "cd ${workpath}/${name}-data-1.1.3 && ${build.cmd} all"
    system "cd ${workpath}/lgc-pg-0.32 && ${build.cmd} all"
}

destroot {
    set cmd "${build.cmd} install ${destroot.destdir}"
    system "cd ${worksrcpath} && ${cmd}"
    system "cd ${workpath}/${name}-data-1.1.3 && ${cmd}"
    system "cd ${workpath}/lgc-pg-0.32 && ${cmd}"
}
