2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, removeReferencesTo
|
2019-12-21 20:52:55 +00:00
|
|
|
, file, openssl, perl, perlPackages, unzip, nettools, ncurses }:
|
2012-06-10 00:28:07 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-01-26 17:24:29 +00:00
|
|
|
pname = "net-snmp";
|
|
|
|
version = "5.9";
|
2012-06-10 00:28:07 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-26 17:24:29 +00:00
|
|
|
url = "mirror://sourceforge/net-snmp/${pname}-${version}.tar.gz";
|
|
|
|
sha256 = "0wb0vyafpspw3mcifkjjmf17r1r80kjvslycscb8nvaxz1k3lc04";
|
2012-06-10 00:28:07 +01:00
|
|
|
};
|
|
|
|
|
2017-11-09 00:15:14 +00:00
|
|
|
patches =
|
|
|
|
let fetchAlpinePatch = name: sha256: fetchpatch {
|
2020-05-15 16:58:27 +01:00
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/net-snmp/${name}?id=f25d3fb08341b60b6ccef424399f060dfcf3f1a5";
|
2017-11-09 00:15:14 +00:00
|
|
|
inherit name sha256;
|
|
|
|
};
|
|
|
|
in [
|
|
|
|
(fetchAlpinePatch "fix-includes.patch" "0zpkbb6k366qpq4dax5wknwprhwnhighcp402mlm7950d39zfa3m")
|
|
|
|
(fetchAlpinePatch "netsnmp-swinst-crash.patch" "0gh164wy6zfiwiszh58fsvr25k0ns14r3099664qykgpmickkqid")
|
|
|
|
];
|
|
|
|
|
2019-12-21 20:52:55 +00:00
|
|
|
outputs = [ "bin" "out" "dev" "lib" ];
|
|
|
|
|
2012-06-10 00:28:07 +01:00
|
|
|
configureFlags =
|
|
|
|
[ "--with-default-snmp-version=3"
|
|
|
|
"--with-sys-location=Unknown"
|
|
|
|
"--with-sys-contact=root@unknown"
|
|
|
|
"--with-logfile=/var/log/net-snmpd.log"
|
|
|
|
"--with-persistent-directory=/var/lib/net-snmp"
|
2016-04-16 18:44:32 +01:00
|
|
|
"--with-openssl=${openssl.dev}"
|
2018-12-06 21:55:20 +00:00
|
|
|
"--disable-embedded-perl"
|
|
|
|
"--without-perl-modules"
|
2021-01-15 07:07:56 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux "--with-mnttab=/proc/mounts";
|
2012-06-10 00:28:07 +01:00
|
|
|
|
2018-12-06 21:55:20 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace testing/fulltests/support/simple_TESTCONF.sh --replace "/bin/netstat" "${nettools}/bin/netstat"
|
|
|
|
'';
|
|
|
|
|
2021-02-20 21:01:53 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook nettools removeReferencesTo unzip ];
|
|
|
|
buildInputs = with perlPackages; [ file perl openssl ncurses JSON Tk TermReadKey ];
|
2012-06-10 00:28:07 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2018-12-06 21:55:20 +00:00
|
|
|
doCheck = false; # tries to use networking
|
2012-06-10 00:28:07 +01:00
|
|
|
|
2015-12-07 15:32:30 +00:00
|
|
|
postInstall = ''
|
2019-12-21 20:52:55 +00:00
|
|
|
for f in "$lib/lib/"*.la $bin/bin/net-snmp-config $bin/bin/net-snmp-create-v3-user; do
|
2016-08-23 02:10:20 +01:00
|
|
|
sed 's|-L${openssl.dev}|-L${openssl.out}|g' -i $f
|
2015-12-07 15:32:30 +00:00
|
|
|
done
|
2019-12-21 20:52:55 +00:00
|
|
|
mkdir $dev/bin
|
|
|
|
mv $bin/bin/net-snmp-config $dev/bin
|
|
|
|
# libraries contain configure options
|
|
|
|
find $lib/lib -type f -exec remove-references-to -t $bin '{}' +
|
|
|
|
find $lib/lib -type f -exec remove-references-to -t $dev '{}' +
|
2015-12-07 15:32:30 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2012-06-10 00:28:07 +01:00
|
|
|
description = "Clients and server for the SNMP network monitoring protocol";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://net-snmp.sourceforge.net/";
|
2014-12-30 19:55:07 +00:00
|
|
|
license = licenses.bsd3;
|
2016-09-01 18:39:33 +01:00
|
|
|
platforms = platforms.linux;
|
2012-06-10 00:28:07 +01:00
|
|
|
};
|
|
|
|
}
|