summaryrefslogblamecommitdiff
path: root/user/net-snmp/APKBUILD
blob: 333cb8a693279558520a105358c691b5649445aa (plain) (tree)






















































































































































                                                                                                                                                                   
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: 
pkgname=net-snmp
pkgver=5.7.3
pkgrel=11
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
arch="all"
options="!check"
license="MIT-CMU AND BSD-3-Clause"
depends=""
depends_dev="openssl-dev"
# we need perl-net-snmp in make depends for bootstrapping issues
# net-snmp-gui subpackage has perl-net-snmp as depends
makedepends="file linux-headers openssl-dev perl-dev perl-net-snmp utmps-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
	$pkgname-openrc $pkgname-perl:pl $pkgname-gui $pkgname-tools"
source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
	netsnmp-swinst-crash.patch
	fix-includes.patch
	CVE-2015-5621.patch
	remove-U64-typedef.patch
	fix-Makefile-PL.patch

	snmpd.initd
	snmpd.confd
	snmptrapd.confd
	"

prepare() {
	update_config_sub
	default_prepare
	# Allow tmpfs volume size monitoring
	# Ref #932
	sed -e 's#"tmpfs",#/*  "tmpfs",  */#g' -i agent/mibgroup/host/hr_filesys.c
}

build() {
	cd "$builddir"

	export lt_cv_sys_max_cmd_len=8192

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-default-snmp-version="3" \
		--with-sys-contact="root@adelie" \
		--with-sys-location="unknown" \
		--with-logfile="/var/log/net-snmpd.log" \
		--enable-ucd-snmp-compatibility \
		--with-persistent-directory="/var/lib/net-snmp" \
		--with-openssl \
		--enable-pic \
		--enable-ipv6 \
		--enable-shared \
		--enable-as-needed \
		--with-perl-modules="INSTALLDIRS=vendor" \
		--disable-embedded-perl
	# embedded-perl seems to create TEXTREL's

	make -j1
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
	# remove things we dont want distribute
	rm "$pkgdir"/usr/lib/libsnmp* \
		"$pkgdir"/usr/bin/snmpcheck \
		"$pkgdir"/usr/bin/fixproc \
		"$pkgdir"/usr/share/man/man1/fixproc* \
		"$pkgdir"/usr/bin/ipf-mod.pl \
		"$pkgdir"/usr/bin/snmpinform
	ln -s snmptrap "$pkgdir"/usr/bin/snmpinform

	install -m755 -D "$srcdir"/snmpd.initd "$pkgdir"/etc/init.d/snmpd
	ln -s snmpd "$pkgdir"/etc/init.d/snmptrapd
	install -m644 -D "$srcdir"/snmpd.confd "$pkgdir"/etc/conf.d/snmpd
	install -m644 -D "$srcdir"/snmptrapd.confd \
		"$pkgdir"/etc/conf.d/snmptrapd
	install -m644 -D EXAMPLE.conf "$pkgdir"/etc/snmp/snmpd.conf
	echo "authCommunity log,execute,net public" > "$pkgdir"/etc/snmp/snmptrapd.conf
	mkdir -p "$pkgdir"/var/lib/net-snmp
	find "$pkgdir" -name perllocal.pod -delete
}

libs() {
	pkgdesc="The NET-SNMP runtime client libraries"
	replaces="net-snmp"
	mkdir -p "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/snmp
	mv "$pkgdir"/usr/lib/libnetsnmp.so.* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/share/snmp/mibs "$subpkgdir"/usr/share/snmp/
}

alibs() {
	pkgdesc="The NET-SNMP runtime agent libraries"
	replaces="net-snmp"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libnetsnmpagent*.so.* \
		"$pkgdir"/usr/lib/libnetsnmphelpers*.so.* \
		"$pkgdir"/usr/lib/libnetsnmpmibs*.so.* \
		"$pkgdir"/usr/lib/libnetsnmptrapd*.so.* \
		"$subpkgdir"/usr/lib/
}

pl() {
	pkgdesc="Perl NET-SNMP module and the mib2c tool"
	replaces="net-snmp"
	mkdir -p "$subpkgdir"/usr/lib \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/share/snmp

	mv "$pkgdir"/usr/bin/mib2c-update \
		"$pkgdir"/usr/bin/mib2c \
		"$pkgdir"/usr/bin/snmp-bridge-mib \
		"$pkgdir"/usr/bin/net-snmp-cert \
		"$pkgdir"/usr/bin/traptoemail \
		"$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/lib/perl* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/share/snmp/mib2c* \
		"$pkgdir"/usr/share/snmp/*.pl \
		"$subpkgdir"/usr/share/snmp/
}

gui() {
	pkgdesc="An interactive graphical MIB browser for SNMP"
	depends="perl-net-snmp" # needs perl-tk too...
	replaces="net-snmp-tools"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/tkmib "$subpkgdir"/usr/bin/
}

tools() {
	pkgdesc="Network management utilities using SNMP"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

sha512sums="0758bba5844cfd6c80959ac16b83906a2f830ba49fd0ab1bf9e191dc6a79d312a2e4760bd53b3e1a1c82759481f0064d088d5a3cf475d84b25679a6bd0f049bb  net-snmp-5.7.3.tar.gz
4ad92f50b14d5e27ba86256cc532a2dd055502f4d5fbb1700434f9f01f881fd09bb1eadb94e727554e1470f036707558314c64a66d0376b54e71ab31d5e4baa3  netsnmp-swinst-crash.patch
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb  fix-includes.patch
2b2a7be54a570e3c1bb701f8ccfb98ea8e50a19fda021f43a521d4e968ded1bc5e794fc4348dff7fcdf57da34ff6b555398851bbccfcf92bb75ad6f365a80dba  CVE-2015-5621.patch
25e45c493b8da74cb12a8094d12a4f0ee1f59b60df648a958ebc7b0a33b4f350d9c5bf1e6f6ff372d78e066c369d99f2ae549b5d5d1daa969e3ef301fc820c29  remove-U64-typedef.patch
d17058976fd635f153ff2e5d798807dde4d89071c252ea1223d93cc169270bb39cdd2c84ee4d01c05c9a0b6df80b92ceae3e1078e41f94e6077d7275661898e9  fix-Makefile-PL.patch
896ef65a6f420073746470cdbd0de8f356c5b936d35e131754905b3d4323c24dcd3a09e0cc8bd90b12e3402f01e478f927f0e4163cb85cb0cc03db3c2e0491f4  snmpd.initd
fb101aa758d741ed3ea88b11f1cd49cfd04bd03ce62435f3acb17724748131c57f00b71fd45cb7e7871d65a1aab576652cd6e158b6406aa6d0998582b8235ef5  snmpd.confd
073fd2b83eedd6eda1f7345350268ce7946ef6d67a8f26f7c232e46feb75babf68272ae12071a2f9ea76ede71393b3ae4672d3cd47cfd14ab77e3a6482f2e124  snmptrapd.confd"