description="Set of libraries that offers command-line editing and history capabilities"
url="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"

packager="Grat-OS Team"
maintainer="Grat-OS Team"

name=readline
version=8.3
release=1

source=(http://ftp.gnu.org/gnu/readline/readline-$version.tar.gz)

PKGMK_GROUPS=(devel man doc)

build() {
  cd readline-$version

  sed -i '/MV.*old/d' Makefile.in
  sed -i '/{OLDSUFF}/c:' support/shlib-install

  ./configure --prefix=/usr \
              --docdir=/usr/share/doc/readline-$version

  if [ -L /bin/pwd ]; then
    make SHLIB_LIBS="-L/tools/lib -lncursesw"
    make DESTDIR=$PKG SHLIB_LIBS="-L/tools/lib -lncurses" install
  else
    make SHLIB_LIBS=-lncurses
    make DESTDIR=$PKG SHLIB_LIBS=-lncurses install
  fi

  chmod -v u+w $PKG/usr/lib/lib{readline,history}.so.*

  mkdir -p $PKG/usr/share/doc/readline-$version
  install -v -m644 doc/*.{ps,pdf,html,dvi} \
                   $PKG/usr/share/doc/readline-$version

}
