nmap: fix zenmap, reduce vendored libraries (#77753)
nmap: fix zenmap, reduce vendored libraries
This commit is contained in:
commit
04750438fc
@ -18,17 +18,19 @@ stdenv.mkDerivation rec {
|
|||||||
libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
|
libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
in ''
|
in ''
|
||||||
mkdir -p $out/lib $out/bin $out/include
|
mkdir -p $out/lib $out/bin $out/include
|
||||||
cp liblinear.so.3 $out/lib/liblinear.3${libSuff}
|
${if stdenv.isDarwin then ''
|
||||||
ln -s $out/lib/liblinear.3${libSuff} $out/lib/liblinear${libSuff}
|
cp liblinear.so.3 $out/lib/liblinear.3.dylib
|
||||||
|
ln -s $out/lib/liblinear.3.dylib $out/lib/liblinear.dylib
|
||||||
|
install_name_tool -id liblinear.3.dylib $out/lib/liblinear.3.dylib
|
||||||
|
'' else ''
|
||||||
|
cp liblinear.so.3 $out/lib/liblinear.so.3
|
||||||
|
ln -s $out/lib/liblinear.so.3 $out/lib/liblinear.so
|
||||||
|
''}
|
||||||
cp train $out/bin/liblinear-train
|
cp train $out/bin/liblinear-train
|
||||||
cp predict $out/bin/liblinear-predict
|
cp predict $out/bin/liblinear-predict
|
||||||
cp linear.h $out/include
|
cp linear.h $out/include
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
||||||
install_name_tool -id liblinear.3.dylib $out/lib/liblinear.3.dylib
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "A library for large linear classification";
|
description = "A library for large linear classification";
|
||||||
homepage = https://www.csie.ntu.edu.tw/~cjlin/liblinear/;
|
homepage = https://www.csie.ntu.edu.tw/~cjlin/liblinear/;
|
||||||
|
@ -1,24 +1,16 @@
|
|||||||
{ stdenv, fetchurl, fetchpatch, libpcap, pkgconfig, openssl, lua5_3
|
{ stdenv, fetchurl, fetchpatch, libpcap, pkgconfig, openssl, lua5_3
|
||||||
|
, pcre, liblinear, libssh2
|
||||||
, graphicalSupport ? false
|
, graphicalSupport ? false
|
||||||
, libX11 ? null
|
, libX11 ? null
|
||||||
, gtk2 ? null
|
, gtk2 ? null
|
||||||
, withPython ? false # required for the `ndiff` binary
|
, python2 ? null
|
||||||
, python2Packages ? null
|
|
||||||
, makeWrapper ? null
|
, makeWrapper ? null
|
||||||
, withLua ? true
|
, withLua ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert withPython -> python2Packages != null;
|
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation rec {
|
||||||
|
|
||||||
# Zenmap (the graphical program) also requires Python,
|
|
||||||
# so automatically enable pythonSupport if graphicalSupport is requested.
|
|
||||||
pythonSupport = withPython || graphicalSupport;
|
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
name = "nmap${optionalString graphicalSupport "-graphical"}-${version}";
|
name = "nmap${optionalString graphicalSupport "-graphical"}-${version}";
|
||||||
version = "7.80";
|
version = "7.80";
|
||||||
|
|
||||||
@ -48,10 +40,7 @@ in stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
(if withLua then "--with-liblua=${lua5_3}" else "--without-liblua")
|
(if withLua then "--with-liblua=${lua5_3}" else "--without-liblua")
|
||||||
]
|
] ++ optionals (!graphicalSupport) [ "--without-ndiff" "--without-zenmap" ];
|
||||||
++ optional (!pythonSupport) "--without-ndiff"
|
|
||||||
++ optional (!graphicalSupport) "--without-zenmap"
|
|
||||||
;
|
|
||||||
|
|
||||||
makeFlags = optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
makeFlags = optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
||||||
"AR=${stdenv.cc.bintools.targetPrefix}ar"
|
"AR=${stdenv.cc.bintools.targetPrefix}ar"
|
||||||
@ -59,18 +48,22 @@ in stdenv.mkDerivation rec {
|
|||||||
"CC=${stdenv.cc.targetPrefix}gcc"
|
"CC=${stdenv.cc.targetPrefix}gcc"
|
||||||
];
|
];
|
||||||
|
|
||||||
postInstall = optionalString pythonSupport ''
|
pythonPath = with python2.pkgs; optionals graphicalSupport [
|
||||||
wrapProgram $out/bin/ndiff --prefix PYTHONPATH : "$(toPythonPath $out)" --prefix PYTHONPATH : "$PYTHONPATH"
|
pygtk pysqlite pygobject2 pycairo
|
||||||
'' + optionalString graphicalSupport ''
|
];
|
||||||
wrapProgram $out/bin/zenmap --prefix PYTHONPATH : "$(toPythonPath $out)" --prefix PYTHONPATH : "$PYTHONPATH" --prefix PYTHONPATH : $(toPythonPath $pygtk)/gtk-2.0 --prefix PYTHONPATH : $(toPythonPath $pygobject)/gtk-2.0 --prefix PYTHONPATH : $(toPythonPath $pycairo)/gtk-2.0
|
|
||||||
|
nativeBuildInputs = [ pkgconfig ] ++ optionals graphicalSupport [ python2.pkgs.wrapPython ];
|
||||||
|
buildInputs = [ pcre liblinear libssh2 libpcap openssl ] ++ optionals graphicalSupport (with python2.pkgs; [
|
||||||
|
python2 libX11 gtk2
|
||||||
|
]);
|
||||||
|
|
||||||
|
postInstall = optionalString graphicalSupport ''
|
||||||
|
buildPythonPath "$out $pythonPath"
|
||||||
|
patchPythonScript $out/bin/ndiff
|
||||||
|
patchPythonScript $out/bin/zenmap
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
enableParallelBuilding = true;
|
||||||
buildInputs = with python2Packages; [ libpcap openssl ]
|
|
||||||
++ optionals pythonSupport [ makeWrapper python ]
|
|
||||||
++ optionals graphicalSupport [
|
|
||||||
libX11 gtk2 pygtk pysqlite pygobject2 pycairo
|
|
||||||
];
|
|
||||||
|
|
||||||
doCheck = false; # fails 3 tests, probably needs the net
|
doCheck = false; # fails 3 tests, probably needs the net
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user