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

pkgname=wget
pkgver=1.25.0
pkgrel=2
pkgdesc="A network utility to retrieve files from the Web"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/wget/"
msys2_references=(
  "anitya: 5124"
  "cpe: cpe:2.3:a:gnu:wget"
  "cpe: cpe:2.3:a:wget:wget"
)
license=('GPL3')
depends=('gcc-libs' 'libiconv' 'libidn2' 'libintl' 'libpcre2_8' 'libpsl' 'libuuid' 'libgnutls' 'zlib')
makedepends=('autoconf-archive' 'gettext-devel' 'libidn2-devel' 'libuuid-devel'
             'libpsl-devel' 'libgnutls-devel' 'pcre2-devel' 'zlib-devel' 'python' 'libunistring-devel' 'autotools' 'gcc')
checkdepends=('perl-HTTP-Daemon' 'perl-IO-Socket-SSL')
optdepends=('ca-certificates: HTTPS downloads')
backup=('etc/wgetrc')
source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.lz{,.sig})
sha256sums=('19225cc756b0a088fc81148dc6a40a0c8f329af7fd8483f1c7b2fe50f4e08a1f'
            'SKIP')
validpgpkeys=('7845120B07CBD8D6ECE5FF2B2A1743EDA91A35B6') # Tim Rühsen <tim.ruehsen@gmx.de>

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

  autoreconf -fiv
  cat >> doc/sample.wgetrc <<EOF

# default root certs location
ca_certificate=/usr/ssl/certs/ca-bundle.crt
EOF
}

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

  ./configure --build=${CHOST} \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-ssl=gnutls \
    --with-libpsl \
    --without-libiconv-prefix \
    --without-libintl-prefix \
    --without-libpth-prefix \
    --without-libgnutls-prefix \
    --without-metalink \
	gl_cv_clean_version_stddef=yes

  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  #make check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
