1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils systemd toolchain-funcs
8 DESCRIPTION="NTP client and server programs"
9 HOMEPAGE="http://chrony.tuxfamily.org/"
10 SRC_URI="http://download.tuxfamily.org/${PN}/${P/_/-}.tar.gz"
14 KEYWORDS="~alpha ~amd64 ~hppa ~ppc64"
15 IUSE="caps +cmdmon html ipv6 libedit +ntp +phc pps readline +refclock +rtc selinux +adns"
17 ?? ( libedit readline )
21 caps? ( sys-libs/libcap )
22 libedit? ( dev-libs/libedit )
23 readline? ( >=sys-libs/readline-4.1-r4:= )
27 html? ( dev-ruby/asciidoctor )
28 pps? ( net-misc/pps-tools )
32 selinux? ( sec-policy/selinux-chronyd )
37 S="${WORKDIR}/${P/_/-}"
41 -e 's:/etc/chrony\.:/etc/chrony/chrony.:g' \
42 -e 's:/var/run:/run:g' \
43 conf.c doc/*.man.in examples/* || die
53 # --disable-readline : disable line editing entirely
54 # --without-readline : do not use sys-libs/readline (enabled by default)
55 # --without-editline : do not use dev-libs/libedit (enabled by default)
56 if ! use readline && ! use libedit; then
57 CHRONY_EDITLINE='--disable-readline'
59 CHRONY_EDITLINE+=" $(usex readline '' --without-readline)"
60 CHRONY_EDITLINE+=" $(usex libedit '' --without-editline)"
63 # not an autotools generated script
64 local CHRONY_CONFIGURE="
66 $(usex caps '' --disable-linuxcaps) \
67 $(usex cmdmon '' --disable-cmdmon) \
68 $(usex ipv6 '' --disable-ipv6) \
69 $(usex ntp '' --disable-ntp) \
70 $(usex phc '' --disable-phc) \
71 $(usex pps '' --disable-pps) \
72 $(usex rtc '' --disable-rtc) \
73 $(usex refclock '' --disable-refclock) \
74 $(usex adns '' --disable-asyncdns) \
77 --docdir=/usr/share/doc/${PF} \
78 --chronysockdir=/run/chrony \
79 --mandir=/usr/share/man \
81 --sysconfdir=/etc/chrony \
87 # print the ./configure call to aid in future debugging
88 einfo ${CHRONY_CONFIGURE}
89 bash ${CHRONY_CONFIGURE} || die
93 emake all docs $(usex html '' 'ADOC=true')
99 newinitd "${FILESDIR}"/chronyd.init-r1 chronyd
100 newconfd "${FILESDIR}"/chronyd.conf chronyd
103 newins examples/chrony.conf.example1 chrony.conf
106 dodoc examples/*.example*
113 keepdir /var/{lib,log}/chrony
115 insinto /etc/logrotate.d
116 newins "${FILESDIR}"/chrony-2.4-r1.logrotate chrony
118 systemd_newunit "${FILESDIR}"/chronyd.service-r2 chronyd.service
119 systemd_enable_ntpunit 50-chrony chronyd.service