summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 01a10313e13925eb5caa3cc4867cb5e43a4e129c (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
# Maintainer: hizani

pkgname=toxcore-c
_pkgname=c-toxcore
pkgver=0.2.20
pkgrel=4
pkgdesc='C backend implementation of the Tox communication protocol'
arch=('x86_64')
url='https://tox.chat'
license=('GPL3')
depends=('systemd' 'libconfig' 'libsodium' 'libvpx' 'opus')
makedepends=('base-devel' 'git' 'cmake')
checkdepends=('gtest')
provides=('tox')
backup=('etc/tox-bootstrapd.conf')
source=("git+https://github.com/TokTok/${_pkgname}.git")
sha512sums=('SKIP')

prepare() {
  cd $_pkgname

  git checkout -q tags/v${pkgver}
  git submodule update --init --recursive
  sed -i "s|/usr/local|/usr|" "other/bootstrap_daemon/tox-bootstrapd.service"

  echo 'u tox-bootstrapd 199 "Tox bootstrapd"' > "$srcdir/toxcore.conf"
  echo "g tox-bootstrapd 199" >> "$srcdir/toxcore.conf"
  echo "d /var/lib/tox-bootstrapd 0750 tox-bootstrapd tox-bootstrapd - -\n" > "$srcdir/toxcore.tmpfiles"
}

build() {
  cd $_pkgname
  cmake -B=_build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DDHT_BOOTSTRAP=on \
		-DBOOTSTRAP_DAEMON=on \
		-DBUILD_TOXAV=on \
		-DCMAKE_BUILD_TYPE=Release \
		-DENABLE_STATIC=on \
		-DENABLE_SHARED=on
  make -C "_build"
}

check() {
  cd $_pkgname/_build
  make test
}

package() {
  cd $_pkgname/_build
  make DESTDIR="$pkgdir" install
  install -Dm644 "$srcdir/toxcore.conf" "$pkgdir/usr/lib/sysusers.d/toxcore.conf"
  install -Dm644 "$srcdir/toxcore.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/toxcore.conf"
  install -Dm644 ../other/bootstrap_daemon/tox-bootstrapd.service "$pkgdir/usr/lib/systemd/system/tox-bootstrapd.service"
  install -Dm644 ../other/bootstrap_daemon/tox-bootstrapd.conf "$pkgdir/etc/tox-bootstrapd.conf"
}