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

_realname=iso-codes
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.19.0
pkgrel=1
pkgdesc="Lists of the country, language, and currency names (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
license=('spdx:LGPL-2.1-or-later')
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-python")
url="https://salsa.debian.org/iso-codes-team/iso-codes"
source=(https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/v${pkgver}/iso-codes-v${pkgver}.tar.gz)
sha256sums=('4b143a891feb7d1bb64e44fe3ef253ef36ba1185d1d129c1425338dc6e46e27d')

prepare() {
  cd ${_realname}-v${pkgver}
  autoreconf -fi
}

build() {
  mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM}

  ../${_realname}-v${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

  make
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}
  make DESTDIR="${pkgdir}" pkgconfigdir=${MINGW_PREFIX}/lib/pkgconfig install
  install -Dm644 "${srcdir}/${_realname}-v${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
