net-misc/chrony: Version 3.5
[gentoo.git] / net-misc / chrony / chrony-3.5.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 inherit systemd toolchain-funcs
6
7 DESCRIPTION="NTP client and server programs"
8 HOMEPAGE="https://chrony.tuxfamily.org/"
9 SRC_URI="https://download.tuxfamily.org/${PN}/${P/_/-}.tar.gz"
10 LICENSE="GPL-2"
11 SLOT="0"
12
13 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"
14 IUSE="caps +cmdmon html ipv6 libedit +ntp +phc pps readline +refclock +rtc seccomp selinux +adns"
15 REQUIRED_USE="
16         ?? ( libedit readline )
17 "
18
19 CDEPEND="
20         caps? ( sys-libs/libcap )
21         libedit? ( dev-libs/libedit )
22         readline? ( >=sys-libs/readline-4.1-r4:= )
23         seccomp? ( sys-libs/libseccomp )
24 "
25 DEPEND="
26         ${CDEPEND}
27         html? ( dev-ruby/asciidoctor )
28         pps? ( net-misc/pps-tools )
29 "
30 RDEPEND="
31         ${CDEPEND}
32         selinux? ( sec-policy/selinux-chronyd )
33 "
34
35 RESTRICT=test
36
37 S="${WORKDIR}/${P/_/-}"
38
39 PATCHES=(
40         "${FILESDIR}"/${PN}-3.5-systemd-gentoo.patch
41 )
42
43 src_prepare() {
44         default
45         sed -i \
46                 -e 's:/etc/chrony\.conf:/etc/chrony/chrony.conf:g' \
47                 doc/* examples/* || die
48 }
49
50 src_configure() {
51         tc-export CC
52
53         local CHRONY_EDITLINE
54         # ./configure legend:
55         # --disable-readline : disable line editing entirely
56         # --without-readline : do not use sys-libs/readline (enabled by default)
57         # --without-editline : do not use dev-libs/libedit (enabled by default)
58         if ! use readline && ! use libedit; then
59                 CHRONY_EDITLINE='--disable-readline'
60         else
61                 CHRONY_EDITLINE+=" $(usex readline '' --without-readline)"
62                 CHRONY_EDITLINE+=" $(usex libedit '' --without-editline)"
63         fi
64
65         # not an autotools generated script
66         local CHRONY_CONFIGURE="
67         ./configure \
68                 $(use_enable seccomp scfilter) \
69                 $(usex adns '' --disable-asyncdns) \
70                 $(usex caps '' --disable-linuxcaps) \
71                 $(usex cmdmon '' --disable-cmdmon) \
72                 $(usex ipv6 '' --disable-ipv6) \
73                 $(usex ntp '' --disable-ntp) \
74                 $(usex phc '' --disable-phc) \
75                 $(usex pps '' --disable-pps) \
76                 $(usex refclock '' --disable-refclock) \
77                 $(usex rtc '' --disable-rtc) \
78                 ${CHRONY_EDITLINE} \
79                 ${EXTRA_ECONF} \
80                 --chronysockdir=/run/chrony \
81                 --disable-sechash \
82                 --docdir=/usr/share/doc/${PF} \
83                 --mandir=/usr/share/man \
84                 --prefix=/usr \
85                 --sysconfdir=/etc/chrony \
86                 --with-pidfile="${EPREFIX}/run/chrony/chronyd.pid"
87                 --without-nss \
88                 --without-tomcrypt
89         "
90
91         # print the ./configure call to aid in future debugging
92         einfo ${CHRONY_CONFIGURE}
93         bash ${CHRONY_CONFIGURE} || die
94 }
95
96 src_compile() {
97         emake all docs $(usex html '' 'ADOC=true')
98 }
99
100 src_install() {
101         default
102
103         newinitd "${FILESDIR}"/chronyd.init-r2 chronyd
104         newconfd "${FILESDIR}"/chronyd.conf chronyd
105
106         insinto /etc/${PN}
107         newins examples/chrony.conf.example1 chrony.conf
108
109         docinto examples
110         dodoc examples/*.example*
111
112         if use html; then
113                 docinto html
114                 dodoc doc/*.html
115         fi
116
117         keepdir /var/{lib,log}/chrony
118
119         insinto /etc/logrotate.d
120         newins "${FILESDIR}"/chrony-2.4-r1.logrotate chrony
121
122         systemd_dounit examples/chronyd.service
123 }