%define perl_vendorarch_64 %(eval "`%{_bindir}/perl -V:installvendorarch`"; echo $installvendorarch) %define perl_vendorarch_32 %(eval "`%{_bindir}/perl_32 -V:installvendorarch`"; echo $installvendorarch) %define major_ver 5.8 Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: %{major_ver} Release: 3 License: BSD Group: System Environment/Daemons URL: http://net-snmp.sourceforge.net/ Source0: http://dl.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz Source1: http://dl.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz.asc Source2: net-snmpd.init Source3: net-snmptrapd.init Source4: net-snmpd.logrotate Source5: net-snmptrapd.example.conf Patch0: %{name}-5.7.2-aix.patch Patch1: 0001-perl-Including-.-in-INC.patch BuildRequires: coreutils, make Requires: libgcc >= 8.3.0 Requires: pcre >= 8.42-1 #Requires: openssl >= 1.0.2j-2 %description SNMP (Simple Network Management Protocol) is a protocol used for network management. The NET-SNMP project includes various SNMP tools: an extensible agent, an SNMP library, tools for requesting or setting information from SNMP agents, tools for generating and handling SNMP traps, a version of the netstat command which uses SNMP, and a Tk/Perl mib browser. This package contains the snmpd and snmptrapd daemons, documentation, etc. You will probably also want to install the net-snmp-utils package, which contains NET-SNMP utilities. %package utils Group: Applications/System Summary: Network management utilities using SNMP, from the NET-SNMP project Requires: %{name} = %{version}-%{release} Requires: libpcap >= 1.10.0 %description utils The net-snmp-utils package contains various utilities for use with the NET-SNMP network management project. Install this package if you need utilities for managing your network using the SNMP protocol. You will also need to install the net-snmp package. %package devel Group: Development/Libraries Summary: The development environment for the NET-SNMP project Requires: %{name} = %{version}-%{release} %description devel The net-snmp-devel package contains the development libraries and header files for use with the NET-SNMP project's network management tools. Install the net-snmp-devel package if you would like to develop applications for use with the NET-SNMP project's network management tools. You'll also need to have the net-snmp and net-snmp-utils packages installed. %package perl Group: Development/Libraries Summary: The perl NET-SNMP module and the mib2c tool BuildRequires: perl >= 5.34.1 Requires: %{name} = %{version}-%{release} Requires: perl >= 5.34.1 %description perl The net-snmp-perl package contains the perl files to use SNMP from within Perl. Install the net-snmp-perl package, if you want to use mib2c or SNMP with perl. %prep %setup -q %patch0 %patch1 -p1 # Duplicate source for 32 & 64 bits rm -rf /tmp/%{name}-%{version}-32bit mkdir /tmp/%{name}-%{version}-32bit mv * /tmp/%{name}-%{version}-32bit mkdir 32bit mv /tmp/%{name}-%{version}-32bit/* 32bit rm -rf /tmp/%{name}-%{version}-32bit mkdir 64bit cp -rp 32bit/* 64bit/ %build export CONFIG_SHELL=/usr/bin/ksh export CONFIG_ENV_ARGS=/usr/bin/ksh export PATH=/opt/freeware/bin:$PATH # these are the default MIBS MIBS="snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host" # define some additional MIBS to include MIBS="$MIBS smux ucd-snmp/diskio mibII/mta_sendmail" MIBS="$MIBS rmon-mib etherlike-mib" # first build the 64-bit version cd 64bit export CC="gcc -O2 -maix64" export OBJECT_MODE=64 export PERLPROG="/opt/freeware/bin/perl" ./configure \ --libdir=%{_libdir}64 \ --prefix=%{_prefix} \ --mandir=%{_mandir} \ --enable-shared \ --disable-static \ --without-kmem-usage \ --with-logfile="/var/log/snmpd.log" \ --with-persistent-directory="/var/%{name}" \ --with-mib-modules="$MIBS" \ --enable-ucd-snmp-compatibility \ --with-openssl \ --disable-embedded-perl \ --enable-ipv6 \ --enable-mfd-rewrites \ --enable-local-smux \ --with-default-snmp-version="3" \ --with-sys-location="Unknown" \ --with-sys-contact="root@localhost" make %{?smp_mflags} cd perl # Use just built libs for perl module building, not the system libs. export NETSNMP_DONT_CHECK_VERSION=1 /opt/freeware/bin/perl Makefile.PL -NET-SNMP-IN-SOURCE=true PREFIX=${RPM_BUILD_ROOT}/%{_prefix} INSTALLDIRS=vendor -NET-SNMP-CONFIG="sh ../../net-snmp-config" PERLPROG="$PERLPROG" PERL="$PERLPROG" /opt/freeware/bin/perl -pi -e 's/^LD_RUN_PATH.*//;s/LD_RUN_PATH=\".*\" //;' default_store/Makefile OID/Makefile agent/Makefile agent/default_store/Makefile ASN/Makefile SNMP/Makefile PERLPROG="$PERLPROG" PERL="$PERLPROG" make %{?smp_mflags} cd .. # Now build the 32-bit version cd ../32bit export CC="gcc -maix32 -O2 -D_LARGE_FILES" export LDFLAGS="-Wl,-bmaxdata:0x80000000" export OBJECT_MODE=32 export PERLPROG="/opt/freeware/bin/perl_32" ./configure \ --prefix=%{_prefix} \ --mandir=%{_mandir} \ --enable-shared \ --disable-static \ --without-kmem-usage \ --with-logfile="/var/log/snmpd.log" \ --with-persistent-directory="/var/%{name}" \ --with-mib-modules="$MIBS" \ --enable-ucd-snmp-compatibility \ --with-openssl \ --disable-embedded-perl \ --enable-ipv6 \ --enable-mfd-rewrites \ --enable-local-smux \ --with-default-snmp-version="3" \ --with-sys-location="Unknown" \ --with-sys-contact="root@localhost" make %{?smp_mflags} cd perl # Use just built libs for perl module building, not the system libs. export NETSNMP_DONT_CHECK_VERSION=1 /opt/freeware/bin/perl_32 Makefile.PL -NET-SNMP-IN-SOURCE=true PREFIX=${RPM_BUILD_ROOT}/%{_prefix} INSTALLDIRS=vendor -NET-SNMP-CONFIG="sh ../../net-snmp-config" /opt/freeware/bin/perl_32 -pi -e 's/^LD_RUN_PATH.*//;s/LD_RUN_PATH=\".*\" //;' default_store/Makefile OID/Makefile agent/Makefile agent/default_store/Makefile ASN/Makefile SNMP/Makefile make %{?smp_mflags} cd .. %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit export OBJECT_MODE=64 gmake install DESTDIR=${RPM_BUILD_ROOT} ( cd ${RPM_BUILD_ROOT}%{_libdir}64 for f in *.a ; do /usr/bin/ar -X64 -x ${f} done ) ( cd ${RPM_BUILD_ROOT}/%{_prefix}/bin for fic in $(ls -1| grep -v -e _32 -e _64) do mv $fic "$fic"_64 done ) ( cd ${RPM_BUILD_ROOT}/%{_prefix}/sbin for fic in $(ls -1| grep -v -e _32 -e _64) do mv $fic "$fic"_64 done ) cd perl gmake install_vendor DESTINSTALLVENDORMAN3DIR=${RPM_BUILD_ROOT}%{_mandir}/man3 eval $(/opt/freeware/bin/perl '-V:installvendorarch') # remove special files find ${RPM_BUILD_ROOT} -name perllocal.pod \ -o -name .packlist \ -o -name "*.bs" \ -o -name Makefile.subs.pl \ | xargs -i rm -f {} cd .. cd ../32bit export OBJECT_MODE=32 gmake install DESTDIR=${RPM_BUILD_ROOT} ( cd ${RPM_BUILD_ROOT}%{_libdir} for f in *.a ; do /usr/bin/ar -X32 -x ${f} done ) ( cd ${RPM_BUILD_ROOT}/%{_prefix}/bin for fic in $(ls -1| grep -v -e _32 -e _64) do mv $fic "$fic"_32 ln -sf "$fic"_64 $fic done ) ( cd ${RPM_BUILD_ROOT}/%{_prefix}/sbin for fic in $(ls -1| grep -v -e _32 -e _64) do mv $fic "$fic"_32 ln -sf "$fic"_64 $fic done ) /usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_bindir}/* || : %__mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp /opt/freeware/bin/install -m 644 EXAMPLE.conf ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmpd.conf /opt/freeware/bin/install -m 644 %{SOURCE5} ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmptrapd.conf %__mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/init.d /opt/freeware/bin/install -m 755 %{SOURCE2} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/snmpd /opt/freeware/bin/install -m 755 %{SOURCE3} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/snmptrapd %__mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/ %__mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/ ln -sf '../init.d/snmpd' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/Ssnmpd ln -sf '../init.d/snmpd' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/Ksnmpd ln -sf '../init.d/snmpd' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/Ssnmpd ln -sf '../init.d/snmpd' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/Ksnmpd ln -sf '../init.d/snmptrapd' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/Ssnmptrapd ln -sf '../init.d/snmptrapd' ${RPM_BUILD_ROOT}/etc/rc.d/rc2.d/Ksnmptrapd ln -sf '../init.d/snmptrapd' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/Ssnmptrapd ln -sf '../init.d/snmptrapd' ${RPM_BUILD_ROOT}/etc/rc.d/rc3.d/Ksnmptrapd %__mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d /opt/freeware/bin/install -m 644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/snmpd # copy missing mib2c.conf files cp local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp cd perl gmake install_vendor DESTINSTALLVENDORMAN3DIR=${RPM_BUILD_ROOT}%{_mandir}/man3 eval $(/opt/freeware/bin/perl_32 '-V:installvendorarch') # remove special files find ${RPM_BUILD_ROOT} -name perllocal.pod \ -o -name .packlist \ -o -name "*.bs" \ -o -name Makefile.subs.pl \ | xargs -i rm -f {} cd .. # trim down massive ChangeLog dd bs=1024 count=250 if=ChangeLog of=ChangeLog.trimmed %preun if [ "$1" = 0 ] then /etc/rc.d/init.d/snmpd stop /etc/rc.d/init.d/snmptrapd stop %__rm -f %{_datadir}/snmp/mibs/.index fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc 32bit/AGENT.txt 32bit/COPYING 32bit/ChangeLog.trimmed 32bit/EXAMPLE.conf 32bit/FAQ 32bit/NEWS 32bit/PORTING 32bit/README* 32bit/TODO %doc 32bit/local/passtest 32bit/local/README.mib2c 32bit/local/ipf-mod.pl %dir %{_sysconfdir}/snmp %dir %{_sysconfdir}/logrotate.d /etc/rc.d/init.d/snmpd /etc/rc.d/init.d/snmptrapd /etc/rc.d/rc2.d/Ssnmpd /etc/rc.d/rc2.d/Ksnmpd /etc/rc.d/rc3.d/Ssnmpd /etc/rc.d/rc3.d/Ksnmpd /etc/rc.d/rc2.d/Ssnmptrapd /etc/rc.d/rc2.d/Ksnmptrapd /etc/rc.d/rc3.d/Ssnmptrapd /etc/rc.d/rc3.d/Ksnmptrapd %config(noreplace) %{_sysconfdir}/logrotate.d/snmpd %config(noreplace,missingok) %{_sysconfdir}/snmp/snmpd.conf %config(noreplace,missingok) %{_sysconfdir}/snmp/snmptrapd.conf %{_datadir}/snmp %{_sbindir}/* %{_libdir}/lib*.a %{_libdir}64/lib*.a %{_libdir}/lib*.so* %{_libdir}64/lib*.so* %attr(0644,root,system) %{_mandir}/man[58]/* %files utils %defattr(-,root,system,-) %{_bindir}/encode_keychange* %{_bindir}/fixproc* %{_bindir}/ipf-mod.pl* %{_bindir}/mib2c-update* %{_bindir}/snmp* %{_bindir}/traptoemail* %attr(0644,root,system) %{_mandir}/man1/encode_keychange*.1* %attr(0644,root,system) %{_mandir}/man1/fixproc*.1* %attr(0644,root,system) %{_mandir}/man1/mib2c-update*.1* %attr(0644,root,system) %{_mandir}/man1/snmp*.1* %attr(0644,root,system) %{_mandir}/man1/traptoemail*.1* %files devel %defattr(0644,root,system) %{_includedir}/* %attr(0755,root,system) %{_bindir}/net-snmp-config* %attr(0644,root,system) %{_mandir}/man1/net-snmp-config.1 %attr(0644,root,system) %{_mandir}/man3/[a-z]*.3 %files perl %defattr(-,root,system) %{_bindir}/mib2c* %{_bindir}/tkmib* %{perl_vendorarch_32}/* %{perl_vendorarch_64}/* %attr(0644,root,system) %{_mandir}/man1/mib2c.1 %attr(0644,root,system) %{_mandir}/man1/tkmib.1 %attr(0644,root,system) %{_mandir}/man3/*SNMP*.3 %changelog * Thu May 05 2022 Reshma V Kumar - 5.8-3 - Rebuild with perl 5.34.1 - Stop shipping files in /usr directory * Mon Jul 6 2020 Reshma V Kumar - 5.8-2 - Build with perl 5.30.2 * Tue Aug 06 2019 Baanu Tumma - 5.8-1 - Update to 5.8 * Fri Sep 15 2017 Ravi Hirekurabar - 5.7.3-1 - Updated to 5.7.3 * Mon Nov 21 2016 Michael Perzl (michael@perzl.org) - 5.7.2-3 - recompiled against latest versions * Fri Mar 04 2016 Michael Perzl (michael@perzl.org) - 5.7.2-2 - recompiled against latest version of openssl * Sat Oct 20 2012 Michael Perzl (michael@perzl.org) - 5.7.2-1 - updated to version 5.7.2 * Thu Oct 13 2011 Michael Perzl (michael@perzl.org) - 5.7.1-1 - updated to version 5.7.1 * Sun Aug 21 2011 Michael Perzl (michael@perzl.org) - 5.7-1 - updated to version 5.7 * Wed Jul 06 2011 Michael Perzl (michael@perzl.org) - 5.6.1.1-1 - updated to version 5.6.1.1 * Wed Jul 06 2011 Michael Perzl (michael@perzl.org) - 5.5.1-1 - updated to version 5.5.1 * Wed Jul 06 2011 Michael Perzl (michael@perzl.org) - 5.4.4-1 - updated to version 5.4.4 * Tue Mar 29 2011 Michael Perzl (michael@perzl.org) - 5.4.1-2 - fixed some SPEC file issues * Thu Aug 09 2007 Michael Perzl (michael@perzl.org) - 5.4.1-1 - first version for AIX5L v5.3