summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cae02928973cfa34094bfd4fd7409f5482d70591 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Maintainer: Troy Engel <troyengel+arch@gmail.com>
# Contributor: Manuel Mendez <mmendez534@gmail.com>

pkgbase=bcc-git
pkgname=('bcc-git' 'bcc-tools-git' 'python-bcc-git' 'python2-bcc-git')
pkgver=v0.1.7.r88.f50ca1f
pkgrel=2
pkgdesc="BPF Compiler Collection - latest git code"
arch=('x86_64')
url="https://github.com/iovisor/bcc"
license=('Apache')
conflicts=('bcc')
makedepends=('cmake' 'clang>=3.7.0' 'llvm>=3.7.0' 'flex' 'bison' 'python'
             'python2')
source=('bcc-git::git+https://github.com/iovisor/bcc')
sha256sums=('SKIP')

pkgver() {
  cd "${srcdir}/${pkgbase}"
  printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

build() {
  # make sure repetitive builds are clean
  [[ -d "${srcdir}/${pkgbase}/build" ]] && \
    rm -rf "${srcdir}/${pkgbase}/build"
  mkdir "${srcdir}/${pkgbase}/build"
  cd "${srcdir}/${pkgbase}/build"

  # we don't care which python here for the core C library
  cmake .. \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib
  make
}

package_bcc-git() {
  pkgdesc="BPF Compiler Collection  - C library and examples"
  makedepends=('cmake' 'clang>=3.7.0' 'llvm>=3.7.0' 'flex' 'bison')
  provides=('bcc-git' 'libbcc-git')
  conflicts=('bcc')
  optdepends=('bcc-tools-git: Python utilites using the BCC library'
              'python-bcc-git: Python 3 bindings for BCC'
              'python2-bcc-git: Python 2 bindings for BCC')

  # this installs the kitchen sink
  cd "${srcdir}/${pkgbase}/build"
  make DESTDIR="${pkgdir}/" install

  # these go in a split package python*-bcc
  rm -rf "${pkgdir}"/usr/lib/python*

  # these go in a split package bcc-tools
  rm -rf "${pkgdir}"/usr/share/bcc/{tools,man}
}

package_bcc-tools-git() {
  pkgdesc="BPF Compiler Collection - Tools"
  depends=('bcc-git')
  conflicts=('bcc-tools')
  optdepends=('python-bcc-git: Python 3 bindings for BCC'
              'python2-bcc-git: Python 2 bindings for BCC')

  cd "${srcdir}/${pkgbase}/build/tools"
  make DESTDIR="${pkgdir}/" install

  cd "${srcdir}/${pkgbase}/build/man"
  make DESTDIR="${pkgdir}/" install

}

package_python-bcc-git() {
  pkgdesc="BPF Compiler Collection - Python 3 bindings"
  makedepends=('cmake')
  depends=('bcc-git' 'python')
  conflicts=('python-bcc')

  # the C lib s already built, force a quick python3 binding build
  cd "${srcdir}/${pkgbase}/build"
  cmake .. -DPYTHON_CMD="python" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib
  make

  # now install just those bindings
  cd "${srcdir}/${pkgbase}/build/src/python"
  make DESTDIR="${pkgdir}/" install
}

package_python2-bcc-git() {
  pkgdesc="BPF Compiler Collection - Python 2 bindings"
  makedepends=('cmake')
  depends=('bcc-git' 'python2')
  conflicts=('python2-bcc')

  # the C lib is already built, force a quick python2 binding build
  cd "${srcdir}/${pkgbase}/build"
  cmake .. -DPYTHON_CMD="python2" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib
  make

  # now install just those bindings
  cd "${srcdir}/${pkgbase}/build/src/python"
  make DESTDIR="${pkgdir}/" install
}