summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2b4980a87bb96be463e5e9fc80f199219ea3d12a (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
pkgname=lattice-net-git
pkgver=0.1.0.r0.g0000000
pkgrel=2
pkgdesc="Peer-to-peer web protocol CLI and daemon"
arch=('x86_64')
url="https://github.com/fordz0/lattice"
license=('GPL3')
depends=('glibc' 'gcc-libs' 'systemd')
makedepends=('cargo' 'git')
options=(!lto !debug)
provides=('lattice-net')
conflicts=('lattice-net' 'lattice-net-bin')
install=lattice-net-git.install
source=("git+https://github.com/fordz0/lattice.git")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/lattice"
  printf "0.1.0.r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/lattice"
  export CARGO_TARGET_DIR=target
  cargo build --release --locked -p lattice -p lattice-daemon
}

check() {
  cd "$srcdir/lattice"
  export CARGO_TARGET_DIR=target
  cargo test --locked -p lattice
}

package() {
  cd "$srcdir/lattice"

  install -Dm755 "target/release/lattice" "$pkgdir/usr/bin/lattice"
  install -Dm755 "target/release/lattice-daemon" "$pkgdir/usr/bin/lattice-daemon"
  install -Dm755 "$startdir/restart-daemon-if-active.sh" \
    "$pkgdir/usr/lib/lattice/restart-daemon-if-active.sh"
  install -Dm644 "$startdir/lattice-daemon.service" \
    "$pkgdir/usr/lib/systemd/user/lattice-daemon.service"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}