ns-3: v35 -> v39
This commit is contained in:
parent
94820b98ea
commit
b2bbed2f79
1 changed files with 87 additions and 56 deletions
|
@ -1,77 +1,108 @@
|
||||||
{ stdenv
|
{ stdenv
|
||||||
|
, breakpointHook
|
||||||
, fetchFromGitLab
|
, fetchFromGitLab
|
||||||
, python
|
, 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
|
, castxml ? null
|
||||||
|
, cppyy ? null
|
||||||
|
|
||||||
# can take a long time, generates > 30000 images/graphs
|
# can take a long time, generates > 30000 images/graphs
|
||||||
, enableDoxygen ? false
|
, enableDoxygen ? false
|
||||||
|
|
||||||
# e.g. "optimized" or "debug". If not set, use default one
|
# very long
|
||||||
, build_profile ? null
|
, 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
|
# generates python bindings
|
||||||
, withExamples ? false
|
, 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
|
, lib
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
pythonEnv = python.withPackages(ps:
|
pythonEnv = python.withPackages (ps:
|
||||||
lib.optional withManual ps.sphinx
|
lib.optional withManual ps.sphinx
|
||||||
++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ])
|
++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml cppyy])
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "ns-3";
|
pname = "ns-3";
|
||||||
version = "35";
|
version = "39";
|
||||||
|
|
||||||
src = fetchFromGitLab {
|
src = fetchFromGitLab {
|
||||||
owner = "nsnam";
|
owner = "nsnam";
|
||||||
repo = "ns-3-dev";
|
repo = "ns-3-dev";
|
||||||
rev = "ns-3.${version}";
|
rev = "ns-3.${version}";
|
||||||
sha256 = "sha256-3w+lCWWra9sndL8+vkGfH5plrDYYCMFi1PzwIVRku6I=";
|
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
|
# ncurses is a hidden dependency of waf when checking python
|
||||||
buildInputs = lib.optionals pythonSupport [ castxml ncurses ]
|
buildInputs = lib.optionals pythonSupport [ castxml ncurses ]
|
||||||
++ lib.optionals enableDoxygen [ doxygen graphviz imagemagick ]
|
++ 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 ];
|
propagatedBuildInputs = [ pythonEnv ];
|
||||||
|
|
||||||
postPatch = ''
|
preConfigure = ''
|
||||||
patchShebangs doc/ns3_html_theme/get_version.sh
|
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; [
|
doCheck = false;
|
||||||
"--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;
|
|
||||||
|
|
||||||
buildTargets = "build"
|
buildTargets = "build"
|
||||||
+ lib.optionalString enableDoxygen " doxygen"
|
+ lib.optionalString enableDoxygen " doxygen"
|
||||||
|
@ -80,25 +111,25 @@ stdenv.mkDerivation rec {
|
||||||
# to prevent fatal error: 'backward_warning.h' file not found
|
# to prevent fatal error: 'backward_warning.h' file not found
|
||||||
CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
|
CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
|
||||||
|
|
||||||
postBuild = with lib; let flags = concatStringsSep ";" (
|
# Make generated python bindings discoverable in customized python environment
|
||||||
optional enableDoxygen "./waf doxygen"
|
passthru = { pythonModule = python; };
|
||||||
++ optional withManual "./waf sphinx"
|
|
||||||
);
|
|
||||||
in "${flags}"
|
|
||||||
;
|
|
||||||
|
|
||||||
postInstall = ''
|
cmakeFlags = [
|
||||||
moveToOutput "${pythonEnv.libPrefix}" "$py"
|
"-DPython3_LIBRARY_DIRS=${pythonEnv}/lib"
|
||||||
'';
|
"-DPython3_INCLUDE_DIRS=${pythonEnv}/include"
|
||||||
|
"-DPython3_EXECUTABLE=${pythonEnv}/bin/python"
|
||||||
# we need to specify the proper interpreter else ns3 can check against a
|
"-DNS3_PYTHON_BINDINGS=ON"
|
||||||
# different version
|
"-DNS3_DES_METRICS=ON"
|
||||||
checkPhase = ''
|
"-DNS3_BINDINGS_INSTALL_DIR=lib/${pythonEnv.libPrefix}/site-packages"
|
||||||
${pythonEnv.interpreter} ./test.py --nowaf
|
"-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
|
# strictoverflow prevents clang from discovering pyembed when bindings
|
||||||
hardeningDisable = [ "fortify" "strictoverflow"];
|
hardeningDisable = [ "fortify" "strictoverflow" ];
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "http://www.nsnam.org";
|
homepage = "http://www.nsnam.org";
|
||||||
|
|
Loading…
Reference in a new issue