APKBUILD 4.85 KB
Newer Older
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
1 2 3
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=net-snmp
Natanael Copa's avatar
Natanael Copa committed
4
pkgver=5.8
5
pkgrel=1
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
6 7
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
8
arch="all"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
9
license="GPL"
Natanael Copa's avatar
Natanael Copa committed
10
depends=
Natanael Copa's avatar
Natanael Copa committed
11
depends_dev="openssl-dev"
12 13
# we need perl-net-snmp in make depends for bootstrapping issues
# net-snmp-gui subpackage has perl-net-snmp as depends
Natanael Copa's avatar
Natanael Copa committed
14
makedepends="file perl-dev openssl-dev perl-net-snmp linux-headers"
15 16
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
	$pkgname-perl:pl $pkgname-gui $pkgname-tools"
17
source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
18
	netsnmp-swinst-crash.patch
Timo Teräs's avatar
Timo Teräs committed
19
	fix-includes.patch
20

21
	snmpd.initd
22 23 24
	snmpd.confd
	snmptrapd.confd
	"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
25

tmpfile's avatar
tmpfile committed
26
builddir="$srcdir/$pkgname-$pkgver"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
27

28
prepare() {
tmpfile's avatar
tmpfile committed
29 30
	update_config_sub
	default_prepare
31 32
	# Allow tmpfs volume size monitoring
	# Ref #932
33
	sed -e 's#"tmpfs",#/*  "tmpfs",  */#g' -i agent/mibgroup/host/hr_filesys.c
34 35
}

36
build() {
tmpfile's avatar
tmpfile committed
37
	cd "$builddir"
38

Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
39
	export lt_cv_sys_max_cmd_len=8192
40

41 42
	#build fails on: libnetsnmpmibs.so: undefined reference to `pthread_create'
	LDFLAGS="$LDFLAGS -lpthread"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
43

44 45 46 47
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
48
		--sysconfdir=/etc \
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
49 50 51 52 53 54 55 56
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-default-snmp-version="3" \
		--with-sys-contact="root@unknown" \
		--with-sys-location="unknown" \
		--with-logfile="/var/log/net-snmpd.log" \
		--enable-ucd-snmp-compatibility \
		--with-persistent-directory="/var/lib/net-snmp" \
57
		--with-openssl \
58
		--enable-pic \
59
		--enable-ipv6 \
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
60
		--enable-shared \
61
		--enable-as-needed \
62
		--with-perl-modules="INSTALLDIRS=vendor" \
tmpfile's avatar
tmpfile committed
63
		--disable-embedded-perl
64 65
	# embedded-perl seems to create TEXTREL's

tmpfile's avatar
tmpfile committed
66
	make -j1
67 68 69
}

package() {
tmpfile's avatar
tmpfile committed
70
	cd "$builddir"
Natanael Copa's avatar
Natanael Copa committed
71
	make -j1 DESTDIR="$pkgdir" install || return 1
72 73 74 75 76 77
	# 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 \
tmpfile's avatar
tmpfile committed
78 79 80 81 82 83
		"$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
84
	install -m644 -D "$srcdir"/snmptrapd.confd \
tmpfile's avatar
tmpfile committed
85
		"$pkgdir"/etc/conf.d/snmptrapd
86 87
	install -m644 -D EXAMPLE.conf "$pkgdir"/etc/snmp/snmpd.conf
	echo "authCommunity log,execute,net public" > "$pkgdir"/etc/snmp/snmptrapd.conf
88 89
	mkdir -p "$pkgdir"/var/lib/net-snmp
	find "$pkgdir" -name perllocal.pod -delete
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
90 91
}

92 93 94
libs() {
	pkgdesc="The NET-SNMP runtime client libraries"
	replaces="net-snmp"
tmpfile's avatar
tmpfile committed
95 96 97
	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/
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
}

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="The 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 \
tmpfile's avatar
tmpfile committed
123
		"$subpkgdir"/usr/bin/
124 125 126 127 128 129 130 131 132 133 134 135 136 137
	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/
}

Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
138
tools() {
139
	pkgdesc="Network management utilities using SNMP"
Carlo Lanmdeter's avatar
Carlo Lanmdeter committed
140 141 142 143
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

Natanael Copa's avatar
Natanael Copa committed
144
sha512sums="27895a583b23f3e14c48562bc32f3ba83513d81aa848e878be9a3650f0458d45950635c937ef627135f80b757b663e71fab9a3bde4fd91889153998ae3468fe7  net-snmp-5.8.tar.gz
145
4ad92f50b14d5e27ba86256cc532a2dd055502f4d5fbb1700434f9f01f881fd09bb1eadb94e727554e1470f036707558314c64a66d0376b54e71ab31d5e4baa3  netsnmp-swinst-crash.patch
Timo Teräs's avatar
Timo Teräs committed
146
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb  fix-includes.patch
147
896ef65a6f420073746470cdbd0de8f356c5b936d35e131754905b3d4323c24dcd3a09e0cc8bd90b12e3402f01e478f927f0e4163cb85cb0cc03db3c2e0491f4  snmpd.initd
148 149
fb101aa758d741ed3ea88b11f1cd49cfd04bd03ce62435f3acb17724748131c57f00b71fd45cb7e7871d65a1aab576652cd6e158b6406aa6d0998582b8235ef5  snmpd.confd
073fd2b83eedd6eda1f7345350268ce7946ef6d67a8f26f7c232e46feb75babf68272ae12071a2f9ea76ede71393b3ae4672d3cd47cfd14ab77e3a6482f2e124  snmptrapd.confd"