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

_realname=dbus-glib
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.114
pkgrel=4
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
pkgdesc="D-Bus Message Bus System (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-glib2" "${MINGW_PACKAGE_PREFIX}-dbus" "${MINGW_PACKAGE_PREFIX}-expat")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-gtk-doc")
license=("spdx:AFL-2.1 OR GPL-2.0-or-later")
url="https://www.freedesktop.org/wiki/Software/dbus"
msys2_repository_url='https://gitlab.freedesktop.org/dbus/dbus-glib'
msys2_references=(
  "cpe: cpe:/a:freedesktop:dbus-glib"
)
source=("https://dbus.freedesktop.org/releases/${_realname}/${_realname}-${pkgver}.tar.gz"{,.asc})
sha256sums=('c09c5c085b2a0e391b8ee7d783a1d63fe444e96717cc1814d61b5e8fc2827a7c'
            'SKIP')
validpgpkeys=('DA98F25C0871C49A59EAFF2C4DE8FF2A63C7CC90') # Simon McVittie <smcv@pseudorandom.co.uk>

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  autoreconf -fi
}

build() {
  rm -rf build-${MSYSTEM}
  mkdir -p build-${MSYSTEM}
  cd build-${MSYSTEM}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make
}

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