michael@719: ## michael@719: ## ntp.spec -- OpenPKG RPM Package Specification michael@719: ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. michael@719: ## michael@719: ## Permission to use, copy, modify, and distribute this software for michael@719: ## any purpose with or without fee is hereby granted, provided that michael@719: ## the above copyright notice and this permission notice appear in all michael@719: ## copies. michael@719: ## michael@719: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@719: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@719: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@719: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@719: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@719: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@719: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@719: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@719: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@719: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@719: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@719: ## SUCH DAMAGE. michael@719: ## michael@719: michael@719: # package version michael@719: %define V_major 4 michael@719: %define V_minor 2 michael@719: %define V_micro 6p5 michael@719: michael@719: # package information michael@719: Name: ntp michael@719: Summary: Network Time Protocol (NTP) Daemon michael@719: URL: http://www.ntp.org/ michael@719: Vendor: David L. Mills michael@719: Packager: OpenPKG Foundation e.V. michael@719: Distribution: OpenPKG Community michael@719: Class: CORE michael@719: Group: Network michael@719: License: BSD-style michael@719: Version: %{V_major}.%{V_minor}.%{V_micro} michael@720: Release: 20120800 michael@719: michael@719: # package options michael@719: %option with_fsl yes michael@719: %option with_crypto yes michael@719: %option with_sntp yes michael@719: %option with_local yes michael@719: michael@719: # list of sources michael@719: Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp%{V_major}/ntp-%{version}.tar.gz michael@719: Source1: ntp-doc.tar.gz michael@719: Source2: ntp.conf michael@719: Source3: rc.ntp michael@719: Source4: fsl.ntp michael@719: michael@719: # build information michael@719: BuildPreReq: OpenPKG, openpkg >= 20100101, make michael@719: PreReq: OpenPKG, openpkg >= 20100101 michael@719: %if "%{with_fsl}" == "yes" michael@719: BuildPreReq: fsl michael@719: PreReq: fsl michael@719: %endif michael@719: %if "%{with_crypto}" == "yes" michael@719: BuildPreReq: openssl, gcc michael@719: PreReq: openssl michael@719: %endif michael@719: michael@719: %description michael@719: The Network Time Protocol (NTP) is used to synchronize the time michael@719: of a computer client or server to another server or reference michael@719: time source, such as a radio or satellite receiver or modem. It michael@719: provides accuracies typically within a millisecond on LANs and michael@719: up to a few tens of milliseconds on WANs relative to Coordinated michael@719: Universal Time (UTC) via a Global Positioning Service (GPS) michael@719: receiver, for example. Typical NTP configurations utilize multiple michael@719: redundant servers and diverse network paths in order to achieve high michael@719: accuracy and reliability. Some configurations include cryptographic michael@719: authentication to prevent accidental or malicious protocol attacks michael@719: and some provide automatic server discovery using IP multicast. michael@719: michael@719: %track michael@719: prog ntp = { michael@719: version = %{version} michael@719: url = http://www.ntp.org/downloads.html michael@719: regex = ntp-(\d+\.\d+\.\d+(p\d+)?)\.tar\.gz michael@719: } michael@719: michael@719: %prep michael@719: %setup -q michael@719: %setup -q -T -D -a 1 michael@720: %{l_shtool} subst \ michael@720: -e 's;# if defined(HAVE_TIMER_CREATE) && \(defined(HAVE_TIMER_SETTIME)\);#if \1;g' \ michael@720: ntpd/ntp_timer.c michael@719: michael@719: %build michael@719: # configure program michael@719: ( case "%{l_platform -t}" in michael@719: *-netbsd* ) echo "ac_cv_header_sys_soundcard_h=no" >>config.cache ;; michael@719: esac michael@719: ) >config.cache michael@719: %{l_shtool} subst \ michael@719: -e 's;\(CFLAGS="$CFLAGS -W.*\);#\1;g' \ michael@719: configure michael@719: AUTOCONF=true \ michael@719: AUTOMAKE=true \ michael@719: ACLOCAL=true \ michael@719: AUTOHEADER=true \ michael@719: CC="%{l_cc}" \ michael@719: CFLAGS="%{l_cflags -O}" \ michael@719: LDFLAGS="%{l_fsl_ldflags}" \ michael@719: %if "%{with_crypto}" == "yes" michael@719: LIBS="%{l_fsl_libs} -lcrypto" \ michael@719: %else michael@719: LIBS="%{l_fsl_libs}" \ michael@719: %endif michael@719: ./configure \ michael@719: --cache-file=./config.cache \ michael@719: --prefix=%{l_prefix} \ michael@719: --mandir=%{l_prefix}/man \ michael@719: %if "%{with_sntp}" == "yes" michael@719: --with-sntp \ michael@719: %endif michael@719: %if "%{with_local}" == "yes" michael@719: --enable-LOCAL-CLOCK \ michael@719: %endif michael@719: %if "%{with_crypto}" == "yes" michael@719: --with-crypto \ michael@719: --with-openssl-libdir=%{l_prefix}/lib \ michael@719: --with-openssl-incdir=%{l_prefix}/include \ michael@719: %else michael@719: --without-crypto \ michael@719: --without-openssl-libdir \ michael@719: --without-openssl-incdir \ michael@719: %endif michael@719: --enable-ntpdate-step \ michael@719: --without-lineeditlibs \ michael@719: --without-net-snmp-config \ michael@719: --without-ntpsnmpd michael@719: %{l_shtool} subst \ michael@719: -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1%{l_prefix}/etc/ntp/ntp.conf;' \ michael@719: include/ntp_config.h ntpdate/ntptime_config.c michael@719: michael@719: # build program michael@719: %{l_make} %{l_mflags -O} michael@719: michael@719: %install michael@719: # install program michael@719: %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" michael@719: michael@719: # install manual pages michael@719: ( cd ntp-doc michael@719: %{l_shtool} mkdir -f -p -m 755 \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/man/man5 michael@719: %{l_shtool} install -c -m 644 \ michael@719: *.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/ michael@719: %{l_shtool} mkdir -f -p -m 755 \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/man/man8 michael@719: %{l_shtool} install -c -m 644 *.8 \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/man/man8/ michael@719: ) || exit $? michael@719: michael@719: # install default configuration michael@719: %{l_shtool} mkdir -f -p -m 755 \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/etc/ntp michael@719: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@719: %{SOURCE ntp.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ntp/ michael@719: michael@719: # post-adjust installation michael@719: %{l_shtool} mkdir -f -p -m 755 \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/var/ntp/ntpd.stat michael@719: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true michael@719: michael@719: # install run-command script michael@719: %{l_shtool} mkdir -f -p -m 755 \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@719: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@719: %{SOURCE rc.ntp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@719: michael@719: # install OSSP fsl configuration michael@719: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@719: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@719: %{SOURCE fsl.ntp} \ michael@719: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@719: michael@719: # determine installation files michael@719: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@719: %{l_files_std} \ michael@719: '%config %{l_prefix}/etc/fsl/fsl.ntp' \ michael@719: '%config %{l_prefix}/etc/ntp/ntp.conf' michael@719: michael@719: %files -f files michael@719: michael@719: %clean michael@719: michael@719: %post michael@719: # after upgrade, restart service michael@719: [ $1 -eq 2 ] || exit 0 michael@719: eval `%{l_rc} ntp status 2>/dev/null` michael@719: [ ".$ntp_active" = .yes ] && %{l_rc} ntp restart michael@719: exit 0 michael@719: michael@719: %preun michael@719: # before erase, stop service and remove log files michael@719: [ $1 -eq 0 ] || exit 0 michael@719: %{l_rc} ntp stop 2>/dev/null michael@719: rm -f $RPM_INSTALL_PREFIX/var/ntp/ntp.log* >/dev/null 2>&1 || true michael@719: exit 0 michael@719: