# $Id: PKGBUILD 73840 2010-03-28 22:17:41Z kevin $
# Maintainer: kevin <kevin@archlinux.org>

pkgname=expect
pkgver=5.44.1.15
pkgrel=1
pkgdesc="A tool for automating interactive applications"
arch=(i686 x86_64)
url="http://expect.nist.gov/"
depends=('tcl>=8.5.3')
makedepends=('tk>=8.5.3')
source=(http://downloads.sourceforge.net/project/expect/Expect/${pkgver}/expect-${pkgver}.tar.bz2)
# CVS checkout on gerolde.
#source=(ftp://ftp.archlinux.org/other/expect/expect-${pkgver}.tar.bz2)
# old nist source=(http://expect.nist.gov/src/expect-${pkgver}.tar.bz2)
license=('custom')
md5sums=('9307bbf67e19125036ce34544a78dadf')

build() {
  # stuff to remove.
  BIN="expectk multixterm tknewsbiff tkpasswd xkibitz xpstat"
  MAN="multixterm tknewsbiff xkibitz"

  cd ${srcdir}/expect-${pkgver}

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
      --mandir=/usr/share/man --with-tcl=/usr/lib \
      --with-tclinclude=/usr/include --with-tk=/usr/lib \
      --with-tkinclude=/usr/include \

  # Keep $startdir/pkg out of library search paths.
  sed -e 's/-rpath,${LIB_RUNTIME_DIR}:/-rpath,/' -i Makefile
  make || return 1
}
package() {
  cd ${srcdir}/expect-${pkgver}
  make DESTDIR=${pkgdir} install || return 1

  # license.
  install -D -m644 README ${pkgdir}/usr/share/licenses/${pkgname}/README

  (cd ${pkgdir}/usr/lib;
   ln -s expect${pkgver}/libexpect${pkgver}.so libexpect.so)

  # Remove X related stuff.
  for i in ${BIN}; do
      rm -f ${pkgdir}/usr/bin/${i}
  done
  for i in ${MAN}; do
      rm -f ${pkgdir}/usr/share/man/man1/${i}.1
  done
}