# $Id: Portfile 115019 2013-12-22 09:29:46Z ryandesign@macports.org $

PortSystem 1.0
PortGroup app 1.0

name            xmoto
version         0.5.10
revision	3
categories      games
platforms       macosx
maintainers     nomaintainer

description     X-Moto is a challenging 2D motocross platform game
long_description \
                X-Moto is a challenging 2D motocross platform game, where \
                physics plays an all important role in the gameplay. You need \
                to control your bike to its limits, if you want to have a \
                chance to finish the most difficult challenges.

homepage        http://xmoto.tuxfamily.org/
master_sites    http://download.tuxfamily.org/xmoto/xmoto/${version}/xmoto-${version}-src.tar.gz

checksums       rmd160  9fdbe46ffe5a8e050970d88910bc9d5a3336f1e0 \
                sha256  2d2438e4685aa5fc1aa9f73bfbe26893d7fc97fadd6e1cc9fdb09c8d16df9e1e

depends_build   bin:grep:grep

depends_lib     port:libpng \
                port:jpeg \
                port:libsdl \
                port:libsdl_mixer \
                port:libsdl_ttf \
                port:libsdl_net \
                port:lua \
                port:ode \
                port:sqlite3 \
                port:bzip2 \
                port:curl \
                port:libxdg-basedir

post-patch {
    # libpng 1.4 compatibility
    reinplace "s/png_set_gray_1_2_4_to_8/png_set_expand_gray_1_2_4_to_8/" \
        ${worksrcpath}/src/image/tim_png.cpp
}

configure.args-append --with-apple-opengl-framework --disable-sdltest

# xmoto does not pick up flags for ode correctly, so we do this manually
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521013
configure.cflags-append  -DdDOUBLE
configure.cxxflags-append -DdDOUBLE

app.icon ${filespath}/xmoto.png

livecheck.type  regex
livecheck.regex {XMoto ([\d.]+) released}
