# -*- 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                xfig
version             3.2.9
revision            0
categories          graphics x11
license             Permissive
maintainers         nomaintainer

description         Facility for Interactive Generation of figures under X11
long_description    \
    Xfig is a menu-driven tool that allows the user to draw and \
    manipulate objects interactively in an X window.  The \
    resulting pictures can be saved, printed on PostScript \
    printers or converted to a variety of other formats (e.g. to \
    allow inclusion in LaTeX documents).

homepage            https://mcj.sourceforge.net
platforms           darwin
master_sites        sourceforge:project/mcj
use_xz              yes

checksums           rmd160  e31e95f5d4da6c4e03d01f4df3d7f3371155f7a0 \
                    sha256  13ed9d04d1bbc2dec09da7ef49ceec278382d290f6cd926474c2f2d016fec2f7 \
                    size    5368544

depends_lib         port:ghostscript \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libpng \
                    port:Xaw3d \
                    port:Xft2 \
                    port:xorg-libXaw \
                    port:zlib

depends_build       port:gsed

depends_run         port:fig2dev

configure.cppflags-append   -I${prefix}/include/freetype2

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        CHANGES \
        doc/TODO \
        {*}[glob ${worksrcpath}/doc/FORMAT*] \
        FIGAPPS \
        README \
        ${docdir}
}

# https://trac.macports.org/ticket/25935
if {[string match "*gcc-4.2" ${configure.compiler}]} {
    # Fix font selection bug when w_fontpanel.o is compiled with optimization by gcc 4.2
    pre-build {
        system -W ${worksrcpath}/src "${build.cmd} CDEBUGFLAGS=-O0 w_fontpanel.o"
    }
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       https://sourceforge.net/projects/mcj/rss
livecheck.regex     ${name}-(\[0-9.a-z\]+)${extract.suffix}
