net-analyzer/net-snmp: cleanup

This commit is contained in:
Alarig Le Lay 2022-04-30 16:00:30 +02:00
parent 6fd0ce222b
commit e3497fce12
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC
18 changed files with 0 additions and 749 deletions

View file

@ -1,2 +0,0 @@
DIST net-snmp-5.7.3-patches-3.tar.xz 3176 BLAKE2B 1a71d6743afb841f664c6058e32c7c411af62b0f36acd3bb9251804893ed12f462a0c5bab828e309eeec7824def2dca8fa866350b90a62ec4f0df1141b51ecae SHA512 d8a91b9668320a1e19d062eb86dd4d16beb7c2d15ac7ebbb9d2a4bd298af39bbb0a2613504dbb0057cccdec731f08f2308c5a15395e1fbc29bb0611ed8aca636
DIST net-snmp-5.9.tar.xz 4082580 BLAKE2B 9dfd5a7dfe4ca18b16c71c9f5cb70c540d16aa36a0b2dacd3ddc465934f96ac473f77490af78d202bf6dad4eddea5d75665a770df74132aafda39f5f3a87d835 SHA512 3f1e27caa8e5306d451b61b08c2daf007929a850661962fcd29b528a80332a980184303a7e87c96d8d2774181758889dc825cb08e3c3b353c5e7ca1ebcc09173

View file

@ -1,15 +0,0 @@
POSIX requires <limits.h> for PATH_MAX and NAME_MAX
Author: Anthony G. Basile <blueness@gentoo.org>
diff -Naur net-snmp-5.7.3.orig/agent/mibgroup/util_funcs/get_pid_from_inode.c net-snmp-5.7.3/agent/mibgroup/util_funcs/get_pid_from_inode.c
--- net-snmp-5.7.3.orig/agent/mibgroup/util_funcs/get_pid_from_inode.c 2014-12-08 15:23:22.000000000 -0500
+++ net-snmp-5.7.3/agent/mibgroup/util_funcs/get_pid_from_inode.c 2018-02-21 15:34:06.237028136 -0500
@@ -6,6 +6,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <limits.h>
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif

View file

@ -1,34 +0,0 @@
--- a/net-snmp-config.in
+++ b/net-snmp-config.in
@@ -190,13 +190,13 @@
#################################################### client lib
--libs)
# use this one == --netsnmp-libs + --external-libs
- echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS
+ echo $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS
;;
--netsnmp-libs)
echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS
;;
--external-libs)
- echo $NSC_LDFLAGS $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@
+ echo $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@
;;
#################################################### agent lib
--base-agent-libs)
@@ -207,13 +207,13 @@
;;
--agent-libs)
# use this one == --netsnmp-agent-libs + --external-libs
- echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS
+ echo $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS
;;
--netsnmp-agent-libs)
echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS
;;
--external-agent-libs)
- echo $NSC_LDFLAGS $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS
+ echo $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS
;;
####################################################
--version|--ver*)

View file

