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.

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

mercurial