File apache2-mod_snmp.spec of Package apache2-mod_snmp

#
# spec file for package apache2-mod_snmp
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2016 by Lars Vogdt
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define apxs %{_bindir}/apxs
%define apache apache2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
%define apache_serverroot %(%{apxs} -q PREFIX)
%define apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
%define apache_mmn   %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)

Name:           apache2-mod_snmp
Version:        1.05
Release:        0
Summary:        Mod_ap2_snmp is a DSO module for the apache Web server
License:        GPL-2.0+
Group:          Productivity/Networking/Web/Servers
Url:            http://mod-apache-snmp.sourceforge.net/
Source0:        mod_ap2_snmp_%{version}.tar.bz2
Source2:        mod_ap2_snmp.README.MDK.bz2
Source3:        mod_ap2_snmp.snmpd.conf.bz2
Patch:          mod_ap2_snmp_1.05-random_data.patch
BuildRequires:  apache2-devel
BuildRequires:  apache2-prefork
BuildRequires:  bzip2
BuildRequires:  file
BuildRequires:  net-snmp-devel
BuildRequires:  openssl-devel
## Requires:       %{apache_mmn}
Requires:       apache2
Requires:       net-snmp >= 5.2.1.2-3mdk
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This module allows you to monitor different configuration and
status values of Apache Web Server by SNMP (Simple Network
Management Protocol).

%package devel
Summary:        Development files for apache2-mod_snmp
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       apache2-devel
Requires:       net-snmp-devel
Requires:       openssl-devel

%description devel
This package contains the header files to build additional software
around apache2-mod_snmp.

%prep
%setup -q -T -c mod_ap2_snmp_%{version} -a0
%autopatch
bzcat %{SOURCE2} > README.SUSE
bzcat %{SOURCE3} > snmp.conf
find -name ".svn" | xargs rm -rf

# strip away annoying ^M
find . -type f|xargs file|grep 'CRLF'|cut -d: -f1|xargs perl -p -i -e 's/\r//'
find . -type f|xargs file|grep 'text'|cut -d: -f1|xargs perl -p -i -e 's/\r//'

%build
%{apxs} -c -I%{_includedir}/net-snmp -I%{_includedir}/apache2-event mod_ap2_snmp.c -lnetsnmp -lcrypto

%install
mkdir -p %{buildroot}%{apache_libexecdir}
install -m0755 .libs/*.so %{buildroot}%{apache_libexecdir}/
mkdir -p %{buildroot}%{apache_includedir}
cp -p *.h extra/*.h %{buildroot}%{apache_includedir}/
if [ -f mib/APACHE2-MIB.TXT ]; then
  mkdir -p %{buildroot}%{_datadir}/snmp/mib
  install -m644 mib/APACHE2-MIB.TXT %{buildroot}%{_datadir}/snmp/mib/
fi
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}/examples
install -m0644 AUTHORS COPYING README README.SUSE snmp.conf docs/* %{buildroot}%{_defaultdocdir}/%{name}/
cp -r extra/mrtg %{buildroot}%{_defaultdocdir}/%{name}/examples/


%files
%defattr(644,root,root,755)
%dir %{_defaultdocdir}/%{name}/examples
%dir %{_defaultdocdir}/%{name}
%doc %{_defaultdocdir}/%{name}/*
%{apache_libexecdir}/*.so
%{_datadir}/snmp/mib/

%files devel
%defattr(644,root,root,755)
%{apache_includedir}/*.h

%changelog
openSUSE Build Service is sponsored by