NAME="xterm"
DESC="Terminal emulator for the X Window System"
VERSION="384"
FILES=("https://invisible-mirror.net/archives/xterm/xterm-$VERSION.tgz")
HASHES=("27a701e73076e42a265e34f8fe558ff6")
DEPENDS=(
  "libxaw" "libxft"
  "libxkbfile" "luit" "ncurses" "xbitmaps"
)

PACKAGE() {
  tar xf $NAME-$VERSION.tgz
  cd $NAME-$VERSION

  sed -i '/v0/{n;s/new:/new:kb=^?:/}' termcap
  printf '\tkbs=\\177,\n' >> terminfo

  TERMINFO=/usr/share/terminfo \
  ./configure $XORG_CONFIG     \
    --with-app-defaults=/etc/X11/app-defaults
  
  make && make DESTDIR=${ROOTDIR} install
  make DESTDIR=${ROOTDIR} install-ti

  mkdir -pv ${ROOTDIR}/usr/share/applications
  cp -v *.desktop ${ROOTDIR}/usr/share/applications/

  cd .. && rm -rf $NAME-$VERSION
}
