# -*- 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                    blockout2
version                 2.4
revision                1
set short_version       [strsed ${version} {g/\.//}]
categories              games
maintainers             rixon.org:jeremy
license                 GPL-2+
installs_libs           no

description             Open source clone of the 1989 California Dreams classic game Blockout.
long_description        ${description}

homepage                http://www.blockout.net/blockout2/
master_sites            sourceforge:project/blockout/blockout/BlockOut%20${version}/
distname                bl${short_version}-src-linux-i586
worksrcdir              bl${short_version}_lin_src

checksums               rmd160  3ddbf10a71b748687f335cd5ec55a8fbf8f9e138 \
                        sha256  c95766b8d6fce9820e14a23cd1bdea28591c01d8fdf5ece06cca1071f082c088 \
                        size    5017393

depends_lib             port:libsdl \
                        port:libsdl_mixer

post-extract {
    copy ${filespath}/Makefile ${worksrcpath}
}

patchfiles              patch-BlockOut-BlockOut.cpp.diff \
                        patch-BlockOut-GLApp-GLApp.cpp.diff \
                        patch-BlockOut-GLApp-GLFont.cpp.diff \
                        patch-BlockOut-GLApp-GLSprite.cpp.diff \
                        patch-BlockOut-Makefile.diff \
                        patch-BlockOut-Utils.cpp.diff \
                        patch-ImageLib-src-gif-gif.c.diff \
                        patch-ImageLib-src-jpg-jpegdecoder.cpp.diff \
                        patch-ImageLib-src-png-hpng.c.diff \
                        patch-ImageLib-src-Makefile.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/BlockOut/Utils.cpp
}

use_configure           no

variant universal {}

build.args              CC="${configure.cc} [get_canonical_archflags cc]" \
                        CXX="${configure.cxx} [get_canonical_archflags cxx]" \
                        PREFIX=${prefix}

destroot.args           PREFIX=${prefix}

app.name                BlockOut II
app.executable          ${prefix}/bin/blockout2

livecheck.type          regex
livecheck.url           ${homepage}
livecheck.regex         Release (\[0-9.\]+)