@ -1,41 +0,0 @@
--- a/configure.d/config_project_with_enable
+++ b/configure.d/config_project_with_enable
@@ -1187,6 +1187,11 @@
[],
[with_bzip2="no"])
+AC_ARG_WITH([pcap],
+ [ --with-pcap[=DIR] use libpcap in DIR],
+ [],
+ [with_pcap="no"])
+
NETSNMP_ARG_WITH(
[mnttab],
AS_HELP_STRING(
--- a/configure.d/config_os_libs2
+++ b/configure.d/config_os_libs2
@@ -583,14 +590,16 @@
##
# libpcap
##
-NETSNMP_BUILD_PCAP_PROG_TRUE='#'
-NETSNMP_BUILD_PCAP_PROG_FALSE=''
-AC_CHECK_LIB([pcap], [pcap_create], [
- AC_CHECK_HEADERS([pcap/pcap.h], [
- NETSNMP_BUILD_PCAP_PROG_TRUE=''
- NETSNMP_BUILD_PCAP_PROG_FALSE='#'
- ])
-])
+if test "x$with_pcap" = "xyes" ; then
+ NETSNMP_BUILD_PCAP_PROG_TRUE='#'
+ NETSNMP_BUILD_PCAP_PROG_FALSE=''
+ AC_CHECK_LIB([pcap], [pcap_create], [
+ AC_CHECK_HEADERS([pcap/pcap.h], [
+ NETSNMP_BUILD_PCAP_PROG_TRUE=''
+ NETSNMP_BUILD_PCAP_PROG_FALSE='#'
+ ])
+ ])
+fi
AC_SUBST(NETSNMP_BUILD_PCAP_PROG_TRUE)
AC_SUBST(NETSNMP_BUILD_PCAP_PROG_FALSE)

View file

@ -1,30 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,8 @@
AC_MSG_CACHE_INIT()
+PKG_PROG_PKG_CONFIG
+
#
# save the configure arguments
#
--- a/configure.d/config_os_libs2
+++ b/configure.d/config_os_libs2
@@ -516,6 +516,8 @@
# mysql
##
if test "x$with_mysql" = "xyes" ; then
+ PKG_CHECK_MODULES([MYSQL],[mysqlclient],[MYSQL_INCLUDES="$MYSQL_CFLAGS"],)
+ if test -x "$MYSQL_LIBS"; then
AC_PATH_PROGS(MYSQLCONFIG,mysql_config)
test -x "$MYSQLCONFIG" \
|| AC_MSG_ERROR([Could not find mysql_config and was specifically asked to use MySQL support])
@@ -523,6 +525,7 @@
MYSQL_INCLUDES=`$MYSQLCONFIG --include`
_libs="${LIBS}"
_cppflags="${CPPFLAGS}"
+ fi
LIBS="${LIBS} ${MYSQL_LIBS}"
CPPFLAGS="${CPPFLAGS} ${MYSQL_INCLUDES}"
AC_CHECK_HEADER(mysql.h,,

View file

@ -1,37 +0,0 @@
--- a/net-snmp-config.in
+++ b/net-snmp-config.in
@@ -193,10 +193,10 @@
#################################################### client lib
--libs)
# use this one == --netsnmp-libs + --external-libs
- echo $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS
+ echo $NSC_SNMPLIBS $NSC_LIBS
;;
--netsnmp-libs)
- echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS
+ echo $NSC_BASE_SNMP_LIBS
;;
--external-libs)
echo $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@
@@ -210,10 +210,10 @@
;;
--agent-libs)
# use this one == --netsnmp-agent-libs + --external-libs
- echo $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS
+ echo $NSC_AGENTLIBS $NSC_LIBS
;;
--netsnmp-agent-libs)
- echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS
+ echo $NSC_BASE_AGENT_LIBS
;;
--external-agent-libs)
echo $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS
@@ -660,7 +660,7 @@
echo "Ack. Can't create $tmpfile."
exit 1
fi
- cmd="@CC@ $cflags @CFLAGS@ @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} -o $outname $tmpfile $cfiles $NSC_LDFLAGS $NSC_LIBDIR $NSC_BASE_AGENT_LIBS $NSC_AGENTLIBS $ldflags"
+ cmd="@CC@ $cflags @CFLAGS@ @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} -o $outname $tmpfile $cfiles $ldflags $NSC_LDFLAGS $NSC_BASE_AGENT_LIBS $NSC_AGENTLIBS"
echo "running: $cmd"
echo `$cmd`
result=$?

View file

