NAME="links"
DESC="Text and graphics mode WWW browser"
VERSION="2.29"

FILES=("http://links.twibright.com/download/links-${VERSION}.tar.bz2")
HASHES=("f60b87ffee090c5d6820951eba710572")

DEPENDS=(
  "brotli" "bzip2" "gpm"
  "libevent" "zstd" "openssl"
  "xz" "libpng" "librsvg"
  "libtiff" "libx11"
)
BUILD=("libxt")

PACKAGE() {
  tar xf "${NAME}-${VERSION}.tar.bz2"
  cd "${NAME}-${VERSION}"

  sed -i '/AC_PROG_CC/a AC_PROG_CXX/' configure.in
  autoreconf -fi
  ./configure --prefix=/usr           \
              --enable-graphics       \
              --mandir=/usr/share/man \
              --disable-javascript    \
              --with-x --with-fb

  make
  make DESTDIR="${ROOTDIR}" install

  install -v -d -m755 "${ROOTDIR}/usr/share/doc/links-${VERSION}"
  install -v -m644 doc/links_cal/* KEYS BRAILLE_HOWTO \
    "${ROOTDIR}/usr/share/doc/links-${VERSION}"

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