summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: afa853d512584fcbed0dd7108d08697fd51bc7d7 (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: Fancy Zhang <springzfx@gmail.com>
pkgname=cgproxy-git
pkgver=v0.16.r0.g25d64f7
pkgrel=1
pkgdesc="A transparent proxy program powered by cgroup2 and tproxy"
arch=('x86_64')
url="https://github.com/springzfx/cgproxy"
license=('GPL')
groups=('')
makedepends=('llvm' 'clang' 'cmake' 'nlohmann-json' 'bpf')
depends=('gcc-libs' 'systemd')
provides=('cgproxy')
conflicts=('cgproxy')

source=("${pkgname}::git+https://github.com/springzfx/cgproxy#branch=master")
md5sums=('SKIP')

pkgver() {
  cd "$pkgname"
  ( set -o pipefail
    git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

backup=('etc/cgproxy/config.json')
install="cgproxy.install"

build(){
    cd ${srcdir}/${pkgname}
    # init submodule
    git submodule init
    git submodule update

    # build libexecsnoop.so
    cd "${srcdir}/${pkgname}/execsnoop-libbpf"
    make clean
    make CFLAGS="-O2 -Wall" libexecsnoop.so

    # build main binary
    cd "${srcdir}/${pkgname}"
    mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make
}

package_cgproxy-git(){
    cd "${srcdir}/$pkgname"/build
    make DESTDIR=$pkgdir install
    # cd "${srcdir}/${pkgname}/execsnoop-libbpf"
    # make DESTDIR=$pkgdir install
}