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

name                mlterm
version             3.9.3
revision            2
checksums           rmd160  baa6d8db248019df2da5d846797151322c517629 \
                    sha256  b5b76721391de134bd64afb7de6b4256805cf2fc883a2bf2e5d29602ac1b50d9 \
                    size    4272090

categories          x11
maintainers         nomaintainer
license             BSD

description         Multi-lingual X11 terminal emulator

long_description    ${name} is a multi-lingual terminal emulator written \
                    from scratch, which supports various character sets \
                    and encodings in the world and complex characters, \
                    such as double width for East Asian, combining for Thai, \
                    Vietnamese, and so on, and bi-direction for Arabic \
                    and Hebrew. Indic scripts in ISCII encoding are \
                    experimentally supported using libind library. It also \
                    supports various unique feature such as anti-alias using \
                    FreeType, multiple XIM, multiple windows, scrollbar API, \
                    scroll by mouse wheel, automatic selection of encoding, \
                    daemon mode, and so on.

homepage            https://mlterm.sourceforge.net
master_sites        sourceforge:project/mlterm/01release/mlterm-${version}

patch.pre_args-replace \
                    -p0 -p1

# Upstream patch:
# https://github.com/arakiken/mlterm/issues/20
patchfiles-append   patch-clipboard.diff

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

depends_lib-append  port:fontconfig \
                    port:freetype \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:gettext-runtime \
                    path:lib/pkgconfig/harfbuzz.pc:harfbuzz \
                    port:libsixel \
                    port:libssh2 \
                    port:Xft2 \
                    port:xorg-libsm \
                    port:xorg-libX11

configure.args-append \
                    --disable-fribidi \
                    --enable-compact-truecolor \
                    --enable-fontconfig \
                    --enable-image \
                    --enable-otl \
                    --enable-ssh2 \
                    --with-gui=xlib \
                    --with-imagelib=gdk-pixbuf \
                    --with-type-engines=xft

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    file copy {*}[glob ${worksrcpath}/doc/*] \
        ${destroot}${prefix}/share/doc/${name}
}

variant bidi description {Enable bidirectional support} {
    depends_lib-append      port:fribidi
    configure.args-replace  --disable-fribidi --enable-fribidi
}

variant gtk2 conflicts gtk3 description {Build with GTK2} {
    depends_lib-append      path:lib/pkgconfig/gtk+-2.0.pc:gtk2
    configure.args-append   --with-gtk=2.0
}

variant gtk3 conflicts gtk2 description {Build with GTK3} {
    depends_lib-append      path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                            port:vte
    configure.args-append   --with-gtk=3.0
}

# This may not work well with older systems.
variant sdl2 description {Use SDL2 GUI} {
    depends_lib-append      port:libsdl2
    configure.args-replace  --with-gui=xlib --with-gui=sdl2
}

# Upstream default is gtk3
if {![variant_isset gtk2] && ![variant_isset gtk3]} {
    default_variants        +gtk3
}

livecheck.regex     /${name}-(\[0-9.\]+)${extract.suffix}
