# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Maintainer: Zach Bacon <11doctorwhocanada@gmail.com>

_realname=libnotify
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.7.8
pkgrel=3
pkgdesc="Desktop notification library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://developer.gnome.org/notification-spec/"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2"
         "${MINGW_PACKAGE_PREFIX}-glib2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-gtk3"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-pkg-config" )
source=("https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz"
        "test-fix.patch"
        "fix-gtk-doc.patch")
sha256sums=('69209e0b663776a00c7b6c0e560302a8dbf66b2551d55616304f240bba66e18c'
            '185e7885512106172627525a4ec1fc18c2f95844f733e49cece325874a55f8e6'
            '690f8bd32e6aa4828bc93d2d9a8cba4870c96fa7af248a64f8ab505d8389af4d')

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

  patch -p1 -i ${srcdir}/test-fix.patch
  patch -p1 -i ${srcdir}/fix-gtk-doc.patch
}

build() {
  cd "${srcdir}"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype=plain \
    -Dintrospection=enabled \
    -Ddocbook_docs=disabled \
    -Dgtk_doc=true \
    "../${_realname}-${pkgver}"

  ninja
}

package() {
  cd "${srcdir}"/build-${CARCH}

  DESTDIR="${pkgdir}" ninja install
}
