# Maintainer: Alexey Pavlov <Alexpux@gmail.com>

pkgname=elinks
pkgver=0.18.0
pkgrel=2
epoch=
pkgdesc="Full-Featured Text WWW Browser (net-utils)"
arch=("i686" "x86_64")
url="https://github.com/rkd77/elinks"
msys2_references=(
  "cpe: cpe:/a:elinks:elinks"
)
license=('GPL')
groups=('net-utils')
depends=('libbz2'
         'libexpat'
         'libgcrypt'
         'libgnutls'
         'libiconv'
         'libidn'
         'liblzma'
         'libtre'
         'libzstd'
         'libintl'
         'perl'
         'python3'
         'zlib')
makedepends=('autotools'
             'gettext-devel'
             'libbz2-devel'
             'libexpat-devel'
             'libgcrypt-devel'
             'libgnutls-devel'
             'libiconv-devel'
             'libidn-devel'
             'liblzma-devel'
             'libtre-devel'
             'libzstd-devel'
             'perl-devel'
             'python-devel'
             'python-setuptools'
             'zlib-devel'
             'xmlto'
             'groff'
             'doxygen'
             'gcc')
provides=("elinks-git")
conflicts=("elinks-git")
replaces=("elinks-git")
source=("elinks-${pkgver}.tgz::https://github.com/rkd77/elinks/archive/v${pkgver}.tar.gz")
sha256sums=('b4200c17dfe5574daddeceda69a42ef8f2459fc43e92cac73dcf30c3343c95a5')

prepare() {
  cd "${pkgname}-${pkgver}"

  ./autogen.sh
}

build() {
  cd "${pkgname}-${pkgver}"

  export MSYSTEM=CYGWIN
  export PYTHON=/usr/bin/python3

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --build=${CHOST} \
    --without-openssl \
    --with-lzma \
    --without-guile \
    --with-perl \
    --with-python \
    --without-lua

  make
}

check() {
  cd "${pkgname}-${pkgver}"

  make -k check
}

package() {
  cd "${pkgname}-${pkgver}"

  make DESTDIR="$pkgdir/" install
  rm -f $pkgdir/usr/share/locale/locale.alias
  rm -f $pkgdir/usr/lib/charset.alias
}
