diff options
author | Luis-Hebendanz <luis.nixos@gmail.com> | 2023-07-10 17:01:31 +0200 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-07-11 11:49:56 +0200 |
commit | b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2 (patch) | |
tree | fbfeb990b0bae29bd30b8fdf4d12c8842ef39cff | |
parent | 94820b98ea7422ef885fecf532d6e143d715c3f6 (diff) | |
download | nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.tar nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.tar.gz nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.tar.bz2 nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.tar.lz nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.tar.xz nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.tar.zst nixpkgs-b2bbed2f792ce2ca82bffd4ab0c111b792d22fb2.zip |
ns-3: v35 -> v39
-rw-r--r-- | pkgs/development/libraries/science/networking/ns-3/default.nix | 145 |
1 files changed, 88 insertions, 57 deletions
diff --git a/pkgs/development/libraries/science/networking/ns-3/default.nix b/pkgs/development/libraries/science/networking/ns-3/default.nix index 0eba41234fd..f515253026b 100644 --- a/pkgs/development/libraries/science/networking/ns-3/default.nix +++ b/pkgs/development/libraries/science/networking/ns-3/default.nix @@ -1,77 +1,108 @@ { stdenv +, breakpointHook , fetchFromGitLab , python -, wafHook +, libxml2 +, sqlite -# for binding generation -, castxml ? null +, boost +, gtk3-x11 +, root +, glib +, gsl -# can take a long time, generates > 30000 images/graphs -, enableDoxygen ? false +, cmake +, pkg-config + + +, libpcap -# e.g. "optimized" or "debug". If not set, use default one -, build_profile ? null +, jansson -# --enable-examples -, withExamples ? false +, harfbuzz +, freetype -# 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 + # for binding generation +, castxml ? null +, cppyy ? null + + # can take a long time, generates > 30000 images/graphs +, enableDoxygen ? false -# generates python bindings -, pythonSupport ? false, 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 ? true +, 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/" - 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 " - ; + 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/" + ''; - 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}" - ; - - 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 - ''; + # Make generated python bindings discoverable in customized python environment + passthru = { pythonModule = python; }; + + 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"; |