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

_realname=iso-codes
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.5.0
pkgrel=1
pkgdesc="Lists of the country, language, and currency names (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('LGPL')
makedepends=("git")
url="https://salsa.debian.org/iso-codes-team/iso-codes"
_commit=a36019e5014bff251f83d522ddcfebaecf52afd3    # tags/iso-codes-4.5^0
source=("git+https://salsa.debian.org/iso-codes-team/iso-codes/#commit=${_commit}")
sha256sums=('SKIP')
validpgpkeys=('D1CB8F39BC5DED24C5D2C78C1302F1F036EBEB19' #Dr. Tobias Quathamer <t.quathamer@mailbox.org>
              '1302F1F036EBEB19' #Dr. Tobias Quathamer <t.quathamer@mailbox.org>
              'F972A168A2703B34CC23E09FD4E5EDACC0143D2D') # Christian Perrier <christian.perrier@onera.fr>

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

build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make DESTDIR="${pkgdir}" pkgconfigdir=${MINGW_PREFIX}/lib/pkgconfig install
}
