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

_realname=elementary-icon-theme
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=7.0.0
pkgrel=1
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
pkgdesc="Named, vector icons for elementary OS (mingw-w64)"
depends=( "${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme")
makedepends=("${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-librsvg"
             "git")
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 "${_realname}-${pkgver}"

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

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

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

  ${MINGW_PREFIX}/bin/meson.exe compile
}

package() {
  cd "$srcdir/build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/meson.exe install --destdir="${pkgdir}"

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