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

# strndup
legacysupport.newest_darwin_requires_legacy 10

name                xfig
version             3.2.9a
revision            0
categories          graphics x11
license             Permissive
maintainers         {me.com:remko.scharroo @remkos} \
                    openmaintainer

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
master_sites        sourceforge:project/mcj
use_xz              yes

checksums           rmd160  b01373b2c37ef54e3894033112227f0be7b9dd8f \
                    sha256  bc572a1881e5e20987ac590158b041ab7803845a9691036d3ba5e982f66d9ca3 \
                    size    5366180

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

# Intrinsic.h:140: error: redefinition of typedef ‘Pixel’
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

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}
