NAME="tk"
DESC="TCL GUI Toolkit"
VERSION="8.6.13"
FILES=("https://downloads.sourceforge.net/tcl/tk$VERSION-src.tar.gz")
HASHES=("95adc33d55a133ee29bc9f81efdf31b2")
DEPENDS=("xorg")

PACKAGE() {
  tar xf ${NAME}${VERSION}-src.tar.gz
  cd ${NAME}${VERSION}

  cd unix
  ./configure --prefix=/usr \
            --mandir=/usr/share/man \
            --enable-64bit
  make && sed -e "s@^\(TK_SRC_DIR='\).*@\1/usr/include'@" \
    -e "/TK_B/s@='\(-L\)\?.*unix@='\1/usr/lib@" \
    -i tkConfig.sh

  make DESTDIR="$ROOTDIR" install
  make DESTDIR="$ROOTDIR" install-private-headers
  ln -v -sf wish8.6 "$ROOTDIR/usr/bin/wish"
  chmod -v 755 "$ROOTDIR/usr/lib/libtk8.6.so"

  cd ../.. && rm -r ${NAME}${VERSION}
}
