File cheops-ng.spec of Package cheops-ng

# norootforbuild

%if 0%sles_version == 10 || 0%suse_version == 1010
%define xpm_lib xorg-x11-devel
%else
%if 0%sles_version == 9
%define xpm_lib XFree86-devel
%else
%define xpm_lib xorg-x11-libXpm-devel
%endif
%endif

Summary:	Multipurpose network exploration tool
Name:		cheops-ng
Version:	0.2.3
Release:	1
License:	GPL
Group:		Networking/Other
Source0:	%{name}-%{version}.tar.bz2
Source1:	cheops-agent.init
Source2:        sysconfig.cheops-agent
Source3:        cheopsng-rpmlintrc
Patch:		%{name}-errno.patch
Patch1:         cheops-ng-missing_autoheader_templates.patch
Patch2:         cheops-ng-modernize_configure.patch
Patch3:         cheops-ng-use_external_libadns.patch
Patch4:         cheops-ng-rename_clog.patch
Patch5:         cheops-ng-pointer_int_casts.patch
Patch6:         cheops-ng-codecleanup.patch
Patch7:         cheops-ng-off_by_one.patch
Patch8:         cheops-ng-destdir.patch
Patch9:         cheops-ng-fix_desktop_file.patch
URL:		http://cheops-ng.sourceforge.net/
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:	gtk-devel bison flex gnome-libs-devel ORBit-devel libadns-devel
BuildRequires:	glib-devel libxml-devel %xpm_lib nmap imlib-devel
BuildRequires:  libjpeg-devel libnetpbm libpng-devel libtiff-devel giflib-devel update-desktop-files

%if 0%suse_version > 1020
BuildRequires:  fdupes libopenssl-devel
%else
BuildRequires:  openssl-devel
%endif
Requires:	nmap
PreReq:         %insserv_prereq %fillup_prereq

%description
Cheops-ng is a Network management tool for mapping and monitoring your network.
It has host/network discovery functionality as well as OS detection of hosts. 
Cheops-ng has the ability to probe hosts to see what services they are running.
On some services, cheops-ng is actually able to see what program is running for
a service and the version number of that program.

NB: Run cheops-agent as root to enable the backend.

%prep
%setup -q
%patch
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9

%build
%{?suse_update_config:%{suse_update_config -f}}
rm -f Makefile
aclocal -I m4
autoheader -I m4
autoconf -I m4
export CFLAGS="%{optflags}"
%configure
# make -j2 does not work
make XCFLAGS="%{optflags}"

%install
make DESTDIR=%{buildroot} install

mkdir -p %{buildroot}/%{_initrddir}
cp %{SOURCE1} %{buildroot}%{_initrddir}/cheops-agent
ln -s /etc/init.d/cheops-agent %{buildroot}%{_sbindir}/rccheops-agent

mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
%__install -m 644 %{S:2} %{buildroot}%{_localstatedir}/adm/fillup-templates

%__install -d %{buildroot}%{_datadir}/applications
mv %{buildroot}/%{_datadir}/gnome/apps/Internet/%{name}.desktop %{buildroot}%{_datadir}/applications/

%suse_update_desktop_file %name

%if 0%suse_version > 1020
%fdupes %buildroot
%endif

%clean
rm -rf %{buildroot}

%post
%fillup_and_insserv -y -n cheops-agent

%preun
%stop_on_removal cheops-agent

%postun
%restart_on_update cheops-agent
%insserv_cleanup

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog README doc/*
%{_bindir}/cheops-*
%{_sbindir}/cheops-*
%attr(755,root,root) %{_initrddir}/cheops-agent
%{_localstatedir}/adm/fillup-templates/*
%{_datadir}/pixmaps/%{name}.xpm
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_sbindir}/rccheops-agent

%changelog