summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 1417d2330e0ecb22bc67f7be7edc0f51b6975818 (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
85
86
87
88
89
90
91
92
# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Maintainer (Arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor (Arch): Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor (Arch): Daniel Micay <danielmicay@gmail.com>
# Contributor (Arch): Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor (Arch): Patrick Leslie Polzer <leslie.polzer@gmx.net>
# Contributor (Arch): cdhotfire <cdhotfire@gmail.com>
# Contributor (Arch): Shinlun Hsieh <yngwiexx@yahoo.com.tw>
# Contributor (Arch): Elisamuel Resto <ryuji@simplysam.us>

# # I maintain this because:
# Arch version is not configured for openrc
# Arch version uses /etc/chrony.conf instead of /etc/chrony/chrony.conf


pkgname=chrony
pkgver=4.0
pkgrel=1
pkgdesc='Lightweight NTP client and server'
url='https://chrony.tuxfamily.org/'
arch=('x86_64')
license=('GPL2')
depends=('glibc' 'nss' 'readline' 'libcap' 'libcap.so' 'libedit' 'libseccomp' 'libseccomp.so'
         'nettle' 'libnettle.so' 'gnutls')
makedepends=('asciidoctor')
options=('!emptydirs')
backup=('etc/chrony/chrony.conf')
source=(https://download.tuxfamily.org/chrony/${pkgname}-${pkgver}.tar.gz
        ${pkgname}-${pkgver}.tar.gz.asc::https://download.tuxfamily.org/chrony/${pkgname}-${pkgver}-tar-gz-asc.txt
        chrony.sysusers
        chrony.tmpfiles)
b2sums=('1d4035977be3603b34024c5c1c2aa5f2b4aca03fe7dc1eb41be2e9aeefa06e20a5f74776c50bdadaffba10ae25e7980bcbd9cf2b999bd73087728afe7a80253e'
        'SKIP'
        'e310a05f95d84741f7ddbbc496c52a9f603bb79afc47e57d291a92ae02efb630a357fda378ab5a11875c3997d073e05019d88dce7bbf4377a0228f328ba78fec'
        'e709df2f97b523ef1c7a9dae3232ccbd235ac8f025eba866165272f8ba0372a0aba965d3aae1402395e43331bd629b9d8f3fbffd75fc254f4a7e5ecd47f73130')
validpgpkeys=('8B1F4A9ADA73D401E3085A0B5FF06F29BA1E013B') # Miroslav Lichvar <mlichvar@redhat.com> has a dsa1024 key *in the wild*

prepare() {
  cd ${pkgname}-${pkgver}
  sed -i \
    -e 's|pool pool.ntp.org|pool 2.arch.pool.ntp.org|g' \
    -e 's|server foo.example.net|server 0.arch.pool.ntp.org|g' \
    -e 's|server bar.example.net|server 1.arch.pool.ntp.org|g' \
    -e 's|server baz.example.net|server 3.arch.pool.ntp.org|g' \
    examples/chrony.conf.example*
}

build() {
  cd ${pkgname}-${pkgver}
  export CFLAGS="$CFLAGS -O3 -fstack-protector-all -flto=auto -fPIE"
  export CXXFLAGS="$CXXFLAGS -O3 -fstack-protector-all -flto=auto -fPIE"
  export LDFLAGS="$LDFLAGS,-pie"
  ./configure \
    --prefix=/usr \
    --enable-readline \
    --enable-scfilter \
    --enable-ntp-signd \
    --with-user=chrony \
    --with-sendmail=/usr/bin/sendmail \
    --with-hwclockfile=/etc/adjtime \
    --sbindir=/usr/bin \
    --with-pidfile=/run/chrony/chronyd.pid
  make
}

if [ "$_cross" != "1" ]; then
  check() {
    cd ${pkgname}-${pkgver}
    make check
  }
fi

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install install-docs

  install -Dm 644 "${srcdir}/chrony.sysusers" "${pkgdir}/usr/lib/sysusers.d/chrony.conf"
  install -Dm 644 "${srcdir}/chrony.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/chrony.conf"
  install -Dm 644 examples/chrony.logrotate "${pkgdir}/etc/logrotate.d/chrony"
  install -Dm 644 README NEWS FAQ -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 examples/* -t "${pkgdir}/usr/share/doc/${pkgname}/examples"

  install -Dm 644 examples/chrony.conf.example3 "${pkgdir}/etc/chrony/chrony.conf"
  sed -i \
    -e '/^! pool /s/^! //' \
    -e '/^! leapsectz right\/UTC/s/^! //' \
    -e '/^! makestep 1.0 3/s/^! //' \
    -e '/^! rtcsync/s/^! //' \
    "${pkgdir}/etc/chrony/chrony.conf"

  rmdir "${pkgdir}"{/var/lib/chrony,/var/lib}
}