summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: de42268c3ad88e7892451b1df3574452606a5598 (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
# Maintainer:  Stephen Gregoratto <dev@sgregoratto.me>
# Contributor: Jakub Klinkovský <j.l.k@gmx.com>
# Contributor: Matheus de Alcantara <matheus.de.alcantara@gmail.com>

pkgname=mandoc-cvs
pkgver=20191111
pkgrel=1
pkgdesc='A suite of tools compiling mdoc from the OpenBSD project'
license=('custom: ISC')
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
url='https://mandoc.bsd.lv'
depends=('zlib')
makedepends=('cvs' 'openssh')
provides=('man')
conflicts=('man')
source=('configure.local'
        'mandoc.service'
        'mandoc.timer')
sha256sums=('8d1301ac6e52653fedda5b862428f0b21976664005c7b3da24bf4e411d7bb56d'
            '2091411d5f87a3c371a5ba74b4773d1e454046446fa2cb045485979e52419bb6'
            '74d6a02b97a17fffddcc0a3dc830e811348b1f6c6b84f867882c776d50f00ea4')

prepare() {
  msg2 "Checking out sources using anonymous CVS over SSH."
  msg2 "As of 2019-03, the fingerprint of mandoc.bsd.lv is zj94mkQU15j7Hh4YalZHbEO2m4jm2ZVW0cuva+OpKvg."
  msg2 "Do NOT continue connecting if these do not match."
  CVS_RSH=ssh cvs -d anoncvs@mandoc.bsd.lv:/cvs checkout -d "$pkgname" -P mandoc
}

pkgver() {
  cd "$pkgname"
  # CVS does not save the latest tag/revision of the tree.
  # The only reliable way to get the latest version is to
  # use the date of the last modified file.
  # Exclude the CVS files as they are autogenerated.
  lmod="$(find "$PWD" -type f -not -path "*CVS*" -exec stat -c '%Y' {} \; | sort -rn | sed 1q)"
  date -d "@$lmod" "+%Y%m%d"
}

build() {
  cd $pkgname
  cat "$srcdir/configure.local" - <<EOF > configure.local
CPPFLAGS="$CPPFLAGS"
CFLAGS="$CFLAGS"
LDFLAGS="$LDFLAGS"
EOF
  ./configure
  make
}

package() {
  cd $pkgname
  DESTDIR="$pkgdir" make install
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

  install -Dm644 "$srcdir"/mandoc.timer "$pkgdir"/usr/lib/systemd/system/mandoc.timer
  install -Dm644 "$srcdir"/mandoc.service "$pkgdir"/usr/lib/systemd/system/mandoc.service
  install -dm755 "$pkgdir"/usr/lib/systemd/system/multi-user.target.wants
  ln -s ../mandoc.timer "$pkgdir"/usr/lib/systemd/system/multi-user.target.wants/mandoc.timer
}

# vim: tw=0