chrony-3.1.ebuild 2.8 KB

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