@ -1,20 +0,0 @@
--- a/netsnmp-agent.pc.in
+++ b/netsnmp-agent.pc.in
@@ -8,5 +8,5 @@
URL: http://www.net-snmp.org
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
-Libs: -L${libdir} -lnetsnmpmibs -lnetsnmpagent -lnetsnmp
-Libs.private: @LDFLAGS@ @LMIBLIBS@ @LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@ @LNETSNMPLIBS@ @LIBS@
+Libs: -lnetsnmpmibs -lnetsnmpagent -lnetsnmp
+Libs.private: @LMIBLIBS@ @LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@ @LNETSNMPLIBS@ @LIBS@
--- a/netsnmp.pc.in
+++ b/netsnmp.pc.in
@@ -8,5 +8,5 @@
URL: http://www.net-snmp.org
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
-Libs: -L${libdir} -lnetsnmp
-Libs.private: @LDFLAGS@ @LNETSNMPLIBS@ @LIBS@ @PERLLDOPTS_FOR_APPS@
+Libs: -lnetsnmp
+Libs.private: @LNETSNMPLIBS@ @LIBS@ @PERLLDOPTS_FOR_APPS@

View file

@ -1,10 +0,0 @@
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -3,6 +3,7 @@
use ExtUtils::MakeMaker;
use Config;
require 5;
+use lib '.';
use MakefileSubs;
# Prevent that MakeMaker complains about unknown parameter names.

View file

@ -1,10 +0,0 @@
--- a/configure.d/config_os_libs2
+++ b/configure.d/config_os_libs2
@@ -601,6 +601,7 @@
[HAVE_LIBCURSES=FALSE],,
[LIBCURSES])
AC_SUBST([HAVE_LIBCURSES])
+NETSNMP_SEARCH_LIBS([cbreak], [tinfo],[LIBCURSES="$LIBCURSES -ltinfo"],,,)
AC_SUBST([LIBCURSES])
# libm for ceil

View file

@ -1,19 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Initial (empty) options.
SNMPD_FLAGS=""
# Disable smux by default
SNMPD_FLAGS="${SNMPD_FLAGS} -I -smux"
# Enable connection logging.
#SNMPD_FLAGS="${SNMPD_FLAGS} -a"
# Enable syslog and disable file log.
#SNMPD_FLAGS="${SNMPD_FLAGS} -Lsd -Lf /dev/null"
# Enable agentx socket as /var/agentx/master
# *NOTE* Before uncommenting this, make sure
# the /var/agentx directory exists.
#SNMPD_FLAGS="${SNMPD_FLAGS} -x /var/agentx/master"

View file

@ -1,34 +0,0 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
SNMPD_PIDFILE="${SNMPD_PIDFILE:-/var/run/snmpd.pid}"
extra_started_commands="reload"
command="/usr/sbin/snmpd"
command_args="-p ${SNMPD_PIDFILE} ${SNMPD_FLAGS}"
pidfile="${SNMPD_PIDFILE}"
depend() {
use logger
}
checkconfig() {
if [ ! -e /etc/snmp/snmpd.conf ] ; then
eerror "${SVCNAME} requires an /etc/snmp/snmpd.conf configuration file"
return 1
fi
}
start_pre() {
checkconfig || return 1
}
reload() {
checkconfig || return 1
ebegin "Reloading ${SVCNAME} configuration"
kill -HUP $(cat ${SNMPD_PIDFILE}) 2>&1 > /dev/null
eend $?
}

View file

@ -1,9 +0,0 @@
[Unit]
Description=Simple Network Management Protocol (SNMP) Daemon
After=syslog.target network.target
[Service]
ExecStart=/usr/sbin/snmpd -f
[Install]
WantedBy=multi-user.target

View file

@ -1,15 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# extra flags to pass to snmptrapd
SNMPTRAPD_FLAGS=""
# ignore authentication failure traps
#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -a"
# log messages to specified file
#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -Lf /var/log/snmptrapd.log"
# log messages to syslog with the specified facility
# where facility is: 'd' = LOG_DAEMON, 'u' = LOG_USER, [0-7] = LOG_LOCAL[0-7]
#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -Ls d"

View file

@ -1,13 +0,0 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
SNMPTRAPD_PIDFILE="${SNMPTRAPD_PIDFILE:-/var/run/snmptrapd.pid}"
command="/usr/sbin/snmptrapd"
command_args="-p ${SNMPTRAPD_PIDFILE} ${SNMPTRAPD_FLAGS}"
pidfile="${SNMPTRAPD_PIDFILE}"
depend() {
use logger
}

View file

