NAME="zsh"
DESC="Z shell"
VERSION="5.9"
FILES=(
  "https://www.zsh.org/pub/zsh-$VERSION.tar.xz"
  "https://www.zsh.org/pub/zsh-$VERSION-doc.tar.xz"
)
HASHES=(
  "182e37ca3fe3fa6a44f69ad462c5c30e"
  "8db53446f613521fb4f9b0bd9f6adda1"
)
DEPENDS=()

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

  tar --strip-components=1 -xvf ../zsh-$VERSION-doc.tar.xz
  ./configure --prefix=/usr            \
            --sysconfdir=/etc/zsh    \
            --enable-etcdir=/etc/zsh \
            --enable-cap             \
            --enable-gdbm                             
  
  make
  makeinfo Doc/zsh.texi --plaintext -o Doc/zsh.txt 
  makeinfo Doc/zsh.texi --html      -o Doc/html
  makeinfo Doc/zsh.texi --html --no-split --no-headers -o Doc/zsh.html

  make DESTDIR=${ROOTDIR} install
  make DESTDIR=${ROOTDIR} infodir=/usr/share/info install.info

  install -v -m755 -d                 ${ROOTDIR}/usr/share/doc/zsh-$VERSION/html
  install -v -m644 Doc/html/*         ${ROOTDIR}/usr/share/doc/zsh-$VERSION/html
  install -v -m644 Doc/zsh.{html,txt} ${ROOTDIR}/usr/share/doc/zsh-$VERSION

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

INSTALL(){
  echo /bin/zsh >> /etc/shells
}
