# $Id$
# Maintainer: Eric BĂ©langer <eric@archlinux.org>

pkgname=tk
pkgver=8.6.3
pkgrel=1
pkgdesc="A windowing toolkit for use with tcl"
arch=('i686' 'x86_64')
url="http://tcl.sourceforge.net/"
license=('custom')
depends=("tcl=${pkgver}" 'libxss' 'libxft')
options=('staticlibs')
source=(http://downloads.sourceforge.net/sourceforge/tcl/tk${pkgver}-src.tar.gz)
sha1sums=('244ddc0f64cc3d429c9d86135d0bbe2cf06c9360')

build() {
  cd tk${pkgver}/unix
  [[ $CARCH == "x86_64" ]] && BIT="--enable-64bit"
  ./configure --prefix=/usr --mandir=/usr/share/man --enable-threads --disable-rpath $BIT
  make
}

check() {
  cd tk${pkgver}/unix
#  make test
}

package() {
  cd tk${pkgver}/unix
  make INSTALL_ROOT="${pkgdir}" install install-private-headers
  ln -sf wish${pkgver%.*} "${pkgdir}/usr/bin/wish"
  ln -sf libtk${pkgver%.*}.so "${pkgdir}/usr/lib/libtk.so"
  install -Dm644 license.terms "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # remove buildroot traces
  sed -e "s#${srcdir}/tk${pkgver}/unix#/usr/lib#" \
      -e "s#${srcdir}/tk${pkgver}#/usr/include#" \
      -i "${pkgdir}/usr/lib/tkConfig.sh"
}