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

github.setup            wesnoth wesnoth 1.16.12
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                0
checksums               rmd160  8cb290ae1451d4dea2665baae6e99999d0e7cba0 \
                        sha256  1ebb0ec3f7d90ec1edf61710253a05ff5b04d7068a1d48d29b0e6318c946b966 \
                        size    476686555

set branch              [join [lrange [split ${version} .] 0 1] .]
categories              games
maintainers             {ryandesign @ryandesign} openmaintainer
license                 GPL-2+
homepage                https://www.wesnoth.org
master_sites            sourceforge:project/wesnoth/wesnoth-${branch}/wesnoth-${version}
use_bzip2               yes

description             a fantasy turn-based strategy game

long_description        Battle for Wesnoth is a fantasy turn-based strategy \
                        game. Battle for control of villages, using variety of \
                        units which have advantages and disadvantages in \
                        different types of terrains and against different \
                        types of attacks. Units gain experience and advance \
                        levels, and are carried over from one scenario to the \
                        next campaign.

depends_build-append    path:bin/pkg-config:pkgconfig

depends_lib-append      port:boost \
                        port:bzip2 \
                        path:lib/pkgconfig/cairo.pc:cairo \
                        port:expat \
                        port:fontconfig \
                        port:freetype \
                        port:gettext \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:graphite2 \
                        path:lib/pkgconfig/harfbuzz.pc:harfbuzz \
                        port:libffi \
                        port:libiconv \
                        port:libogg \
                        path:lib/pkgconfig/pixman-1.pc:libpixman \
                        port:libpng \
                        port:readline \
                        port:libsdl2 \
                        port:libsdl2_image \
                        port:libsdl2_mixer \
                        port:libsdl2_net \
                        port:libsdl2_ttf \
                        port:libvorbis \
                        path:lib/pkgconfig/pango.pc:pango \
                        port:pcre \
                        port:zlib

compiler.cxx_standard   2017

patchfiles-append       frameworks.patch
patchfiles-append       patch-wesnoth-apple-notifications.diff
patchfiles-append       patch-wesnoth-sdl-main.diff

# src/global.hpp:28:2: error: "Compilation with NDEBUG defined isn't supported, Wesnoth depends on asserts."
configure.cppflags-append -UNDEBUG

post-destroot {
    file copy ${worksrcpath}/projectfiles/Xcode/Resources/SDLMain.nib ${destroot}${applications_dir}/${app.name}.app/Contents/Resources
}

app.icon                projectfiles/Xcode/Resources/icon.icns
app.name                The Battle for Wesnoth
app.identifier          org.wesnoth.Wesnoth
app.retina              yes

github.livecheck.regex  {(\d+\.\d*[02468](\.\d+)*)}
