ntp/ntp.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 719
c1c586743518
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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

mercurial