net-misc/chrony: Re-add ~alpha.
[gentoo.git] / net-misc / chrony / chrony-3.0_pre2.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6 inherit eutils systemd toolchain-funcs
7
8 DESCRIPTION="NTP client and server programs"
9 HOMEPAGE="http://chrony.tuxfamily.org/"
10 SRC_URI="http://download.tuxfamily.org/${PN}/${P/_/-}.tar.gz"
11 LICENSE="GPL-2"
12 SLOT="0"
13
14 KEYWORDS="~alpha ~amd64 ~hppa ~ppc64"
15 IUSE="caps +cmdmon html ipv6 libedit +ntp +phc pps readline +refclock +rtc selinux +adns"
16 REQUIRED_USE="
17         ?? ( libedit readline )
18 "
19
20 CDEPEND="
21         caps? ( sys-libs/libcap )
22         libedit? ( dev-libs/libedit )
23         readline? ( >=sys-libs/readline-4.1-r4:= )
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 src_prepare() {
40         sed -i \
41                 -e 's:/etc/chrony\.:/etc/chrony/chrony.:g' \
42                 -e 's:/var/run:/run:g' \
43                 conf.c doc/*.man.in examples/* || die
44
45         default
46 }
47
48 src_configure() {
49         tc-export CC
50
51         local CHRONY_EDITLINE
52         # ./configure legend:
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'
58         else
59                 CHRONY_EDITLINE+=" $(usex readline '' --without-readline)"
60                 CHRONY_EDITLINE+=" $(usex libedit '' --without-editline)"
61         fi
62
63         # not an autotools generated script
64         local CHRONY_CONFIGURE="
65         ./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) \
75                 ${CHRONY_EDITLINE} \
76                 ${EXTRA_ECONF} \
77                 --docdir=/usr/share/doc/${PF} \
78                 --chronysockdir=/run/chrony \
79                 --mandir=/usr/share/man \
80                 --prefix=/usr \
81                 --sysconfdir=/etc/chrony \
82                 --disable-sechash \
83                 --without-nss \
84                 --without-tomcrypt
85         "
86
87         # print the ./configure call to aid in future debugging
88         einfo ${CHRONY_CONFIGURE}
89         bash ${CHRONY_CONFIGURE} || die
90 }
91
92 src_compile() {
93         emake all docs $(usex html '' 'ADOC=true')
94 }
95
96 src_install() {
97         default
98
99         newinitd "${FILESDIR}"/chronyd.init-r1 chronyd
100         newconfd "${FILESDIR}"/chronyd.conf chronyd
101
102         insinto /etc/${PN}
103         newins examples/chrony.conf.example1 chrony.conf
104
105         docinto examples
106         dodoc examples/*.example*
107
108         if use html; then
109                 docinto html
110                 dodoc doc/*.html
111         fi
112
113         keepdir /var/{lib,log}/chrony
114
115         insinto /etc/logrotate.d
116         newins "${FILESDIR}"/chrony-2.4-r1.logrotate chrony
117
118         systemd_newunit "${FILESDIR}"/chronyd.service-r2 chronyd.service
119         systemd_enable_ntpunit 50-chrony chronyd.service
120 }