# Copyright 2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2

SUMMARY="Steam protocol plugin for pidgin"
HOMEPAGE="https://github.com/eionrobb/pidgin-opensteamworks"
DOWNLOADS="https://github.com/EionRobb/${PN}/archive/${PV}.tar.gz -> ${PNV}.tar.gz"

LICENCES="GPL-3"
SLOT="0"
PLATFORMS="~amd64 ~x86"

DEPENDENCIES="
    build:
        virtual/pkg-config
        virtual/unzip
    run:
        core/json-glib
        dev-libs/glib:2
        dev-libs/nss
        gnome-desktop/libgnome-keyring
        net-im/pidgin
"

WORK=${WORKBASE}

src_prepare() {
    # see https://code.google.com/p/pidgin-opensteamworks/issues/detail?id=31
    edo cp "${FILES}"/${PN}-1.3-Makefile "${WORK}"/${PNV}/steam-mobile/Makefile
    edo unzip "${WORK}"/${PNV}/steam-mobile/releases/icons.zip
}

src_compile() {
    export CC=${CC} PKG_CONFIG=${PKG_CONFIG}
    edo pushd ${PNV}/steam-mobile
    default
    edo popd
}

src_install() {
    edo pushd ${PNV}/steam-mobile
    default
    edo popd
    insinto /usr/share/pixmaps/pidgin/protocols
    doins -r "${WORK}"/{16,48}
    dodoc ${PNV}/README.md
}