File dba-net-snmp-5721-static.spec of Package dba-net-snmp-5721-static

%define maketest 0

%define real_name       net-snmp
%define version
%define vers            5721
%define prefix          /DBA/net-snmp/%{version}
%define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib)
%define perl_vendorarch %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)
%define dbassl	1

Name:           dba-%{real_name}-%{vers}-static
Summary:        SNMP Daemon
Version:        %{version}
Release:        1
Group:          Productivity/Networking/Other
License:        BSD-3-Clause and MIT
Source:         %{real_name}-%{version}.tar.gz
Source1:        rc.snmpd
Source2:        snmpd.conf
Source3:        README.SUSE
Source4:        rc.snmptrapd
Source5:        net-snmp.logrotate
Source6:        test_installed
Source7:        net-snmp.sysconfig
Source8:        net-snmp-rpmlintrc
Source9:        baselibs.conf
Source12:	%{real_name}-rpmlintrc
Patch1:         net-snmp-5.7.2-socket-path.patch
Patch2:         net-snmp-5.7.2-testing-empty-arptable.patch
Patch3:         net-snmp-5.7.2-pie.patch
Patch5:         net-snmp-5.7.2-net-snmp-config-headercheck.patch
Patch6:         net-snmp-5.7.2-perl-tk-warning.patch
Patch7:         net-snmp-5.7.2-velocity-mib.patch
Patch8:         net-snmp-5.7.2-build-fix-for-strlcat.patch
Patch23:        net-snmp-5.7.2-fix-snmpd-crashing-when-an-agentx-disconnects.patch
BuildRoot:      %{_tmppath}/%{real_name}-%{version}-build

%define _use_internal_dependency_generator 0
%define __find_requires %{SOURCE10}

%if 0%{?suse_version} >= 1110
BuildRequires:  -post-build-checks

#!BuildIgnore:  dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-101e dba-openssl-101f dba-openssl-101g perl-ExtUtils-MakeMaker

%if %{dbassl}
BuildRequires:  dba-openssl-102h-static
%define sslpath /DBA/openssl/1.0.2h
#!BuildIgnore:  openssl-devel
BuildRequires:  openssl-devel

BuildRequires:  rpm-devel
BuildRequires:  mysql-devel
BuildRequires:  postgresql-devel
BuildRequires:  perl(ExtUtils::MakeMaker)

Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:

- An extensible agent for responding to SNMP queries including built-in
  support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
  SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.

This package was originally based on the CMU snmp code. It was
renamed from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp
to net-snmp in November 2000.

    Wes Hardaker <>

%setup -q -n %{real_name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%if 0%{?suse_version} >= 1300
%patch9 -p1
%patch23 -p1

%{__chmod} +x %{SOURCE10}

MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \
      ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
      ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \
      ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable"

%if 0%{?netsnmp_with_sensors}
MIBS="$MIBS ucd-snmp/lmsensorsMib"

# export SECMOD="UDP TCP Unix Callback Alias AAL5PVC TLSTCP SSH"
export SECMOD="tsm"

%if %{dbassl}
export CFLAGS="$CFLAGS -I%{sslpath}/include"
# export LDFLAGS="$LDFLAGS -L%{sslpath}/lib -lssl -lcrypto"
export LDFLAGS="$LDFLAGS -L%{sslpath}/lib -ldl"

./configure \
        --prefix=%prefix \
	--with-sys-contact="root@localhost" \
	--with-sys-location="unknown" \
	--with-mib-modules="$MIBS" \
%if 0%{?rhel_version} == 406
	--with-cflags="%{optflags} -fPIC" \
	--with-cflags="%{optflags} -fPIC -fstack-protector-all" \
	--with-agentx-socket="%{netsnmp_agentx_socket_dir_fhs}/master" \
	--without-libwrap \
	--with-defaults \
	--disable-shared \
	--enable-static \
	--enable-as-needed \
%if %{dbassl}
    --with-openssl=%{sslpath} \
    --with-openssl \
	--without-root-access \
	--enable-local-smux \
	--enable-ipv6 \
	--with-transports="$TRANSP" \
	--with-security-modules="$SECMOD"  \
	--with-mysql \
	--disable-embedded-perl \

make %{?_smp_mflags}

%if %maketest
ulimit -c unlimited
%{__make} test ||:
%{__make} test TESTOPTS='-P tcp' ||:
LD_RUN_PATH="$PWD/snmplib/.libs" LD_LIBRARY_PATH="${PWD}/snmplib/.libs:${PWD}/agent/.libs:${PWD}/agent/helpers/.libs" %{__make} perltest ||:

%__rm -rf "%{buildroot}"

export NO_BRP_CHECK_RPATH=true
%{__make} install DESTDIR=${RPM_BUILD_ROOT}

# cleanup
find %{buildroot}%{prefix} -name "perllocal.pod" -o -name ".packlist" -o -name "*.la" |xargs -i rm -f {}
%__rm -rf %{buildroot}/usr

%__rm -f %{buildroot}%{prefix}/bin/ %{buildroot}%{prefix}/share/snmp/

%dir %{prefix}

* Thu Sep  8 2016 Holger Manthey <>
- fix suse maninstall
* Wed Sep  7 2016 Holger Manthey <>
- inital version