ns-3: v35 -> v39
This commit is contained in:
parent
94820b98ea
commit
b2bbed2f79
|
@ -1,77 +1,108 @@
|
|||
{ stdenv
|
||||
, breakpointHook
|
||||
, fetchFromGitLab
|
||||
, python
|
||||
, wafHook
|
||||
, libxml2
|
||||
, sqlite
|
||||
|
||||
# for binding generation
|
||||
, boost
|
||||
, gtk3-x11
|
||||
, root
|
||||
, glib
|
||||
, gsl
|
||||
|
||||
, cmake
|
||||
, pkg-config
|
||||
|
||||
|
||||
, libpcap
|
||||
|
||||
, jansson
|
||||
|
||||
, harfbuzz
|
||||
, freetype
|
||||
|
||||
# for binding generation
|
||||
, castxml ? null
|
||||
, cppyy ? null
|
||||
|
||||
# can take a long time, generates > 30000 images/graphs
|
||||
# can take a long time, generates > 30000 images/graphs
|
||||
, enableDoxygen ? false
|
||||
|
||||
# e.g. "optimized" or "debug". If not set, use default one
|
||||
, build_profile ? null
|
||||
# very long
|
||||
, withManual ? false
|
||||
, doxygen ? null
|
||||
, graphviz ? null
|
||||
, imagemagick ? null
|
||||
# for manual, tetex is used to get the eps2pdf binary
|
||||
# texlive to get latexmk. building manual still fails though
|
||||
, dia
|
||||
, tetex ? null
|
||||
, ghostscript ? null
|
||||
, texlive ? null
|
||||
|
||||
# --enable-examples
|
||||
, withExamples ? false
|
||||
# generates python bindings
|
||||
, pythonSupport ? true
|
||||
, ncurses ? null
|
||||
|
||||
# very long
|
||||
, withManual ? false, doxygen ? null, graphviz ? null, imagemagick ? null
|
||||
# for manual, tetex is used to get the eps2pdf binary
|
||||
# texlive to get latexmk. building manual still fails though
|
||||
, dia, tetex ? null, ghostscript ? null, texlive ? null
|
||||
|
||||
# generates python bindings
|
||||
, pythonSupport ? false, ncurses ? null
|
||||
|
||||
# All modules can be enabled by choosing 'all_modules'.
|
||||
# we include here the DCE mandatory ones
|
||||
, modules ? [ "core" "network" "internet" "point-to-point" "point-to-point-layout" "fd-net-device" "netanim" ]
|
||||
, lib
|
||||
}:
|
||||
|
||||
let
|
||||
pythonEnv = python.withPackages(ps:
|
||||
pythonEnv = python.withPackages (ps:
|
||||
lib.optional withManual ps.sphinx
|
||||
++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ])
|
||||
++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml cppyy])
|
||||
);
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ns-3";
|
||||
version = "35";
|
||||
version = "39";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "nsnam";
|
||||
repo = "ns-3-dev";
|
||||
rev = "ns-3.${version}";
|
||||
sha256 = "sha256-3w+lCWWra9sndL8+vkGfH5plrDYYCMFi1PzwIVRku6I=";
|
||||
repo = "ns-3-dev";
|
||||
rev = "ns-3.${version}";
|
||||
sha256 = "sha256-2d8xCCfxRpcCZgt7ne17F7cUo/wIxLyvjQs3izNUnmY=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ wafHook python ];
|
||||
nativeBuildInputs = [ cmake pkg-config pythonEnv ];
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional pythonSupport "py";
|
||||
outputs = [ "out" ];
|
||||
|
||||
# ncurses is a hidden dependency of waf when checking python
|
||||
buildInputs = lib.optionals pythonSupport [ castxml ncurses ]
|
||||
++ lib.optionals enableDoxygen [ doxygen graphviz imagemagick ]
|
||||
++ lib.optionals withManual [ dia tetex ghostscript texlive.combined.scheme-medium ];
|
||||
++ lib.optionals withManual [ dia tetex ghostscript imagemagick texlive.combined.scheme-medium ]
|
||||
++ [
|
||||
libxml2
|
||||
pythonEnv
|
||||
sqlite.dev
|
||||
gsl
|
||||
boost
|
||||
root
|
||||
glib.out
|
||||
glib.dev
|
||||
libpcap
|
||||
gtk3-x11.dev
|
||||
harfbuzz
|
||||
freetype
|
||||
jansson
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [ pythonEnv ];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs doc/ns3_html_theme/get_version.sh
|
||||
preConfigure = ''
|
||||
substituteInPlace src/tap-bridge/CMakeLists.txt \
|
||||
--replace '-DTAP_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/tap-bridge/' "-DTAP_CREATOR=\"$out/libexec/ns3/"
|
||||
|
||||
substituteInPlace src/fd-net-device/CMakeLists.txt \
|
||||
--replace '-DRAW_SOCK_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/' "-DRAW_SOCK_CREATOR=\"$out/libexec/ns3/"
|
||||
|
||||
substituteInPlace src/fd-net-device/CMakeLists.txt \
|
||||
--replace '-DTAP_DEV_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/' "-DTAP_DEV_CREATOR=\"$out/libexec/ns3/"
|
||||
'';
|
||||
|
||||
wafConfigureFlags = with lib; [
|
||||
"--enable-modules=${concatStringsSep "," modules}"
|
||||
"--with-python=${pythonEnv.interpreter}"
|
||||
]
|
||||
++ optional (build_profile != null) "--build-profile=${build_profile}"
|
||||
++ optional withExamples " --enable-examples "
|
||||
++ optional doCheck " --enable-tests "
|
||||
;
|
||||
|
||||
doCheck = true;
|
||||
doCheck = false;
|
||||
|
||||
buildTargets = "build"
|
||||
+ lib.optionalString enableDoxygen " doxygen"
|
||||
|
@ -80,25 +111,25 @@ stdenv.mkDerivation rec {
|
|||
# to prevent fatal error: 'backward_warning.h' file not found
|
||||
CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
|
||||
|
||||
postBuild = with lib; let flags = concatStringsSep ";" (
|
||||
optional enableDoxygen "./waf doxygen"
|
||||
++ optional withManual "./waf sphinx"
|
||||
);
|
||||
in "${flags}"
|
||||
;
|
||||
# Make generated python bindings discoverable in customized python environment
|
||||
passthru = { pythonModule = python; };
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput "${pythonEnv.libPrefix}" "$py"
|
||||
'';
|
||||
|
||||
# we need to specify the proper interpreter else ns3 can check against a
|
||||
# different version
|
||||
checkPhase = ''
|
||||
${pythonEnv.interpreter} ./test.py --nowaf
|
||||
'';
|
||||
cmakeFlags = [
|
||||
"-DPython3_LIBRARY_DIRS=${pythonEnv}/lib"
|
||||
"-DPython3_INCLUDE_DIRS=${pythonEnv}/include"
|
||||
"-DPython3_EXECUTABLE=${pythonEnv}/bin/python"
|
||||
"-DNS3_PYTHON_BINDINGS=ON"
|
||||
"-DNS3_DES_METRICS=ON"
|
||||
"-DNS3_BINDINGS_INSTALL_DIR=lib/${pythonEnv.libPrefix}/site-packages"
|
||||
"-DNS3_LOG=ON"
|
||||
"-DNS3_ASSERT=ON"
|
||||
"-DNS3_GTK3=ON"
|
||||
"-DGTK3_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
|
||||
]
|
||||
++ lib.optional doCheck "-DNS3_TESTS=ON";
|
||||
|
||||
# strictoverflow prevents clang from discovering pyembed when bindings
|
||||
hardeningDisable = [ "fortify" "strictoverflow"];
|
||||
hardeningDisable = [ "fortify" "strictoverflow" ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "http://www.nsnam.org";
|
||||
|
|
Loading…
Reference in a new issue