ntp.spec 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. ##
  2. ## ntp.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: ntp
  26. Summary: Network Time Protocol (NTP) Daemon
  27. URL: http://www.ntp.org/
  28. Vendor: David L. Mills
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: CORE
  32. Group: Network
  33. License: BSD-style
  34. Version: 4.2.2p4
  35. Release: 20061016
  36. # package options
  37. %option with_fsl yes
  38. %option with_crypto yes
  39. %option with_sntp yes
  40. %option with_local yes
  41. # list of sources
  42. Source0: ftp://ftp.udel.edu/pub/ntp/ntp4/ntp-%{version}.tar.gz
  43. Source1: ntp-doc.tar.gz
  44. Source2: ntp.conf
  45. Source3: rc.ntp
  46. Source4: fsl.ntp
  47. Patch0: ntp.patch
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20060823, make
  52. PreReq: OpenPKG, openpkg >= 20060823
  53. %if "%{with_fsl}" == "yes"
  54. BuildPreReq: fsl >= 1.2.0
  55. PreReq: fsl >= 1.2.0
  56. %endif
  57. %if "%{with_crypto}" == "yes"
  58. BuildPreReq: openssl, gcc
  59. PreReq: openssl
  60. %endif
  61. AutoReq: no
  62. AutoReqProv: no
  63. %description
  64. The Network Time Protocol (NTP) is used to synchronize the time
  65. of a computer client or server to another server or reference
  66. time source, such as a radio or satellite receiver or modem. It
  67. provides accuracies typically within a millisecond on LANs and
  68. up to a few tens of milliseconds on WANs relative to Coordinated
  69. Universal Time (UTC) via a Global Positioning Service (GPS)
  70. receiver, for example. Typical NTP configurations utilize multiple
  71. redundant servers and diverse network paths in order to achieve high
  72. accuracy and reliability. Some configurations include cryptographic
  73. authentication to prevent accidental or malicious protocol attacks
  74. and some provide automatic server discovery using IP multicast.
  75. %track
  76. prog ntp = {
  77. version = %{version}
  78. url = ftp://ftp.udel.edu/pub/ntp/ntp4/
  79. regex = ntp-(\d+\.\d+\.\d+(p\d+)?)\.tar\.gz
  80. }
  81. %prep
  82. %setup -q
  83. %setup -q -T -D -a 1
  84. %patch -p0
  85. %build
  86. # configure program
  87. ( case "%{l_platform -t}" in
  88. *-netbsd* ) echo "ac_cv_header_sys_soundcard_h=no" >>config.cache ;;
  89. esac
  90. ) >config.cache
  91. %{l_shtool} subst \
  92. -e 's;\(CFLAGS="$CFLAGS -W.*\);#\1;g' \
  93. configure
  94. AUTOCONF=true \
  95. AUTOMAKE=true \
  96. ACLOCAL=true \
  97. AUTOHEADER=true \
  98. CC="%{l_cc}" \
  99. CFLAGS="%{l_cflags -O}" \
  100. LDFLAGS="%{l_fsl_ldflags}" \
  101. LIBS="%{l_fsl_libs}" \
  102. ./configure \
  103. --cache-file=./config.cache \
  104. --prefix=%{l_prefix} \
  105. %if "%{with_sntp}" == "yes"
  106. --with-sntp \
  107. %endif
  108. %if "%{with_local}" == "yes"
  109. --enable-LOCAL-CLOCK \
  110. %endif
  111. %if "%{with_crypto}" == "yes"
  112. --with-crypto \
  113. --with-openssl-libdir=%{l_prefix}/lib \
  114. --with-openssl-incdir=%{l_prefix}/include \
  115. %else
  116. --without-crypto \
  117. --without-openssl-libdir \
  118. --without-openssl-incdir \
  119. %endif
  120. --enable-ntpdate-step
  121. %{l_shtool} subst \
  122. -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1%{l_prefix}/etc/ntp/ntp.conf;' \
  123. include/ntp_config.h ntpdate/ntptime_config.c
  124. # build program
  125. %{l_make} %{l_mflags -O}
  126. %install
  127. # install program
  128. rm -rf $RPM_BUILD_ROOT
  129. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  130. # install manual pages
  131. ( cd ntp-doc
  132. %{l_shtool} mkdir -f -p -m 755 \
  133. $RPM_BUILD_ROOT%{l_prefix}/man/man5
  134. %{l_shtool} install -c -m 644 \
  135. *.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/
  136. %{l_shtool} mkdir -f -p -m 755 \
  137. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  138. %{l_shtool} install -c -m 644 *.8 \
  139. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  140. ) || exit $?
  141. # install default configuration
  142. %{l_shtool} mkdir -f -p -m 755 \
  143. $RPM_BUILD_ROOT%{l_prefix}/etc/ntp
  144. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  145. %{SOURCE ntp.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ntp/
  146. # post-adjust installation
  147. %{l_shtool} mkdir -f -p -m 755 \
  148. $RPM_BUILD_ROOT%{l_prefix}/var/ntp/ntpd.stat
  149. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  150. # install run-command script
  151. %{l_shtool} mkdir -f -p -m 755 \
  152. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  153. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  154. %{SOURCE rc.ntp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  155. # install OSSP fsl configuration
  156. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  157. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  158. %{SOURCE fsl.ntp} \
  159. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  160. # determine installation files
  161. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  162. %{l_files_std} \
  163. '%not %dir %{l_prefix}/etc/fsl' \
  164. '%config %{l_prefix}/etc/fsl/fsl.ntp' \
  165. '%config %{l_prefix}/etc/ntp/ntp.conf'
  166. %files -f files
  167. %clean
  168. rm -rf $RPM_BUILD_ROOT
  169. %post
  170. # after upgrade, restart service
  171. [ $1 -eq 2 ] || exit 0
  172. eval `%{l_rc} ntp status 2>/dev/null`
  173. [ ".$ntp_active" = .yes ] && %{l_rc} ntp restart
  174. exit 0
  175. %preun
  176. # before erase, stop service and remove log files
  177. [ $1 -eq 0 ] || exit 0
  178. %{l_rc} ntp stop 2>/dev/null
  179. rm -f $RPM_INSTALL_PREFIX/var/ntp/ntp.log* >/dev/null 2>&1 || true
  180. exit 0