summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a926540a3930339da412a1fc1ae5018c4dd7664e (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
# Maintainer: edward-p <edward at edward-p dot xyz>

pkgname=einat-ebpf-git
_pkgname=einat-ebpf
_target=einat
pkgver=0.1.2.r0.g871646c
pkgrel=1
pkgdesc="eBPF-based Endpoint-Independent NAT"
arch=('x86_64')
url="https://github.com/EHfive/einat-ebpf"
license=('GPL-2.0-only')
depends=('glibc' 'gcc-libs' 'zlib' 'libelf')
provides=('einat')
conflicts=('einat')
makedepends=('git' 'cargo' 'clang')
source=("$_pkgname::git+https://github.com/EHfive/einat-ebpf.git"
        "einat.service")
sha512sums=('SKIP'
            '52ce570ef64664cc9eb1180c9f98fbc00249db7ed28352835d4574383e399fd5b2f142515169e609344538680b4c949c5342a0607b31a16ae4857491da052b91')
options=(!lto !debug)

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

prepare() {
  cd "$_pkgname"
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "$_pkgname"
  cargo build --release --features ipv6 --frozen
}

check() {
  cd "$_pkgname"
  cargo test --frozen
}

package() {
  cd "$_pkgname"
  install -Dm 755 "target/release/$_target" -t "$pkgdir/usr/bin"
  install -Dm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 config.sample.toml -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 "$srcdir/einat.service" -t "$pkgdir/usr/lib/systemd/system"
}

# vim: ts=2 sw=2 et: