# $Id: Portfile 106492 2013-05-28 05:57:43Z jeremyhu@macports.org $

PortSystem          1.0

name                xterm
version             293
categories          x11
license             X11
platforms           darwin
maintainers         jeremyhu openmaintainer
description         the ubiquitous X terminal emulator, stand-alone
long_description    The xterm program is a terminal emulator for the X \
                    Window System. It supports a plethora of features, \
                    including colors, Unicode, etc.

homepage            http://invisible-island.net/xterm/
master_sites        ftp://invisible-island.net/xterm/ \
                    http://invisible-island.net/datafiles/release/
checksums           sha1    99a7e7b6d3cf7f576faa81aade80e691a56c7859 \
                    rmd160  5861505639d378f6c3c74fc3ad133f2d6496b4d4 \
                    sha256  64e9c41137eac4277d0cfe04312b12dc5d11224f49fc999ff7f6b9597bf55b7b
extract.suffix      .tgz

depends_build \
	port:xorg-xproto

depends_run \
	bin:luit:luit

depends_lib \
	port:ncurses \
	port:expat \
	port:zlib \
	port:xorg-libXaw \
	port:Xft2

patchfiles PR-7191532.patch  xterm-nohide-pointer.patch

patch.pre_args -p1

configure.args      --mandir=${prefix}/share/man --enable-luit \
                    --enable-logging --enable-wide-chars \
                    --enable-256-color --enable-load-vt-fonts \
                    --x-include=${prefix}/include --x-lib=${prefix}/lib \
                    --with-app-defaults=${prefix}/share/X11/app-defaults

# If -ltermcap stays in the LDFLAGS, xterm is linked against both
# /usr/lib's and ${prefix}/lib's libncurses.
post-configure {
    reinplace "s|-ltermcap|-lncurses|" ${worksrcpath}/Makefile
}

livecheck.type      regex
livecheck.url       http://www.invisible-island.net/xterm/xterm.log.html
livecheck.regex     "Patch #(\\d+)"

variant utmp description {Support updating utmp/utmpx database
                          (installs setgid daemon)} {
   configure.args-append   --with-utmp-setgid=daemon --with-utempter
}

platform darwin 8 {
    configure.args-append cf_cv_xopen_source=no cf_cv_posix_c_source=no
}
