# $Id: Portfile 61350 2009-12-09 14:17:11Z jmr@macports.org $

PortSystem 1.0
name                    gnubg
version                 0.14.3
revision                3
categories              games
platforms               darwin
maintainers             nomaintainer
homepage                http://www.gnubg.org/
description             GNU Backgammon

long_description        GNU Backgammon (gnubg) is a software for playing and analysing \
                        backgammon positions, games and matches. It's based on a neural \
                        network. Although it already plays at a very high level, it's \
                        still work in progress. You can play at GNU Backgammon using the \
                        command line or via a graphical interface based (on GTK+).

master_sites            http://alpha.gnu.org/gnu/${name}/ \
                        ftp://alpha.gnu.org/gnu/${name}/ \
                        ftp://ftp.funet.fi/pub/mirrors/alpha.gnu.org/gnu/${name}/
                        
distfiles               ${distname}.tar.gz ${name}.weights-0.14.gz
extract.only            ${distname}.tar.gz
                        
checksums               ${name}-${version}.tar.gz md5 b3ab1ace76fa4bea69db8e617ab587da \
                        ${name}.weights-0.14.gz md5 9f1154a9b327954a260726aa6aa6eea5

depends_build           path:bin/pkg-config:pkgconfig
depends_lib             port:gtk2 \
                        port:libxml2 \
                        port:freetype \
                        port:readline

post-extract {          copy ${distpath}/${name}.weights-0.14.gz ${worksrcpath}
                        system "cd ${worksrcpath} && gzip -d ${name}.weights-0.14.gz"
                        move ${worksrcpath}/${name}.weights-0.14 ${worksrcpath}/${name}.weights
                        }

patchfiles              patch-configure.diff patch-rollout.h.diff

configure.cflags-append "-lmx"
configure.ldflags-append "-L${prefix}/lib -lX11 -bind_at_load -multiply_defined suppress"

configure.args          --mandir=${prefix}/share/man \
                        --infodir=${prefix}/share/info \
                        --sysconfdir=${prefix}/etc \
                        --libdir=${prefix}/lib \
                        --disable-gtkextratest \
                        --disable-libarttest \
                        --disable-esdtest \
                        --disable-audiofiletest \
                        --disable-gtkglext-test \
                        --disable-artsc-test \
                        --disable-nas \
                        --without-sound \
                        --without-board3d \
                        --without-libintl-prefix \
                        --without-python \
                        --without-gtkextra \
                        --with-gtk2


post-destroot {         xinstall -d ${destroot}${prefix}/share/doc/${name}
                        xinstall -m 644 -v -W ${worksrcpath} \
                                AUTHORS ChangeLog README TODO \
                                ${destroot}${prefix}/share/doc/${name}
                        system "rm -rf ${destroot}${prefix}/share/${name}/sounds"
                        }

variant gdbm {          depends_lib-append      lib:libgdbm:gdbm
                        configure.args-append   --with-gdbm
                        }

variant guile {         depends_lib-append      bin:guile:guile
                        configure.args-append   --with-guile
                        }

variant python {        depends_lib-append      bin:python:python24
                        configure.args-delete   --without-python
                        configure.args-append   --with-python
                        }

