File ntop.spec of Package ntop

#
# spec file for package ntop (Version 3.3)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           ntop
BuildRequires:  dos2unix freetype2-devel gcc-c++ gd-devel gdbm-devel libart_lgpl-devel libjpeg-devel libpng-devel lsof mysql-devel net-snmp-devel openssl-devel readline-devel
%if 0%{?suse_version}
BuildRequires: xorg-x11-devel tcpd-devel
PreReq:         /bin/cat %fillup_prereq %insserv_prereq sysconfig
%if 0%{?suse_version} > 1020
BuildRequires: rrdtool-devel libpcap-devel fdupes 
%else
BuildRequires: rrdtool libpcap 
%endif
%else 
%if 0%{?fedora_version}
PreReq:         /bin/cat /sbin/insserv /bin/fillup sysconfig
BuildRequires: xorg-x11-devel rrdtool-devel libpcap-devel
%else
%if 0%{?mandriva_version}
BuildRequires: rrdtool libpcap-devel librrdtool-devel
PreReq:         /bin/cat /sbin/insserv /bin/fillup sysconfig
%endif
%endif
%endif
License:        GPL v2 or later
Group:          Productivity/Networking/Diagnostic
Autoreqprov:    on
Version:        3.3
Release:        3
Summary:        Web-Based Network Traffic Monitor
Source:         %{name}-%{version}.tar.bz2
Source2:        rcntop
Source3:        rc.config.ntop
Source4:        passcheck.c
Source5:        README.SuSE
Patch:          ntop-%{version}.diff
Patch2:         rrdPlugin.diff
Patch4:         dotpath.diff
Patch5:         libtool.diff
URL:            http://www.ntop.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Ntop is a Web-based traffic monitor that shows network usage. It can be
used in both interactive or Web mode using the embedded Web server.



Authors:
--------
    Luca Deri <deri@ntop.org>

%prep
%setup -q -n %{name}-%{version}
%patch
%patch2
%patch4
%patch5

%build
%{?suse_update_config:%{suse_update_config -f gdchart* ntop . }}
# ntop wants to setup the files for the newer autoconf itself:
aclocal
./autogen.sh
# NTOP_AUTOREBUILD=yes ./configure || echo "new autoconf prepared"
# now we are ready for the real configure...
%if "%(xft-config --prefix)" == "/usr"
CFLAGS="$RPM_OPT_FLAGS -DHAVE_NCURSES_H" \
./configure \
	--sysconfdir=/etc		\
	--prefix=/usr 			\
        --mandir=%{_mandir} 		\
        --localstatedir=/var/lib 	\
        --libdir=%{_libdir}		\
	--datadir=%{_datadir}		\
	--x-libraries=/usr/%_lib	\
	--disable-static 		\
	--enable-sslv3			\
	--enable-i18n
%else
CFLAGS="$RPM_OPT_FLAGS -DHAVE_NCURSES_H -L/usr/X11R6/%_lib -I/usr/X11R6/include" \
./configure \
	--sysconfdir=/etc		\
	--prefix=/usr 			\
        --mandir=%{_mandir} 		\
        --localstatedir=/var/lib 	\
        --libdir=%{_libdir}		\
	--datadir=%{_datadir}		\
	--x-libraries=/usr/X11R6/%_lib	\
	--disable-static 		\
	--enable-sslv3			\
	--enable-i18n
%endif
make %{?jobs:-j%jobs}
gcc -o passcheck $RPM_OPT_FLAGS %{SOURCE4} -lgdbm

%install
# remove old (pre SuSE Linux 7.0) README.Suse provided by ntop
rm -f docs/README.Suse
mkdir -p $RPM_BUILD_ROOT/etc
DESTDIR=$RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT
# use the relinked librrdPlugin.so instead of the copied plugin
cp $RPM_BUILD_ROOT%{_libdir}/librrdPlugin.so \
   $RPM_BUILD_ROOT%{_libdir}/ntop/plugins/rrdPlugin.so
# rm $RPM_BUILD_ROOT%{_libdir}/ntop/plugins/rrdPlugin.so
make install-man DESTDIR=$RPM_BUILD_ROOT
make install-data-as DESTDIR=$RPM_BUILD_ROOT
chmod 644 $RPM_BUILD_ROOT/etc/ntop/oui.txt.gz
chmod 644 $RPM_BUILD_ROOT/etc/ntop/specialMAC.txt.gz
install -d $RPM_BUILD_ROOT/etc/init.d/
install -d $RPM_BUILD_ROOT/usr/sbin/
install -d $RPM_BUILD_ROOT/var/adm/fillup-templates/
install -m 755  %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d/ntop
ln -sf ../../etc/init.d/ntop $RPM_BUILD_ROOT/usr/sbin/rcntop
install -m 644  %{SOURCE3} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.ntop
install -m 755 passcheck $RPM_BUILD_ROOT/usr/sbin/passcheck
mkdir -p $RPM_BUILD_ROOT/var/lib/ntop
cp ntop-cert.pem docs/
cp %SOURCE5 .
find $RPM_BUILD_ROOT/usr/share/ntop/html -type f -print0 | xargs -0 chmod 644

