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

pkgname='elinks'
pkgver=0.20.0
pkgrel=1
pkgdesc='Full-Featured Text WWW Browser (net-utils)'
arch=('i686' 'x86_64')
url='https://github.com/rkd77/elinks'
msys2_repository_url='https://github.com/rkd77/elinks'
msys2_references=(
  'anitya: 672'
  'archlinux: elinks'
  'cpe: cpe:/a:elinks:elinks'
  'gentoo: www-client/elinks'
)
license=('spdx:GPL-2.0-or-later')
groups=('net-utils')
depends=(
  'libbz2'
  'libexpat'
  'libgcrypt'
  'libgnutls'
  'libiconv'
  'libidn'
  'libintl'
  'liblzma'
  'libtre'
  'libzstd'
  'perl'
  'python3'
  'zlib'
)
makedepends=(
  'autotools'
  'doxygen'
  'gcc'
  'gettext-devel'
  'groff'
  'libbz2-devel'
  'libexpat-devel'
  'libgcrypt-devel'
  'libgnutls-devel'
  'libiconv-devel'
  'libidn-devel'
  'liblzma-devel'
  'libtre-devel'
  'libzstd-devel'
  'perl-devel'
  'python-devel'
  'python-setuptools'
  'xmlto'
  'zlib-devel'
)
provides=('elinks-git')
conflicts=('elinks-git')
replaces=('elinks-git')
source=("${pkgname}-${pkgver}.tgz::https://github.com/rkd77/elinks/archive/v${pkgver}.tar.gz")
sha256sums=('7067925d13297ee91dfaf5aa2e0295a3049d0d8ee5da899a7baf1f5150a6d8d4')

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"
}
