# -*- 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               cmake 1.1
PortGroup               github 1.0
PortGroup               boost 1.0
PortGroup               app 1.0

github.setup            SuperTux supertux 0.6.3 v
revision                2

github.tarball_from     releases
distname                SuperTux-v${version}-Source

checksums               rmd160  24d5adf76eb3e685054a6150104cf8c29d4cc20e \
                        sha256  f7940e6009c40226eb34ebab8ffb0e3a894892d891a07b35d0e5762dd41c79f6 \
                        size    182065428

categories              games
license                 GPL-3+
platforms               darwin
maintainers             nomaintainer

description             classic 2D jump'n run sidescroller game
long_description        ${name} is an open-source ${description} in a style similar\
                        to the original Super Mario games.

homepage                https://supertux.org/

# squirrel tries to use the C linker for code that uses c++ libraries
patchfiles              patch-supertux-squirrel-linkagefix.diff \
                        patch-supertux-cmake.diff

cmake.build_type        Release
compiler.cxx_standard   2014

# Use the SDL renderer (which could be OpenGL)
configure.args-append   -DENABLE_OPENGL=OFF

# bundle using the app PG instead of the cmake / cpack machinery
configure.args-append   -DENABLE_APP_BUNDLING=OFF

configure.args-append   -DINSTALL_SUBDIR_BIN=bin \
                        -DINSTALL_SUBDIR_SHARE=share/supertux2/data \
                        -DINSTALL_SUBDIR_DOC=share/supertux2

depends_build-append    port:pkgconfig

# also uses libsdl2_ttf, but insists on building it's own copy
# upstream needs to accomodate a system version of this

depends_lib-append      port:curl       \
                        port:freetype   \
                        port:fribidi    \
                        port:glm        \
                        path:lib/pkgconfig/harfbuzz.pc:harfbuzz   \
                        path:include/turbojpeg.h:libjpeg-turbo       \
                        port:libogg     \
                        port:libpng     \
                        port:libraqm    \
                        port:libsdl2    \
                        port:libsdl2_image \
                        port:libvorbis  \
                        port:physfs     \
                        port:zlib

# https://trac.macports.org/ticket/61491
post-destroot {
    reinplace "s|exec ${prefix}/bin/supertux2|exec ${prefix}/bin/supertux2 --datadir ${prefix}/share/supertux2/data|" \
        ${destroot}${applications_dir}/${app.name}.app/Contents/MacOS/${app.name}
}

app.icon                data/images/engine/icons/supertux.icns
app.name                SuperTux
app.identifier          com.googlecode.supertux2
app.executable          supertux2
app.use_launch_script   yes
