PortSystem      1.0

name            elvis
version         2.2_0
revision        4
license         Artistic-1
homepage        http://elvis.the-little-red-haired-girl.org/
description     A vi/ex clone
categories      editors
maintainers     gmail.com:crosma
platforms       darwin
master_sites    ftp://ftp.cs.pdx.edu/pub/elvis/ \
                  ftp://ftp.false.com/pub/elvis/ \
                  ftp://the.wiretapped.net/pub/elvis/ \
                  http://www.fh-wedel.de/pub/elvis/

checksums       md5 6831b8df3e4a530395e66c2889783752

variant universal {}

configure.cc    "${configure.cc} ${configure.optflags} [get_canonical_archflags cc]"

configure.args  --without-x --verbose

patchfiles      patch-src-ref.c.diff \
                configure.diff

post-patch {
    reinplace "s|@@SDKROOT@@|${configure.sdkroot}|" ${worksrcpath}/configure
}

# The x11 variant is seriously borked and needs patching to compile
#variant         x11 {  depends_lib port:xorg-libX11 port:xorg-libOTHERS???
#                       configure.args-delete --without-x
#                       configure.args-append --with-x
#
#    configure.args-append --x-includes=${prefix}/include --x-libraries=${prefix}/lib
#
#    build.args-append CC="gcc -I${prefix}/include `${prefix}/bin/freetype-config --cflags`"
#}
pre-destroot {
               reinplace "s|${prefix}|${destroot}${prefix}|g" ${worksrcpath}/Makefile
               reinplace "s|sh instman.sh|MANPATH=${destroot}${prefix}/share/man sh instman.sh|" ${worksrcpath}/Makefile
               reinplace "s|MAN/manl MAN/man1|MAN/man1|" ${worksrcpath}/instman.sh
             }
post-configure { reinplace "s|/etc|${prefix}/etc|g" ${worksrcpath}/Makefile
}
long_description   \
Elvis is a very powerful vi/ex clone providing \
a remarkable number of bells and whistles like, Syntax Highlighting, \
Multiple files in multiple windows, Networking support (http and ftp).

