# Contributor: Carlo Landmeter # Maintainer: Carlo Landmeter pkgname=net-snmp pkgver=5.7.2 pkgrel=1 pkgdesc="Simple Network Management Protocol" url="http://www.net-snmp.org/" arch="all" license="GPL" 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="perl-dev openssl-dev perl-net-snmp" subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs $pkgname-perl:pl $pkgname-gui $pkgname-tools" source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz netsnmp-swinst-crash.patch snmpd.initd snmpd.confd snmptrapd.initd snmptrapd.confd " _builddir="$srcdir/$pkgname-$pkgver" prepare() { local i cd "$_builddir" # patches goes here for i in $source; do case $i in *.patch|*.diff) msg "Applying $i..." patch -p1 -i "$srcdir"/$i || return 1 ;; esac done # 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 #build fails on: libnetsnmpmibs.so: undefined reference to `pthread_create' LDFLAGS="$LDFLAGS -lpthread" ./configure --prefix=/usr \ --sysconfdir=/etc \ --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" \ --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 # work around parallell build issue #make sedscript EXAMPLE.conf net-snmp-config-x \ # && make -j1 -C man \ # && make standardall \ # && make net-snmp-create-v3-user \ # && make || return 1 # # still fails even with the workaround above. make -j1 || return 1 } package() { cd "$_builddir" make -j1 DESTDIR="$pkgdir" install || return 1 # remove things we dont want distribute rm "$pkgdir"/usr/lib/*.la || return 1 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 \ || return 1 ln -s snmptrap "$pkgdir"/usr/bin/snmpinform || return 1 install -m755 -D "$srcdir"/snmpd.initd "$pkgdir"/etc/init.d/snmpd install -m644 -D "$srcdir"/snmpd.confd "$pkgdir"/etc/conf.d/snmpd install -m755 -D "$srcdir"/snmptrapd.initd "$pkgdir"/etc/init.d/snmptrapd install -m644 -D "$srcdir"/snmptrapd.confd "$pkgdir"/etc/conf.d/snmptrapd install -m644 -D EXAMPLE.conf "$pkgdir"/etc/snmp/snmpd.conf.example 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 || return 1 mv "$pkgdir"/usr/lib/libnetsnmp.so.* "$subpkgdir"/usr/lib/ || return 1 mv "$pkgdir"/usr/share/snmp/mibs "$subpkgdir"/usr/share/snmp/ \ || return 1 } 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 \ "$subpkgdir"/usr/bin/ || return 1 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 } md5sums="5bddd02e2f82b62daa79f82717737a14 net-snmp-5.7.2.tar.gz bd7dc10ffb5839e35ec37effcc53c2ad netsnmp-swinst-crash.patch 198a4a7b80557fa8112394df5ec9914e snmpd.initd 96510a2f3bc9f21648b03f7e8d76c0d3 snmpd.confd 7ce3e9e880fc6313ae87eb000bae4bda snmptrapd.initd 363f7728a76bdfc46e29b7e1f5cf4950 snmptrapd.confd"