ntp/ntp.spec

changeset 719
c1c586743518
child 720
7cbb7c0c025b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ntp/ntp.spec	Thu Oct 04 20:34:54 2012 +0200
     1.3 @@ -0,0 +1,204 @@
     1.4 +##
     1.5 +##  ntp.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package version
    1.28 +%define       V_major 4
    1.29 +%define       V_minor 2
    1.30 +%define       V_micro 6p5
    1.31 +
    1.32 +#   package information
    1.33 +Name:         ntp
    1.34 +Summary:      Network Time Protocol (NTP) Daemon
    1.35 +URL:          http://www.ntp.org/
    1.36 +Vendor:       David L. Mills
    1.37 +Packager:     OpenPKG Foundation e.V.
    1.38 +Distribution: OpenPKG Community
    1.39 +Class:        CORE
    1.40 +Group:        Network
    1.41 +License:      BSD-style
    1.42 +Version:      %{V_major}.%{V_minor}.%{V_micro}
    1.43 +Release:      20111226
    1.44 +
    1.45 +#   package options
    1.46 +%option       with_fsl     yes
    1.47 +%option       with_crypto  yes
    1.48 +%option       with_sntp    yes
    1.49 +%option       with_local   yes
    1.50 +
    1.51 +#   list of sources
    1.52 +Source0:      http://www.eecis.udel.edu/~ntp/ntp_spool/ntp%{V_major}/ntp-%{version}.tar.gz
    1.53 +Source1:      ntp-doc.tar.gz
    1.54 +Source2:      ntp.conf
    1.55 +Source3:      rc.ntp
    1.56 +Source4:      fsl.ntp
    1.57 +
    1.58 +#   build information
    1.59 +BuildPreReq:  OpenPKG, openpkg >= 20100101, make
    1.60 +PreReq:       OpenPKG, openpkg >= 20100101
    1.61 +%if "%{with_fsl}" == "yes"
    1.62 +BuildPreReq:  fsl
    1.63 +PreReq:       fsl
    1.64 +%endif
    1.65 +%if "%{with_crypto}" == "yes"
    1.66 +BuildPreReq:  openssl, gcc
    1.67 +PreReq:       openssl
    1.68 +%endif
    1.69 +
    1.70 +%description
    1.71 +    The Network Time Protocol (NTP) is used to synchronize the time
    1.72 +    of a computer client or server to another server or reference
    1.73 +    time source, such as a radio or satellite receiver or modem. It
    1.74 +    provides accuracies typically within a millisecond on LANs and
    1.75 +    up to a few tens of milliseconds on WANs relative to Coordinated
    1.76 +    Universal Time (UTC) via a Global Positioning Service (GPS)
    1.77 +    receiver, for example. Typical NTP configurations utilize multiple
    1.78 +    redundant servers and diverse network paths in order to achieve high
    1.79 +    accuracy and reliability. Some configurations include cryptographic
    1.80 +    authentication to prevent accidental or malicious protocol attacks
    1.81 +    and some provide automatic server discovery using IP multicast.
    1.82 +
    1.83 +%track
    1.84 +    prog ntp = {
    1.85 +        version   = %{version}
    1.86 +        url       = http://www.ntp.org/downloads.html
    1.87 +        regex     = ntp-(\d+\.\d+\.\d+(p\d+)?)\.tar\.gz
    1.88 +    }
    1.89 +
    1.90 +%prep
    1.91 +    %setup -q
    1.92 +    %setup -q -T -D -a 1
    1.93 +
    1.94 +%build
    1.95 +    #   configure program
    1.96 +    ( case "%{l_platform -t}" in
    1.97 +          *-netbsd* ) echo "ac_cv_header_sys_soundcard_h=no" >>config.cache ;;
    1.98 +      esac
    1.99 +    ) >config.cache
   1.100 +    %{l_shtool} subst \
   1.101 +        -e 's;\(CFLAGS="$CFLAGS -W.*\);#\1;g' \
   1.102 +        configure
   1.103 +    AUTOCONF=true \
   1.104 +    AUTOMAKE=true \
   1.105 +    ACLOCAL=true \
   1.106 +    AUTOHEADER=true \
   1.107 +    CC="%{l_cc}" \
   1.108 +    CFLAGS="%{l_cflags -O}" \
   1.109 +    LDFLAGS="%{l_fsl_ldflags}" \
   1.110 +%if "%{with_crypto}" == "yes"
   1.111 +    LIBS="%{l_fsl_libs} -lcrypto" \
   1.112 +%else
   1.113 +    LIBS="%{l_fsl_libs}" \
   1.114 +%endif
   1.115 +    ./configure \
   1.116 +        --cache-file=./config.cache \
   1.117 +        --prefix=%{l_prefix} \
   1.118 +        --mandir=%{l_prefix}/man \
   1.119 +%if "%{with_sntp}" == "yes"
   1.120 +        --with-sntp \
   1.121 +%endif
   1.122 +%if "%{with_local}" == "yes"
   1.123 +        --enable-LOCAL-CLOCK \
   1.124 +%endif
   1.125 +%if "%{with_crypto}" == "yes"
   1.126 +        --with-crypto \
   1.127 +        --with-openssl-libdir=%{l_prefix}/lib \
   1.128 +        --with-openssl-incdir=%{l_prefix}/include \
   1.129 +%else
   1.130 +        --without-crypto \
   1.131 +        --without-openssl-libdir \
   1.132 +        --without-openssl-incdir \
   1.133 +%endif
   1.134 +        --enable-ntpdate-step \
   1.135 +        --without-lineeditlibs \
   1.136 +        --without-net-snmp-config \
   1.137 +        --without-ntpsnmpd
   1.138 +    %{l_shtool} subst \
   1.139 +        -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1%{l_prefix}/etc/ntp/ntp.conf;' \
   1.140 +        include/ntp_config.h ntpdate/ntptime_config.c
   1.141 +
   1.142 +    #   build program
   1.143 +    %{l_make} %{l_mflags -O}
   1.144 +
   1.145 +%install
   1.146 +    #   install program
   1.147 +    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   1.148 +
   1.149 +    #   install manual pages
   1.150 +    ( cd ntp-doc
   1.151 +      %{l_shtool} mkdir -f -p -m 755 \
   1.152 +          $RPM_BUILD_ROOT%{l_prefix}/man/man5
   1.153 +      %{l_shtool} install -c -m 644 \
   1.154 +          *.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/
   1.155 +      %{l_shtool} mkdir -f -p -m 755 \
   1.156 +          $RPM_BUILD_ROOT%{l_prefix}/man/man8
   1.157 +      %{l_shtool} install -c -m 644 *.8 \
   1.158 +          $RPM_BUILD_ROOT%{l_prefix}/man/man8/
   1.159 +    ) || exit $?
   1.160 +
   1.161 +    #   install default configuration
   1.162 +    %{l_shtool} mkdir -f -p -m 755 \
   1.163 +        $RPM_BUILD_ROOT%{l_prefix}/etc/ntp
   1.164 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.165 +        %{SOURCE ntp.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ntp/
   1.166 +
   1.167 +    #   post-adjust installation
   1.168 +    %{l_shtool} mkdir -f -p -m 755 \
   1.169 +        $RPM_BUILD_ROOT%{l_prefix}/var/ntp/ntpd.stat
   1.170 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.171 +
   1.172 +    #   install run-command script
   1.173 +    %{l_shtool} mkdir -f -p -m 755 \
   1.174 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.175 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.176 +        %{SOURCE rc.ntp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.177 +
   1.178 +    #   install OSSP fsl configuration
   1.179 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   1.180 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.181 +        %{SOURCE fsl.ntp} \
   1.182 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   1.183 +
   1.184 +    #   determine installation files
   1.185 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.186 +        %{l_files_std} \
   1.187 +        '%config %{l_prefix}/etc/fsl/fsl.ntp' \
   1.188 +        '%config %{l_prefix}/etc/ntp/ntp.conf'
   1.189 +
   1.190 +%files -f files
   1.191 +
   1.192 +%clean
   1.193 +
   1.194 +%post
   1.195 +    #   after upgrade, restart service
   1.196 +    [ $1 -eq 2 ] || exit 0
   1.197 +    eval `%{l_rc} ntp status 2>/dev/null`
   1.198 +    [ ".$ntp_active" = .yes ] && %{l_rc} ntp restart
   1.199 +    exit 0
   1.200 +
   1.201 +%preun
   1.202 +    #   before erase, stop service and remove log files
   1.203 +    [ $1 -eq 0 ] || exit 0
   1.204 +    %{l_rc} ntp stop 2>/dev/null
   1.205 +    rm -f $RPM_INSTALL_PREFIX/var/ntp/ntp.log* >/dev/null 2>&1 || true
   1.206 +    exit 0
   1.207 +

mercurial