PortSystem          1.0

name                xmgr
version             4.1.2
revision            4
categories          math science
license             BSD
maintainers         nomaintainer
description         ACE/gr 2D plotting tool (Ancestor to Grace)
long_description    ACE/gr, also known as Xmgr, is a 2D plotting tool for the X Window System. \
                    While ACE/gr has a convenient point-and-click interface, most parameter\
                    settings and operations are available through a command line interface.\
                    NOTE: The development of ACE/gr is frozen, but is continued as Grace -- new users\
                    should try that instead. This port is for those who cannot come to terms with the\
                    updated UI in Grace.

homepage            http://plasma-gate.weizmann.ac.il/Xmgr/
patchfiles          patch-main.c patch-motifutils.c xmgr-string-h.diff \
                    configure.diff isfinite.diff
fetch.use_epsv      no
master_sites        ftp://plasma-gate.weizmann.ac.il/pub/xmgr4/src

checksums           rmd160  5f8b08b5e2cea0ca4e2c8b9d7d590f7bdb93a4ee \
                    sha256  92651881d4f0ce0e0ab71dea217ae2a0eab2e256bf454dba7cf5f564f89ef40a \
                    size    881991

depends_build       port:autoconf
depends_lib         port:motif

configure.args      --disable-f77 --disable-netcdf \
                    --enable-acegr-home=${prefix}/share/xmgr  \
                    --x-includes=${prefix}/include            \
                    --x-libraries=${prefix}/lib
configure.cflags-append -std=c99

variant netcdf description {Build with netcdf file support} {
  depends_lib-append       port:netcdf
  configure.args-delete    --disable-netcdf
}

# The aux scripts are too old to know that aarch64-darwin is a thing.
pre-configure {
    file copy -force ${prefix}/share/autoconf/build-aux/config.guess ${worksrcpath}/ac-tools/config.guess
    file copy -force ${prefix}/share/autoconf/build-aux/config.sub   ${worksrcpath}/ac-tools/config.sub
}

build.target
use_parallel_build  yes

destroot {
  # html-docs and grconvert must reside in acegr-home
  file copy ${worksrcpath}/src/xmgr ${destroot}${prefix}/bin/
  file mkdir ${destroot}${prefix}/share/xmgr/bin
  file copy ${worksrcpath}/grconvert/grconvert ${destroot}${prefix}/share/xmgr/bin/
  file delete ${worksrcpath}/doc/Makefile
  file copy ${worksrcpath}/doc ${destroot}${prefix}/share/xmgr/
  file delete ${worksrcpath}/examples/Makefile
  file copy ${worksrcpath}/examples ${destroot}${prefix}/share/xmgr/
}

livecheck.type none
