chrony-2.4.ebuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  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 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. "
  24. RDEPEND="
  25. ${CDEPEND}
  26. selinux? ( sec-policy/selinux-chronyd )
  27. "
  28. RESTRICT=test
  29. S="${WORKDIR}/${P/_/-}"
  30. src_prepare() {
  31. sed -i \
  32. -e 's:/etc/chrony\.:/etc/chrony/chrony.:g' \
  33. -e 's:/var/run:/run:g' \
  34. conf.c doc/*.man.in examples/* || die
  35. }
  36. src_configure() {
  37. tc-export CC
  38. local CHRONY_EDITLINE
  39. # ./configure legend:
  40. # --disable-readline : disable line editing entirely
  41. # --without-readline : do not use sys-libs/readline (enabled by default)
  42. # --without-editline : do not use dev-libs/libedit (enabled by default)
  43. if ! use readline && ! use libedit; then
  44. CHRONY_EDITLINE='--disable-readline'
  45. else
  46. CHRONY_EDITLINE+=" $(usex readline '' --without-readline)"
  47. CHRONY_EDITLINE+=" $(usex libedit '' --without-editline)"
  48. fi
  49. # not an autotools generated script
  50. local CHRONY_CONFIGURE="
  51. ./configure \
  52. $(usex caps '' --disable-linuxcaps) \
  53. $(usex cmdmon '' --disable-cmdmon) \
  54. $(usex ipv6 '' --disable-ipv6) \
  55. $(usex ntp '' --disable-ntp) \
  56. $(usex phc '' --disable-phc) \
  57. $(usex pps '' --disable-pps) \
  58. $(usex rtc '' --disable-rtc) \
  59. $(usex refclock '' --disable-refclock) \
  60. $(usex adns '' --disable-asyncdns) \
  61. ${CHRONY_EDITLINE} \
  62. ${EXTRA_ECONF} \
  63. --docdir=/usr/share/doc/${PF} \
  64. --chronysockdir=/run/chrony \
  65. --mandir=/usr/share/man \
  66. --prefix=/usr \
  67. --sysconfdir=/etc/chrony \
  68. --disable-sechash \
  69. --without-nss \
  70. --without-tomcrypt
  71. "
  72. # print the ./configure call to aid in future debugging
  73. einfo ${CHRONY_CONFIGURE}
  74. bash ${CHRONY_CONFIGURE} || die
  75. }
  76. src_compile() {
  77. emake all docs $(usex html '' 'ADOC=true')
  78. }
  79. src_install() {
  80. default
  81. newinitd "${FILESDIR}"/chronyd.init-r1 chronyd
  82. newconfd "${FILESDIR}"/chronyd.conf chronyd
  83. insinto /etc/${PN}
  84. newins examples/chrony.conf.example1 chrony.conf
  85. docinto examples
  86. dodoc examples/*.example*
  87. if use html; then
  88. docinto html
  89. dodoc doc/*.html
  90. fi
  91. keepdir /var/{lib,log}/chrony
  92. insinto /etc/logrotate.d
  93. newins "${FILESDIR}"/chrony-2.4-r1.logrotate chrony
  94. systemd_newunit "${FILESDIR}"/chronyd.service-r2 chronyd.service
  95. systemd_enable_ntpunit 50-chrony chronyd.service
  96. }