ns-3: 3.29 -> 3.30

Fixes python bindings.
This commit is contained in:
Matthieu Coudron 2019-08-22 18:11:10 +09:00 committed by Matthieu Coudron
parent 94a84b844e
commit d70eba7ab3
2 changed files with 46 additions and 32 deletions

View file

@ -1,5 +1,5 @@
{ stdenv { stdenv
, fetchFromGitHub , fetchFromGitLab
, python , python
, wafHook , wafHook
@ -22,75 +22,89 @@
, dia, tetex ? null, ghostscript ? null, texlive ? null , dia, tetex ? null, ghostscript ? null, texlive ? null
# generates python bindings # generates python bindings
, generateBindings ? false, ncurses ? null , pythonSupport ? false, ncurses ? null
# All modules can be enabled by choosing 'all_modules'. # All modules can be enabled by choosing 'all_modules'.
# we include here the DCE mandatory ones # we include here the DCE mandatory ones
, modules ? [ "core" "network" "internet" "point-to-point" "fd-net-device" "netanim"] , modules ? [ "core" "network" "internet" "point-to-point" "fd-net-device" "netanim"]
, gcc6
, lib , lib
}: }:
let let
pythonEnv = python.withPackages(ps: pythonEnv = python.withPackages(ps:
stdenv.lib.optional withManual ps.sphinx stdenv.lib.optional withManual ps.sphinx
++ stdenv.lib.optionals generateBindings (with ps;[ pybindgen pygccxml ]) ++ stdenv.lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ])
); );
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "ns-3";
version = "30";
name = "ns-3.${version}"; src = fetchFromGitLab {
version = "28"; owner = "nsnam";
repo = "ns-3-dev";
# the all in one https://www.nsnam.org/release/ns-allinone-3.27.tar.bz2; rev = "ns-3.${version}";
# fetches everything (netanim, etc), this package focuses on ns3-core sha256 = "0smdi3gglmafpc7a20hj2lbmwks3d5fpsicpn39lmm3svazw0bvp";
src = fetchFromGitHub {
owner = "nsnam";
repo = "ns-3-dev-git";
rev = name;
sha256 = "17kzfjpgw2mvyx1c9bxccnvw67jpk09fxmcnlkqx9xisk10qnhng";
}; };
nativeBuildInputs = [ wafHook ]; nativeBuildInputs = [ wafHook ];
# ncurses is a hidden dependency of waf when checking python
buildInputs = lib.optionals generateBindings [ castxml ncurses ]
++ stdenv.lib.optional enableDoxygen [ doxygen graphviz imagemagick ]
++ stdenv.lib.optional withManual [ dia tetex ghostscript texlive.combined.scheme-medium ];
propagatedBuildInputs = [ gcc6 pythonEnv ]; outputs = [ "out" ] ++ lib.optional pythonSupport "py";
# ncurses is a hidden dependency of waf when checking python
buildInputs = lib.optionals pythonSupport [ castxml ncurses ]
++ lib.optional enableDoxygen [ doxygen graphviz imagemagick ]
++ lib.optional withManual [ dia tetex ghostscript texlive.combined.scheme-medium ];
propagatedBuildInputs = [ pythonEnv ];
postPatch = '' postPatch = ''
patchShebangs doc/ns3_html_theme/get_version.sh patchShebangs doc/ns3_html_theme/get_version.sh
''; '';
wafConfigureFlags = with stdenv.lib; [ wafConfigureFlags = with stdenv.lib; [
"--enable-modules=${stdenv.lib.concatStringsSep "," modules}" "--enable-modules=${concatStringsSep "," modules}"
"--with-python=${pythonEnv.interpreter}" "--with-python=${pythonEnv.interpreter}"
] ]
++ optional (build_profile != null) "--build-profile=${build_profile}" ++ optional (build_profile != null) "--build-profile=${build_profile}"
++ optional generateBindings [ ]
++ optional withExamples " --enable-examples " ++ optional withExamples " --enable-examples "
++ optional doCheck " --enable-tests " ++ optional doCheck " --enable-tests "
; ;
doCheck = true;
buildTargets = "build" buildTargets = "build"
+ lib.optionalString enableDoxygen " doxygen" + lib.optionalString enableDoxygen " doxygen"
+ lib.optionalString withManual "sphinx"; + lib.optionalString withManual "sphinx";
doCheck = true; # to prevent fatal error: 'backward_warning.h' file not found
CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
# we need to specify the proper interpreter else ns3 can check against a postBuild = with stdenv.lib; let flags = concatStringsSep ";" (
# different version even though we optional enableDoxygen "./waf doxygen"
checkPhase = '' ++ optional withManual "./waf sphinx"
${pythonEnv.interpreter} ./test.py );
in "${flags}"
;
postInstall = ''
moveToOutput "${pythonEnv.libPrefix}" "$py"
''; '';
hardeningDisable = [ "fortify" ]; # we need to specify the proper interpreter else ns3 can check against a
# different version
checkPhase = ''
${pythonEnv.interpreter} ./test.py --nowaf
'';
meta = { # strictoverflow prevents clang from discovering pyembed when bindings
homepage = http://www.nsnam.org; hardeningDisable = [ "fortify" "strictoverflow"];
license = stdenv.lib.licenses.gpl3;
meta = with stdenv.lib; {
homepage = "http://www.nsnam.org";
license = licenses.gpl3;
description = "A discrete time event network simulator"; description = "A discrete time event network simulator";
platforms = with stdenv.lib.platforms; unix; platforms = with platforms; unix;
maintainers = with maintainers; [ teto ];
}; };
} }

View file

@ -23525,7 +23525,7 @@ in
netlogo = callPackage ../applications/science/misc/netlogo { }; netlogo = callPackage ../applications/science/misc/netlogo { };
ns-3 = callPackage ../development/libraries/science/networking/ns3 { }; ns-3 = callPackage ../development/libraries/science/networking/ns-3 { python = python3; };
root = callPackage ../applications/science/misc/root { root = callPackage ../applications/science/misc/root {
inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL; inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL;