summaryrefslogtreecommitdiff
path: root/extra/pygobject2/PKGBUILD
blob: 31ec9761afe76359f36299dff065300caacea86c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# $Id: PKGBUILD 136848 2011-09-02 11:44:37Z ibiru $
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgbase=pygobject2
pkgname=(python-gobject2 python2-gobject2 pygobject2-devel)
pkgver=2.28.6
pkgrel=1
arch=('i686' 'x86_64')
url="http://www.pygtk.org/"
license=('LGPL')
depends=('glib2' 'gobject-introspection')
makedepends=(python python2 python-cairo python2-cairo)
source=(http://ftp.gnome.org/pub/gnome/sources/pygobject/${pkgver%.*}/pygobject-${pkgver}.tar.xz
        python3-fix-build.patch
        python3-fix-maketrans.patch)
options=('!libtool')
sha256sums=('fb8a1d4f665130a125011659bd347c7339c944232163dbb9a34fd0686577adb8'
            'feafd4664f8455edf0bf8407ac45e219bb550df806ce0d601baae951e8c188ca'
            '4bff9adcea13a824c45d14ec501c927df47d23c22507a2456d8b5ec885924c0a')

build() {
  cd "${srcdir}"
  cp -a "pygobject-${pkgver}" python2-build
  mkdir devel

  (
    cd python2-build
    export PYTHON=/usr/bin/python2
    ./configure --prefix=/usr
    make
  )

  (
    cd "pygobject-${pkgver}"
    #patches available in 2.28 branch but unreleased.
    patch -Np1 -i "${srcdir}/python3-fix-build.patch"
    patch -Np1 -i "${srcdir}/python3-fix-maketrans.patch"

    ./configure --prefix=/usr
    make
  )
}

package_python-gobject2() {
  pkgdesc="Python 3 bindings for GObject2"
  depends+=('python' 'python-cairo' 'pygobject2-devel')
  replaces=('py3gobject')
  provides=("py3gobject=$pkgver")

  cd "${srcdir}/pygobject-${pkgver}"
  make DESTDIR="${pkgdir}" install

  # Delete devel stuff
  rm -r "$pkgdir"/usr/{bin,include,lib/pkgconfig,share/{gtk-doc,pygobject/{2.0/codegen,xsl}}}
}

package_python2-gobject2() {
  pkgdesc="Python 2 bindings for GObject2"
  depends+=('python2' 'python2-cairo' 'pygobject2-devel')
  replaces=('pygobject')
  provides=("pygobject=$pkgver")

  cd "${srcdir}/python2-build"
  make DESTDIR="${pkgdir}" install

  find "$pkgdir"/usr/share/pygobject -name '*.py' | \
    xargs sed -i "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"

  # Split devel stuff
  mv "$pkgdir"/usr/{bin,include,lib/pkgconfig,share/{gtk-doc,pygobject/{2.0/codegen,xsl}}} \
    "$srcdir/devel/"
}

package_pygobject2-devel() {
  pkgdesc="Development files for the pygobject bindings"
  depends=(python2)
  replaces=pygobject-devel
  provides=pygobject-devel

  cd "${srcdir}/devel"
  mkdir -p "$pkgdir"/usr/{include,lib,share/pygobject/2.0}

  mv bin       "$pkgdir/usr/"
  mv include   "$pkgdir/usr/"
  mv pkgconfig "$pkgdir/usr/lib/"
  mv gtk-doc   "$pkgdir/usr/share/"
  mv codegen   "$pkgdir/usr/share/pygobject/2.0/"
  mv xsl       "$pkgdir/usr/share/pygobject/"
}