# vim: syn=sh ft=sh et sw=2 sts=2 ts=2 tw=0:
#Packager: Cyrille Pontvieux <jrd~at~salixos~dot~org>

pkgname=python-gnomekeyring
pkgver=2.32.0
pkgrel=1cp

source=(http://ftp.gnome.org/pub/gnome/sources/gnome-python-desktop/$(echo $pkgver|cut -d. -f1-2)/gnome-python-desktop-${pkgver}.tar.bz2)
sourcetemplate=http://people.salixos.org/jrd/salix/$pkgname/$pkgver-\$arch-$pkgrel/
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url=https://git.gnome.org/browse/gnome-python-desktop/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (python binding for gnome keyring)"
"Python bindings for libgnome-keyring"
)

build() {
  cd $SRC/gnome-python-desktop-$pkgver/gnomekeyring || return 1
  touch config.h
  pygtk-codegen-2.0 \
    --load-types gnomekeyring-argtypes.py \
    --py_ssize_t-clean \
    --register /usr/share/pygtk/2.0/defs/gtk-types.defs \
    --register /usr/share/pygtk/2.0/defs/gdk-types.defs \
    --override gnomekeyring.override \
    --prefix pygnomekeyring \
    gnomekeyring.defs > gnomekeyring.c || return 1
  gcc \
    $(pkg-config --cflags --libs gnome-keyring-1) \
    $(pkg-config --cflags --libs python) \
    $(pkg-config --cflags --libs pygobject-2.0) \
    -fPIC \
    -c gnomekeyring.c gnomekeyringmodule.c || return 1
  gcc \
    $(pkg-config --cflags --libs gnome-keyring-1) \
    $(pkg-config --cflags --libs python) \
    $(pkg-config --cflags --libs pygobject-2.0) \
    -shared \
    -o gnomekeyring.so \
    *.o || return 1
  python_site=$(python -c 'import site; print(site.getsitepackages()[0])')
  mkdir -p $PKG$python_site/gtk-2.0 $PKG/usr/share/pygtk/2.0/defs
  cp gnomekeyring.so $PKG$python_site/gtk-2.0/
  cp gnomekeyring.defs $PKG/usr/share/pygtk/2.0/defs/
}