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

name                genius
version             1.0.27
revision            1
license             GPL-3+
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          gnome math
maintainers         nomaintainer

description         Genius is a calculator program.

long_description    Genius is a calculator program similiar in some aspects \
                    to BC, Matlab or Maple. GEL is the name of its extention \
                    language (stands for \"Genius Extension Language\", \
                    clever huh?), in fact, a large part of the standard \
                    genius functions are written in GEL itself.

homepage            https://www.jirka.org/genius.html
master_sites        gnome:sources/${name}/${branch}/
use_xz              yes

checksums           rmd160  534765bfee0933d8998a847f4e07dedda12eb2f9 \
                    sha256  0243b7c36b5f9e930c62778acd52deb188deeca704a5e195337018435d9e7bb5 \
                    size    2918348

depends_build       port:gettext \
                    port:intltool \
                    path:bin/pkg-config:pkgconfig

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:mpfr \
                    port:ncurses \
                    port:readline

depends_run         port:desktop-file-utils \
                    port:shared-mime-info

patchfiles-append   dynamic_lookup-11.patch

configure.env-append \
                    GTK_UPDATE_ICON_CACHE=${prefix}/bin/gtk-update-icon-cache-3.0

# disable extra gcc optimization for clang compatibility

configure.args      --disable-extra-gcc-optimization \
                    --enable-compile-warnings=minimum \
                    --disable-gnome \
                    --disable-gtksourceview \
                    --disable-update-mimedb

variant gnome description {Compile with the GNOME frontend (GUI, plotting} {
    depends_lib-append \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:gtksourceview4 \
                    port:vte

    configure.args-append \
                    --enable-gnome \
                    --enable-gtksourceview
    
    configure.args-delete \
                    --disable-gnome \
                    --disable-gtksourceview
}

default_variants +gnome

post-activate {
    system "${prefix}/bin/update-mime-database ${prefix}/share/mime"
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
}

livecheck.type      gnome
