# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:et:sw=4:ts=4:sts=4
# $Id: Portfile 120154 2014-05-17 02:30:59Z ryandesign@macports.org $

PortSystem          1.0

name                freeciv
version             2.4.2
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          games
maintainers         nomaintainer
license             GPL-2+
description         An empire-building strategy game
long_description \
   Freeciv is a Free and Open Source empire-building strategy game inspired \
   by the history of human civilization. The game commences in prehistory \
   and your mission is to lead your tribe from the stone age to the space \
   age...

homepage            http://www.freeciv.org/
master_sites        sourceforge:project/${name}/Freeciv%20${branch}/${version}/ \
                    ftp://ftp.freeciv.org/freeciv/stable/
use_bzip2           yes

checksums           rmd160  6afef825310ca32ad977ddfe5f5be01117b92cad \
                    sha256  025d3cf51237a0c12422a5f100460a22ce1236b650a1e73cbd1c13c0b0676ce0


depends_build       port:pkgconfig

depends_lib         port:curl \
                    port:libiconv \
                    port:libsdl_mixer \
                    port:readline \
                    port:zlib

patchfiles          patch-client-options.c.diff

configure.args      --with-readline \
                    --enable-nls --with-libiconv-prefix=${prefix} \
                    --mandir=${prefix}/share/man --with-sdl-prefix=${prefix} \
                    --disable-sdltest

if {${name} eq ${subport}} {
    revision                0
    conflicts               freeciv-x11
    
    platforms               macosx
    
    depends_lib-append      port:freetype \
                            port:libpng \
                            port:libsdl \
                            port:libsdl_image
    
    configure.args-append   --enable-client=sdl
    
    PortGroup               app 1.0
    app.executable          freeciv-sdl
    app.icon                data/icons/128x128/freeciv-client.png
    
    livecheck.type          regex
    livecheck.regex         ${name}-(\[0-9.\]+)${extract.suffix}
} else {
    livecheck.type          none
}

subport freeciv-x11 {
    revision                0
    conflicts               freeciv
    
    platforms               darwin
    
    depends_lib-append      port:gettext \
                            port:gtk2
    
    configure.args-append   --enable-client=gtk2 \
                            --disable-gtktest
}
