# -*- 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               active_variants 1.1

name                    gnubg
version                 1.08.003
revision                0
categories              games
license                 GPL-3
maintainers             nomaintainer
homepage                https://www.gnu.org/software/gnubg/
description             GNU Backgammon

long_description        GNU Backgammon (gnubg) is an application for playing and analysing \
                        backgammon games, positions, 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 GNU Backgammon using the \
                        command line or with a graphical interface using GTK.

master_sites            gnu
                        
distfiles               ${name}-release-${version}-sources.tar.gz
                        
checksums               ${name}-release-${version}-sources.tar.gz \
                        rmd160  89c51870ae21c84fe2ebc635ea2c53f05d88c520 \
                        sha256  6f7d969b13cfff786fba90ff8cc5e5d564b97f4f0aa69afe4f3838f18c445979

depends_build-append    port:pkgconfig \
                        port:bison \
                        port:flex

depends_lib-append      path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                        port:sqlite3 \
                        port:gmp \
                        port:libiconv \
                        port:freetype \
                        port:python314 \
                        port:readline

use_autoreconf          yes

configure.args          --mandir=${prefix}/share/man \
                        --infodir=${prefix}/share/info \
                        --sysconfdir=${prefix}/etc \
                        --libdir=${prefix}/lib \
                        --with-python=${prefix}/bin/python3.14 \
                        --without-board3d \
                        --with-gtk3 \
                        --without-libcurl

notes \
"Recommended ports:
    py-mysql    provides the MySQL backend of a game database
    py-psycopg  provides the PostgreSQL backend of a game database"

#
# the following variants indicate the binary dependencies
# based on the backend of gtk2
#

variant random_org description "enable random.org support" {
    depends_lib-append  port:curl
    configure.args-replace --without-libcurl --with-libcurl=${prefix}
}

default_variants +random_org

variant x11 conflicts quartz {
    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 x11
}
variant quartz conflicts x11 {
    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 quartz
}

if {![variant_isset quartz]} {
    default_variants +x11
}

variant board3d conflicts quartz description "enable OpenGL board" {
    depends_lib-append      port:gtkglext
    ## disable 3D board on the quartz variants
    ## because of the display issue
    ## see also https://mail.gnome.org/archives/gtkglext-list/2009-December/msg00023.html
    require_active_variants port:gtkglext {} quartz
  
    configure.args-replace  --without-board3d --with-board3d
  
    ## gtkglext+x11 links to libgl that is provided by macports.
    ## Therefore, it should include macports' opengl headers
    ## instead of the ones provided by OSX
    configure.cflags-append -I${prefix}/include/GL
}

livecheck.type      gnu
livecheck.regex     ${name}-release-(\[0-9.\]+)-sources${extract.suffix}
