2019-12-21 20:52:55 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, autoreconfHook, removeReferencesTo
|
|
|
|
, file, openssl, perl, perlPackages, unzip, nettools, ncurses }:
|
2012-06-10 00:28:07 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-12-06 21:55:20 +00:00
|
|
|
name = "net-snmp-5.8";
|
2012-06-10 00:28:07 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-12-06 21:55:20 +00:00
|
|
|
url = "mirror://sourceforge/net-snmp/${name}.tar.gz";
|
|
|
|
sha256 = "1pvajzj9gmj56dmwix0ywmkmy2pglh6nny646hkm7ghfhh03bz5j";
|
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")
|
2018-12-06 21:55:20 +00:00
|
|
|
./0002-autoconf-version.patch
|
2017-11-09 00:15:14 +00:00
|
|
|
];
|
|
|
|
|
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"
|
2015-12-17 11:35:15 +00:00
|
|
|
] ++ stdenv.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"
|
|
|
|
'';
|
|
|
|
|
2019-12-21 20:52:55 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook nettools removeReferencesTo ];
|
|
|
|
buildInputs = with perlPackages; [ file perl unzip 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
|
|
|
'';
|
|
|
|
|
2014-12-30 19:55:07 +00:00
|
|
|
meta = with stdenv.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
|
|
|
};
|
|
|
|
}
|