summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 42fdd8cfb9868c290d4f979b8c68a5d430363bca (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
# Maintainer:

_pkgname="python-cairo"
pkgname="$_pkgname-git"
pkgver=1.26.1.r1.g176a1a6
pkgrel=1
pkgdesc="Python bindings for the cairo graphics library"
url="https://github.com/pygobject/pycairo"
license=('LGPL-2.1-only')
arch=('x86_64')

depends=(
  'cairo'
  'python'
)
makedepends=(
  'git'
  'meson'
  'python-sphinx'
  'python-sphinx_rtd_theme'
)
checkdepends=('python-pytest')

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+https://github.com/pygobject/pycairo.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 \
    | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  arch-meson "$_pkgsrc" build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir="$pkgdir"

  # compile Python bytecode
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}