@ -1,9 +0,0 @@
[Unit]
Description=Simple Network Management Protocol (SNMP) TRAP Daemon
After=syslog.target network.target
[Service]
ExecStart=/usr/sbin/snmptrapd -f
[Install]
WantedBy=multi-user.target

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>netmon@gentoo.org</email>
<name>Gentoo network monitoring and analysis project</name>
</maintainer>
<use>
<flag name="elf">Enable the use of elf utils to check uptime on some systems</flag>
<flag name="kmem">Enable usage of /dev/kmem</flag>
<flag name="mfd-rewrites">Use MFD rewrites of mib modules where available</flag>
<flag name="netlink">Use <pkg>dev-libs/libnl</pkg> to fetch TCP statistics instead of using /proc/net/tcp (Linux only).</flag>
<flag name="pcap">Install snmppcap which reads from PCAP files and writes to the SNMP transport</flag>
<flag name="pci">Use libpci (from <pkg>sys-apps/pciutils</pkg>) to look up network interface description. This feature is only available on Linux.</flag>
<flag name="rpm">Enable monitoring of <pkg>app-arch/rpm</pkg>. This flag requires the bzip2 and zlib flags to be enabled as well.</flag>
<flag name="smux">Enable support for the legacy smux protocol (superseded by agentx)</flag>
<flag name="ucd-compat">Build UCD compatibility library. Increases significantly the install size.</flag>
</use>
<upstream>
<remote-id type="sourceforge">net-snmp</remote-id>
</upstream>
</pkgmetadata>

View file

