# Maintainer: Alberto Fanjul Alonso <albfan@gnome.org>

_realname=elementary-icon-theme
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=5.3.1
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64')
pkgdesc="git repository viewer for GTK+/GNOME (mingw-w64)"
depends=( "${MINGW_PACKAGE_PREFIX}-gtk3")
makedepends=("${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config")
options=('strip')
license=("GPL3")
url="https://github.com/elementary/icons"
source=(${_realname}-${pkgver}::git+https://github.com/elementary/icons.git#tag=${pkgver}
        0001-Avoid-xcursorgen.patch
        0002-hard-copy-symlinks.patch)
sha256sums=('SKIP'
            '7101b6f33273384f5ce5fe6623664cb3d530ba37709a62883db3f3b46ad1c98d'
            'bac6ad27502d729e8c8684af888f326f2ab04ba6863360938c7baf392eb76448')

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

  patch -N -p1 -i $srcdir/0001-Avoid-xcursorgen.patch
  patch -N -p1 -i $srcdir/0002-hard-copy-symlinks.patch
}

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dvolume_icons=false \
    ../${_realname}-${pkgver}

  ninja
}

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

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
