# $Id: Portfile 78091 2011-04-23 14:04:20Z raimue@macports.org $

PortSystem 1.0

name            xmoto
version         0.5.7
categories      games
platforms       macosx
maintainers     raimue

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       md5     c4b8477412445e114843b3b6163937f3 \
                sha1    e781b42480a96187b5aca4126d17ecf0610ca5ac \
                rmd160  7815a44f2015d1d54570bb9d1dc0e33041ad2434

depends_build   bin:grep:grep

depends_lib     port:libpng \
                port:jpeg \
                path:lib/pkgconfig/sdl.pc: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

# 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

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