%if 0%{?suse_version} > 1020
%fdupes $RPM_BUILD_ROOT/usr/share/ntop/html/
%endif
find $RPM_BUILD_ROOT -name "*.la" | xargs rm
rm docs/ntop-autotools.vsd
dos2unix docs/RedHat-rpmbuild-HOWTO.txt

%post
# Are we in update mode?
if [ ${1:-0} -gt 1 ]; then
	if [ -f etc/sysconfig/ntopd -a ! -L etc/sysconfig/ntopd ]; then
		echo "Renaming config file ntopd to ntop"
		mv etc/sysconfig/ntopd etc/sysconfig/ntop
	fi
fi
chown wwwrun:www /usr/share/ntop /var/lib/ntop
%if 0%{?suse_version} > 1010
etc/sysconfig/network/scripts/hwdesc2iface etc/sysconfig/ntop NTOPD_IFACE
%endif
/sbin/ldconfig
%{fillup_and_insserv -n ntop ntop }

%postun
/sbin/ldconfig
%{insserv_cleanup}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc docs/* AUTHORS CONTENTS COPYING ChangeLog MANIFESTO NEWS PORTING
%doc SUPPORT_NTOP.txt THANKS README.SuSE
%config /etc/init.d/ntop
/usr/bin/ntop
%{_libdir}/lib*.so
/usr/sbin/rcntop
/usr/sbin/passcheck
%dir %attr(-,wwwrun,www) /usr/share/ntop
/usr/share/ntop/html
%dir %{_libdir}/ntop
%{_libdir}/ntop/plugins
%{_mandir}/man8/ntop.8.*
/var/adm/fillup-templates/sysconfig.ntop
%dir %attr(-,wwwrun,www) /var/lib/ntop
%dir /etc/ntop
/etc/ntop/ntop-cert.pem
/etc/ntop/AS-list.txt.gz
/etc/ntop/etter.finger.os.gz
/etc/ntop/oui.txt.gz
/etc/ntop/p2c.opt.table.gz
/etc/ntop/specialMAC.txt.gz
 

%changelog
* Tue Aug 07 2007 - bg@suse.de
- remove first (wrong) definition of free
* Wed Aug 01 2007 - bg@suse.de
- update to version 3.3 (mainly bugfixes and automake changes)
- fix some rpmlint warnings
* Thu Jul 26 2007 - prusnak@suse.cz
- changed libpcap to libpcap-devel in BuildRequires
* Thu Jun 21 2007 - dmueller@suse.de
- update BuildRequires
* Tue May 08 2007 - schwab@suse.de
- Fix default location of dot.
* Mon Mar 26 2007 - rguenther@suse.de
- add gdbm-devel BuildRequires.
* Tue Nov 07 2006 - ro@suse.de
- fix docu permissions
* Mon Sep 11 2006 - schwab@suse.de
- Workaround lack of datarootdir support.
* Tue Apr 04 2006 - bg@suse.de
- removing files ntop_darwin.[ch] (Bug #161809)
- fixing user/group (Bug #140309)
* Mon Mar 20 2006 - bg@suse.de
- fix initialization of formatBuf (Bug #159477)
* Thu Jan 26 2006 - bg@suse.de
- fix bug #145502 (coding problems uncovered by new compiler)
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Sun Jan 15 2006 - schwab@suse.de
- Don't strip binaries.
* Mon Dec 12 2005 - bg@suse.de
- upgrade to version 3.2
- fix several compiler complaints
* Thu Oct 06 2005 - ro@suse.de
- matched number of arguments to printf formats
* Fri Sep 09 2005 - bg@suse.de
- removing execute permissions on gz files (Bug #114849)
* Mon Aug 29 2005 - bg@suse.de
- update to 3.1.50, recent version did not come up anymore.
  (Bug #113816)
* Mon Apr 25 2005 - mmj@suse.de
- Correct memset call
* Fri Apr 01 2005 - mmj@suse.de
- Don't return random data
* Mon Mar 21 2005 - schwab@suse.de
- Convert configuration name to interface name in start script.
* Fri Mar 04 2005 - bg@suse.de
- passcheck has to be called as root with the new version
* Tue Feb 08 2005 - bg@suse.de
- update to version 3.1
- adopt fixes from older version
- fix make install
- make passcheck not segfault on failure of open password database
* Thu Oct 07 2004 - bg@suse.de
- fix and remove -fno-strict-aliasing
* Fri Sep 24 2004 - bg@suse.de
- fix traffic data collection (Bug #43815)
* Mon Sep 06 2004 - bg@suse.de
- update to version 3.0.53
- rename ntop to rcntop to avoid conflict with directory name
- fix bug #41690
* Wed Sep 01 2004 - mmj@suse.de
- Move the mail to root into a README.SuSE where it belongs [#44349]
* Tue Jun 01 2004 - ro@suse.de
- fix build for ppc64
* Wed Mar 31 2004 - bg@suse.de
- update to version 3.0
- remove --ignore-sigpipe (not available anymore)
* Tue Mar 30 2004 - mmj@suse.de
- Add --ignore-sigpipe to default arguments [#37576]
- Clean up initscript and add missing sections (thanks lmuelle)
- Compile with -fno-strict-aliasing
* Tue Jan 20 2004 - bg@suse.de
- fixed comment in rc.config.ntop (Bug 33701)
- fixed build
* Sat Jan 10 2004 - adrian@suse.de
- build as user
* Wed Aug 20 2003 - bg@suse.de
- add activation metatdata (Bug #28909)
* Wed Jul 30 2003 - meissner@suse.de
- remove libtool.m4 from acinclude.m4, autoreconf.
- fixed dependencies of rrdPlugin, so that it loads and
  you can see nice pie charts etc.
- reenabled thomas security patch, which was disabled upstream.
* Mon Jul 28 2003 - meissner@suse.de
- Upgraded to 2.2c, removed intop again. Added rrdtool to nfb.
* Thu Jun 19 2003 - meissner@suse.de
- Upgraded to 2.2, build and add intop, added missing files.
* Mon Feb 24 2003 - meissner@suse.de
- Fixed ppc64 build by sed hack (autoreconf does not work)
- buildrooted.
* Mon Feb 10 2003 - bg@suse.de
- update to version 2.1.56
* Wed Sep 18 2002 - bg@suse.de
- added check program for admin user
- rename of config file when updateing (Bug #19814)
- removed (very old) README.Suse (Bug #16852)
* Tue Aug 06 2002 - ro@suse.de
- added missing prereqs
* Tue Aug 06 2002 - bg@suse.de
- upgrade to version 2.1.2
- fixed init script for new version
- change default port binding
* Sat Jul 27 2002 - adrian@suse.de
- fix neededforbuild
* Fri Jul 12 2002 - bg@suse.de
- upgrade to version 2.1.0
- split up diff
- fixed configure.in of new version
- enabled mysql
- renamed ntopd to ntop according to useful LSB names
* Wed Apr 17 2002 - bg@suse.de
- fix build for s390x
* Fri Mar 15 2002 - ro@suse.de
- update to 2.0.1 for security fix
- fixed configure.in in gdchart to use system libraries
- run as user wwwrun (parameter -u wwwrun in startscript)
- fix segfault in nfsPlugin.c
* Fri Mar 01 2002 - pthomas@suse.de
- Correct notification mail.
* Fri Feb 01 2002 - ro@suse.de
- changed neededforbuild <libpng> to <libpng-devel-packages>
* Mon Jan 21 2002 - ro@suse.de
- moved variables to sysconfig/ntopd
* Thu Jan 10 2002 - egmont@suselinux.hu
- changed /sbin/init.d to /etc/init.d in init script comment
* Tue Jan 08 2002 - bg@suse.de
- update to version 2.0
- using system libraries instead of delivered (libz, libpng, libgd)
* Wed Nov 14 2001 - ro@suse.de
- hack for automake 1.5
* Wed Jul 18 2001 - uli@suse.de
- fixed OS ident via nmap
* Thu Jul 05 2001 - bg@suse.de
- fix Bug #9056
- add ucdsnmp and ssl
- activate gdchart
* Mon Jun 11 2001 - bg@suse.de
- moved AC_INIT to the beginning of configure.in
* Wed May 09 2001 - mfabian@suse.de
- bzip2 sources
* Fri Feb 23 2001 - ro@suse.de
- added readline/readline-devel to neededforbuild (split from bash)
* Fri Dec 01 2000 - ro@suse.de
- moved startscript to etc
* Fri Nov 24 2000 - bg@suse.de
- cleaned up specfile with ro
* Thu Nov 23 2000 - bg@suse.de
- removed runlevel links in ntop.spec
- fixed init script for 7.1
* Fri Nov 10 2000 - bg@suse.de
- new verion 1.3.2
  this fixes Bug #4121
* Fri Oct 13 2000 - kukuk@suse.de
- fix compiling with glibc 2.2
* Mon Aug 28 2000 - ro@suse.de
- cvs-update of 2000/08/28 (all patches included)
* Tue Aug 15 2000 - ro@suse.de
- update to cvs version of 2000/08/15
* Tue Aug 15 2000 - ro@suse.de
- removed deprecated referring to .ntop
* Wed Jul 05 2000 - ro@suse.de
- fixed another segfault
* Fri Jun 30 2000 - ro@suse.de
- added fix for segfault from cvs
* Tue Jun 27 2000 - ro@suse.de
- update to 1.3.1
* Sat Mar 04 2000 - uli@suse.de
- moved man page to %%{_mandir}
* Thu Jan 13 2000 - freitag@suse.de
- dropped own libpcap and use one in needforbuild
- update to version 1.1
- using configure instead of own Makefile
- new tags in specfile like version
* Mon Sep 13 1999 - bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Sat Jun 12 1999 - ray@suse.de
- fix in init-script
* Tue Dec 01 1998 - ray@suse.de
- new package

openSUSE Build Service is sponsored by