@ -1,212 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DISTUTILS_OPTIONAL=yesplz
DISTUTILS_SINGLE_IMPL=yesplz
GENTOO_DEPEND_ON_PERL=no
PATCHSET=3
PYTHON_COMPAT=( python3_{6,7,8} )
WANT_AUTOMAKE=none
inherit autotools distutils-r1 perl-module systemd
DESCRIPTION="Software for generating and retrieving SNMP data"
HOMEPAGE="http://www.net-snmp.org/"
SRC_URI="
https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-3.tar.xz
https://dev.gentoo.org/~jer/${P}.tar.xz
"
# GPL-2 for the init scripts
LICENSE="HPND BSD GPL-2"
SLOT="0/40"
KEYWORDS="~alpha ~amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86"
IUSE="
X bzip2 doc elf kmem ipv6 libressl lm-sensors mfd-rewrites minimal mysql
netlink pcap pci perl python rpm selinux smux ssl tcpd ucd-compat zlib
"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
rpm? ( bzip2 zlib )
"
COMMON_DEPEND="
bzip2? ( app-arch/bzip2 )
elf? ( dev-libs/elfutils )
lm-sensors? ( sys-apps/lm-sensors )
mysql? ( dev-db/mysql-connector-c:0= )
netlink? ( dev-libs/libnl:3 )
pcap? ( net-libs/libpcap )
pci? ( sys-apps/pciutils )
perl? ( dev-lang/perl:= )
python? (
$(python_gen_cond_dep '
dev-python/setuptools[${PYTHON_MULTI_USEDEP}]
')
${PYTHON_DEPS}
)
rpm? (
app-arch/rpm
dev-libs/popt
)
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6d:0= )
libressl? ( dev-libs/libressl:= )
)
tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
zlib? ( >=sys-libs/zlib-1.1.4 )
"
DEPEND="
${COMMON_DEPEND}
doc? ( app-doc/doxygen )
"
RDEPEND="
${COMMON_DEPEND}
perl? (
X? ( dev-perl/Tk )
!minimal? ( dev-perl/TermReadKey )
)
selinux? ( sec-policy/selinux-snmp )
"
RESTRICT=test
PATCHES=(
"${FILESDIR}"/${PN}-5.7.3-include-limits.patch
"${FILESDIR}"/${PN}-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch
"${FILESDIR}"/${PN}-5.8-pcap.patch
"${FILESDIR}"/${PN}-5.8.1-pkg-config.patch
"${FILESDIR}"/${PN}-5.8.1-net-snmp-config-libdir.patch
"${FILESDIR}"/${PN}-5.8.1-mysqlclient.patch
"${FILESDIR}"/${PN}-5.9-MakeMaker.patch
"${FILESDIR}"/${PN}-99999999-tinfo.patch
)
pkg_setup() {
python-single-r1_pkg_setup
}
src_prepare() {
# snmpconf generates config files with proper selinux context
use selinux && eapply "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch
mv "${WORKDIR}"/patches/0002-Respect-DESTDIR-for-pythoninstall.patch{,.disabled} || die
mv "${WORKDIR}"/patches/0004-Don-t-report-CFLAGS-and-LDFLAGS-in-net-snmp-config.patch{,.disabled} || die
eapply "${WORKDIR}"/patches/*.patch
default
eautoconf
}
src_configure() {
# keep this in the same line, configure.ac arguments are passed down to config.h
local mibs="host ucd-snmp/dlmod ucd-snmp/diskio ucd-snmp/extensible mibII/mta_sendmail etherlike-mib/dot3StatsTable"
use lm-sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"
use smux && mibs="${mibs} smux"
# Assume /etc/mtab is not present with a recent baselayout/openrc (bug #565136)
use kernel_linux && export ac_cv_ETC_MNTTAB=/etc/mtab
econf \
$(use_enable !ssl internal-md5) \
$(use_enable ipv6) \
$(use_enable mfd-rewrites) \
$(use_enable perl embedded-perl) \
$(use_enable ucd-compat ucd-snmp-compatibility) \
$(use_with bzip2) \
$(use_with elf) \
$(use_with kmem kmem-usage) \
$(use_with mysql) \
$(use_with netlink nl) \
$(use_with pcap) \
$(use_with pci) \
$(use_with perl perl-modules INSTALLDIRS=vendor) \
$(use_with python python-modules) \
$(use_with rpm) \
$(use_with ssl openssl) \
$(use_with tcpd libwrap) \
$(use_with zlib) \
--disable-static \
--enable-shared \
--with-default-snmp-version="3" \
--with-install-prefix="${D}" \
--with-ldflags="${LDFLAGS}" \
--with-logfile="/var/log/net-snmpd.log" \
--with-mib-modules="${mibs}" \
--with-persistent-directory="/var/lib/net-snmp" \
--with-sys-contact="root@Unknown" \
--with-sys-location="Unknown"
}
src_compile() {
emake sedscript
local subdir
for subdir in snmplib agent/mibgroup agent apps .; do
emake OTHERLDFLAGS="${LDFLAGS}" -C ${subdir} all
done
use doc && emake docsdox
}
src_install() {
# bug #317965
emake -j1 DESTDIR="${D}" install
use python && python_optimize
if use perl ; then
perl_delete_localpod
if ! use X; then
rm "${D}"/usr/bin/tkmib || die
fi
else
rm -f \
"${D}"/usr/bin/fixproc \
"${D}"/usr/bin/ipf-mod.pl \
"${D}"/usr/bin/mib2c \
"${D}"/usr/bin/net-snmp-cert \
"${D}"/usr/bin/snmp-bridge-mib \
"${D}"/usr/bin/snmpcheck \
"${D}"/usr/bin/snmpconf \
"${D}"/usr/bin/tkmib \
"${D}"/usr/bin/traptoemail \
"${D}"/usr/share/snmp/mib2c.perl.conf \
"${D}"/usr/share/snmp/snmp_perl_trapd.pl \
|| die
fi
dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO
newdoc EXAMPLE.conf.def EXAMPLE.conf
if use doc; then
docinto html
dodoc -r docs/html/*
fi
keepdir /var/lib/net-snmp
newinitd "${FILESDIR}"/snmpd.init.2 snmpd
newconfd "${FILESDIR}"/snmpd.conf snmpd
newinitd "${FILESDIR}"/snmptrapd.init.2 snmptrapd
newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd
systemd_dounit "${FILESDIR}"/snmpd.service
systemd_dounit "${FILESDIR}"/snmptrapd.service
insinto /etc/snmp
newins "${S}"/EXAMPLE.conf snmpd.conf.example
# Remove everything not required for an agent.
# Keep only the snmpd, snmptrapd, MIBs, headers and libraries.
if use minimal; then
rm -rf \
"${D}"/**/*.pl \
"${D}"/usr/bin/{encode_keychange,snmp{get,getnext,set,usm,walk,bulkwalk,table,trap,bulkget,translate,status,delta,test,df,vacm,netstat,inform,check,conf},fixproc,traptoemail} \
"${D}"/usr/share/snmp/*.conf \
"${D}"/usr/share/snmp/snmpconf-data \
|| die
fi
find "${ED}" -name '*.la' -delete || die
}

View file

@ -1,217 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DISTUTILS_OPTIONAL=yesplz
DISTUTILS_SINGLE_IMPL=yesplz
GENTOO_DEPEND_ON_PERL=no
PATCHSET=3
PYTHON_COMPAT=( python3_{6,7,8} )
WANT_AUTOMAKE=none
inherit autotools distutils-r1 git-r3 perl-module systemd
DESCRIPTION="Software for generating and retrieving SNMP data"
HOMEPAGE="http://www.net-snmp.org/"
EGIT_REPO_URI="https://github.com/net-snmp/net-snmp"
SRC_URI="
https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-3.tar.xz
"
# GPL-2 for the init scripts
LICENSE="HPND BSD GPL-2"
SLOT="0/40"
KEYWORDS=""
IUSE="
X bzip2 doc elf kmem ipv6 libressl lm-sensors mfd-rewrites minimal mysql
netlink pcap pci perl python rpm selinux smux ssl tcpd ucd-compat zlib
"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
rpm? ( bzip2 zlib )
"
COMMON_DEPEND="
bzip2? ( app-arch/bzip2 )
elf? ( dev-libs/elfutils )
lm-sensors? ( sys-apps/lm-sensors )
mysql? ( dev-db/mysql-connector-c:0= )
netlink? ( dev-libs/libnl:3 )
pcap? ( net-libs/libpcap )
pci? ( sys-apps/pciutils )
perl? ( dev-lang/perl:= )
python? (
$(python_gen_cond_dep '
dev-python/setuptools[${PYTHON_MULTI_USEDEP}]
')
${PYTHON_DEPS}
)
rpm? (
app-arch/rpm
dev-libs/popt
)
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6d:0= )
libressl? ( dev-libs/libressl:= )
)
tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
zlib? ( >=sys-libs/zlib-1.1.4 )
"
DEPEND="
${COMMON_DEPEND}
doc? ( app-doc/doxygen )
"
RDEPEND="
${COMMON_DEPEND}
perl? (
X? ( dev-perl/Tk )
!minimal? ( dev-perl/TermReadKey )
)
selinux? ( sec-policy/selinux-snmp )
"
RESTRICT=test
PATCHES=(
"${FILESDIR}"/${PN}-5.7.3-include-limits.patch
"${FILESDIR}"/${PN}-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch
"${FILESDIR}"/${PN}-5.8-pcap.patch
"${FILESDIR}"/${PN}-5.8.1-pkg-config.patch
"${FILESDIR}"/${PN}-5.8.1-net-snmp-config-libdir.patch
"${FILESDIR}"/${PN}-5.8.1-mysqlclient.patch
"${FILESDIR}"/${PN}-5.9-MakeMaker.patch
"${FILESDIR}"/${PN}-99999999-tinfo.patch
)
pkg_setup() {
use python && python-single-r1_pkg_setup
}
src_unpack() {
default
git-r3_src_unpack
}
src_prepare() {
# snmpconf generates config files with proper selinux context
use selinux && eapply "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch
mv "${WORKDIR}"/patches/0002-Respect-DESTDIR-for-pythoninstall.patch{,.disabled} || die
mv "${WORKDIR}"/patches/0004-Don-t-report-CFLAGS-and-LDFLAGS-in-net-snmp-config.patch{,.disabled} || die
eapply "${WORKDIR}"/patches/*.patch
default
eautoconf
}
src_configure() {
# keep this in the same line, configure.ac arguments are passed down to config.h
local mibs="host ucd-snmp/dlmod ucd-snmp/diskio ucd-snmp/extensible mibII/mta_sendmail etherlike-mib/dot3StatsTable"
use lm-sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"
use smux && mibs="${mibs} smux"
# Assume /etc/mtab is not present with a recent baselayout/openrc (bug #565136)
use kernel_linux && export ac_cv_ETC_MNTTAB=/etc/mtab
econf \
$(use_enable !ssl internal-md5) \
$(use_enable ipv6) \
$(use_enable mfd-rewrites) \
$(use_enable perl embedded-perl) \
$(use_enable ucd-compat ucd-snmp-compatibility) \
$(use_with bzip2) \
$(use_with elf) \
$(use_with kmem kmem-usage) \
$(use_with mysql) \
$(use_with netlink nl) \
$(use_with pcap) \
$(use_with pci) \
$(use_with perl perl-modules INSTALLDIRS=vendor) \
$(use_with python python-modules) \
$(use_with rpm) \
$(use_with ssl openssl) \
$(use_with tcpd libwrap) \
$(use_with zlib) \
--disable-static \
--enable-shared \
--with-default-snmp-version="3" \
--with-install-prefix="${D}" \
--with-ldflags="${LDFLAGS}" \
--with-logfile="/var/log/net-snmpd.log" \
--with-mib-modules="${mibs}" \
--with-persistent-directory="/var/lib/net-snmp" \
--with-sys-contact="root@Unknown" \
--with-sys-location="Unknown"
}
src_compile() {
emake sedscript
local subdir
for subdir in snmplib agent/mibgroup agent apps .; do
emake OTHERLDFLAGS="${LDFLAGS}" -C ${subdir} all
done
use doc && emake docsdox
}
src_install() {
# bug #317965
emake -j1 DESTDIR="${D}" install
use python && python_optimize
if use perl ; then
perl_delete_localpod
if ! use X; then
rm "${D}"/usr/bin/tkmib || die
fi
else
rm -f \
"${D}"/usr/bin/fixproc \
"${D}"/usr/bin/ipf-mod.pl \
"${D}"/usr/bin/mib2c \
"${D}"/usr/bin/net-snmp-cert \
"${D}"/usr/bin/snmp-bridge-mib \
"${D}"/usr/bin/snmpcheck \
"${D}"/usr/bin/snmpconf \
"${D}"/usr/bin/tkmib \
"${D}"/usr/bin/traptoemail \
"${D}"/usr/share/snmp/mib2c.perl.conf \
"${D}"/usr/share/snmp/snmp_perl_trapd.pl \
|| die
fi
dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO
newdoc EXAMPLE.conf.def EXAMPLE.conf
if use doc; then
docinto html
dodoc -r docs/html/*
fi
keepdir /var/lib/net-snmp
newinitd "${FILESDIR}"/snmpd.init.2 snmpd
newconfd "${FILESDIR}"/snmpd.conf snmpd
newinitd "${FILESDIR}"/snmptrapd.init.2 snmptrapd
newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd
systemd_dounit "${FILESDIR}"/snmpd.service
systemd_dounit "${FILESDIR}"/snmptrapd.service
insinto /etc/snmp
newins "${S}"/EXAMPLE.conf snmpd.conf.example
# Remove everything not required for an agent.
# Keep only the snmpd, snmptrapd, MIBs, headers and libraries.
if use minimal; then
rm -rf \
"${D}"/**/*.pl \
"${D}"/usr/bin/{encode_keychange,snmp{get,getnext,set,usm,walk,bulkwalk,table,trap,bulkget,translate,status,delta,test,df,vacm,netstat,inform,check,conf},fixproc,traptoemail} \
"${D}"/usr/share/snmp/*.conf \
"${D}"/usr/share/snmp/snmpconf-data \
|| die
fi
find "${ED}" -name '*.la' -delete || die
}