# Maintainer: Renato Silva <br.renatosilva@gmail.com>

_realname='purple-skypeweb'
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.1
pkgrel=1
pkgdesc='Skype plugin for libpurple (mingw-w64)'
url='https://github.com/EionRobb/skype4pidgin/tree/master/skypeweb'
license=(GPL3+)
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')

options=(!libtool strip staticlibs)
source=(skype4pidgin-${pkgver}.tar.gz::"https://github.com/EionRobb/skype4pidgin/archive/${pkgver}.tar.gz"
        Makefile)
sha256sums=('e1c3c07fa2ed82500b8a14045bd5d59e893002dbbeb66ade7ad6dc042be39700'
            '660ed7291f336f2fd80a9f3599630b4e700346f8067cc23fab5c0837edf5cf7a')
depends=(${MINGW_PACKAGE_PREFIX}-libpurple
         ${MINGW_PACKAGE_PREFIX}-json-glib
         ${MINGW_PACKAGE_PREFIX}-glib2
         ${MINGW_PACKAGE_PREFIX}-zlib
         ${MINGW_PACKAGE_PREFIX}-gettext
         ${MINGW_PACKAGE_PREFIX}-gcc-libs)
makedepends=(${MINGW_PACKAGE_PREFIX}-gcc
             ${MINGW_PACKAGE_PREFIX}-pkg-config
             rsync)

prepare() {
    cd "${srcdir}"
    mv Makefile "skype4pidgin-${pkgver}/skypeweb"
}

build() {
    msg2 'Synchronizing build directory'
    rsync --recursive --times "${srcdir}/skype4pidgin-${pkgver}/skypeweb"/* "${srcdir}/${_realname}-${pkgver}.build.${CARCH}"
    cd "${srcdir}/${_realname}-${pkgver}.build.${CARCH}"
    make
}

package() {
    cd "${srcdir}/${_realname}-${pkgver}.build.${CARCH}"
    make DESTDIR="${pkgdir}" install
    install -Dm644 "${srcdir}/skype4pidgin-${pkgver}/skypeweb/gpl3.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/gpl3.txt"
}
