PortSystem 1.0

name            liquidwar
version         5.6.4
revision        1
categories      games
platforms       darwin
license         GPL-2+
maintainers     nomaintainer
description     A unique multiplayer wargame
long_description \
        Liquid War is a unique multiplayer wargame. \
        You control an army of liquid and have to try and eat your opponents. \
        The rules of Liquid War are truely original and have been invented \
        by Thomas Colcombet. A single player mode is available, but the \
        game is definitely designed to be multiplayer, and has network support.

homepage        http://www.ufoot.org/liquidwar/
master_sites    http://www.ufoot.org/download/${name}/v5/${version} \
                https://download.savannah.nongnu.org/releases/liquidwar/
checksums       md5 6917dd1026e6685404ffbd086f8ba374

depends_build   port:gmake
depends_lib     port:allegro

patchfiles      patch-headless-build.diff

post-patch {
    reinplace -E "s|^GAMEDIR =(.*)$|GAMEDIR = \$(exec_prefix)/bin|" ${worksrcpath}/Makefile.in
    reinplace -E "s|^GAMEDIR =(.*)$|GAMEDIR = \$(exec_prefix)/bin|" ${worksrcpath}/src/Makefile.in

    reinplace -E "s|^DATADIR =(.*)$|DATADIR = \$(datadir)/liquidwar|" ${worksrcpath}/Makefile.in
    reinplace -E "s|^DATADIR =(.*)$|DATADIR = \$(datadir)/liquidwar|" ${worksrcpath}/src/Makefile.in
}

# Allegro does not compile 64-bit due to NS* stuff, so we have to do 32-bit
supported_archs i386 ppc

configure.cflags-append     -DALLEGRO_UNIX
configure.args-append       --disable-target-opt --disable-asm
build.args                  CFLAGS="-DALLEGRO_UNIX -arch ${configure.build_arch}" LDFLAGS="-arch ${configure.build_arch}" \
                            DOC_TXT=no DOC_HTML=no DOC_MAN=yes DOC_INFO=no DOC_PS=no DOC_PDF=no
destroot.target             install_nolink

livecheck.type  regex
livecheck.url   http://www.ufoot.org/download/liquidwar/v5/
livecheck.regex {(5\.[0-9.]+)}