summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6b8ef61bf6077db0724f0ada62ac6dc609d1691e (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
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: Thermi <noel[ at ] familie-kuntze.de>
# Submitter: nullie

pkgname=lsyncd
pkgver=2.3.1
pkgrel=9
pkgdesc="Live Syncing (Mirror) Daemon"
arch=(x86_64)
url="https://github.com/lsyncd/lsyncd"
license=(GPL-2.0-or-later)
depends=(
  glibc
  lua53
  rsync
)
makedepends=(
  asciidoc
  cmake
)
checkdepends=(
  lua53-posix
  openssh
)
source=(
  "$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
  "lsyncd.service"
  "lsyncd.sysusers"
  "use-lua53.patch"
)
sha256sums=(
  '501f70368da8c43d3da81bf9bbb22f43dfcbc9f96b03c745842f326723c091c7'
  'ee0f76dac6e8e73731862ac9d09d6f4c10ac1ff97b815d51870b700757768804'
  'f3d6b6c1411de9f6c9a2980e41dcfb87ede9c02005ebb881878f399f062d825f'
  'ef55721553bdac0e3441ced58b9df1bb0d24f97513e66c12c3e94a477ba89115'
)

_archive="$pkgname-$pkgver"

prepare() {
  cd "$_archive"

  patch --forward --strip=1 --input="$srcdir/use-lua53.patch"
}

build() {
  cd "$_archive"

  cmake -B build -S . \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev
  cmake --build build
}

check() {
  cd "$_archive"

  # Lua dependency lua-crontab is not packaged. Link:
  # https://luarocks.org/modules/agladysh/lua-crontab
  sed --in-place '/cron-rsync.lua/d' CMakeLists.txt

  # SSH tests not functional if BUILDDIR is outside of home directory.
  sed --in-place '/exclude-rsyncssh.lua/d' CMakeLists.txt
  sed --in-place '/churn-rsyncssh.lua/d' CMakeLists.txt

  cmake --build build --target run-tests
}

package() {
  cd "$_archive"

  DESTDIR="$pkgdir" cmake --install build

  install -Dm664 -t "$pkgdir/usr/share/man/man1" "$pkgdir/man1/lsyncd.1"
  rm -rf "$pkgdir/man1"

  install -Dm644 -t "$pkgdir/usr/lib/systemd/system" "$srcdir/lsyncd.service"
  install -Dm644 "$srcdir/lsyncd.sysusers" "$pkgdir/usr/lib/sysusers.d/lsyncd.conf"

  install -dm755 "$pkgdir/usr/share/doc/$pkgname"
  cp -a -t "$pkgdir/usr/share/doc/$pkgname" "$pkgdir/usr/doc/examples"
  rm -rf "$pkgdir/usr/doc"
}