# -*- 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                    fife
version                 0.3.5
revision                1
maintainers             nomaintainer
categories              games python
platforms               darwin
license                 LGPL-2.1+

description             The FIFE game engine
long_description        FIFE stands for Flexible Isometric Free Engine and \
                        is a cross platform game creation framework.

homepage                http://www.fifengine.net/
master_sites            sourceforge:project/fife/active/src
distname                ${name}_${version}

checksums               rmd160  ccd94e7dd8c0487b81ee2e7076341ddb5e355018 \
                        sha256  1d3c7a19d05ae426af6ccd50a8ba79a71eb6e6f18f0226d1abdaeae7fcf9d3a8

depends_build           port:scons

depends_lib             port:python27 \
                        port:libsdl \
                        port:libsdl_image \
                        port:libsdl_ttf \
                        port:boost \
                        port:libogg \
                        port:libvorbis \
                        port:libguichan \
                        port:swig-python

patchfiles              patch-build-darwin-config.py.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/build/darwin-config.py
    reinplace "s|@FRAMEWORKS_DIR@|${frameworks_dir}|g" ${worksrcpath}/build/darwin-config.py
}

use_configure           no
use_parallel_build      no

variant universal {}

build.cmd               ${prefix}/bin/scons
build.target            fife
build.args              --prefix=${prefix} \
                        --python-prefix=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages/
build.env               CXX="${configure.cxx} [get_canonical_archflags cxx]" \
                        SWIG=${prefix}/bin/swig

# Check if this is still needed in 0.3.6
# http://fife.trac.cvsdude.com/engine/ticket/575
post-build {
    system "install_name_tool -id ${prefix}/lib/libfife.dylib ${worksrcpath}/build/engine/release/libfife.dylib"
}

destroot.target         install-all
destroot.args      {*}${build.args}
destroot.env       {*}${build.env}

livecheck.regex         src/${name}_(\[0-9.r\]+)${extract.suffix}