about summary refs log tree commit diff
path: root/pkgs/applications/science/misc/simgrid
diff options
context:
space:
mode:
authorMillian Poquet <millian.poquet@inria.fr>2021-10-08 23:05:10 +0200
committerMillian Poquet <millian.poquet@inria.fr>2022-02-19 10:05:12 +0100
commit3f804f68bce9b2cebfa01fed93ad78c9c554998b (patch)
tree66f039442ae29ad81c8019149db1a3d434fb1d3f /pkgs/applications/science/misc/simgrid
parent77d8adb8b98a160603a5457159d04935a15c82f4 (diff)
simgrid: 3.28 -> 3.30 + python + clean
- use latest SimGrid release
- enable the python binding (in new output "python")
- reviews from PR 141040 have been applied
Diffstat (limited to 'pkgs/applications/science/misc/simgrid')
-rw-r--r--pkgs/applications/science/misc/simgrid/default.nix91
1 files changed, 44 insertions, 47 deletions
diff --git a/pkgs/applications/science/misc/simgrid/default.nix b/pkgs/applications/science/misc/simgrid/default.nix
index 002c383dcaf65..6104a0c1a8ff2 100644
--- a/pkgs/applications/science/misc/simgrid/default.nix
+++ b/pkgs/applications/science/misc/simgrid/default.nix
@@ -1,13 +1,14 @@
-{ lib, stdenv, fetchFromGitLab, fetchpatch, cmake, perl, python3, boost, valgrind
-# Optional requirements
-# Lua 5.3 needed and not available now
-#, luaSupport ? false, lua5
+{ stdenv, lib, fetchFromGitLab, cmake, perl, python3, boost
 , fortranSupport ? false, gfortran
 , buildDocumentation ? false, fig2dev, ghostscript, doxygen
 , buildJavaBindings ? false, openjdk
+, buildPythonBindings ? true, python3Packages
 , modelCheckingSupport ? false, libunwind, libevent, elfutils # Inside elfutils: libelf and libdw
+, minimalBindings ? false
 , debug ? false
+, optimize ? (!debug)
 , moreTests ? false
+, withoutBin ? false
 }:
 
 with lib;
@@ -18,54 +19,35 @@ in
 
 stdenv.mkDerivation rec {
   pname = "simgrid";
-  version = "3.28";
+  version = "3.30";
 
   src = fetchFromGitLab {
     domain = "framagit.org";
     owner = pname;
     repo = pname;
     rev = "v${version}";
-    sha256 = "0vylwgd4i89bvhbgfay0wq953324dwfmmr8jp9b4vvlc9m0017r9";
+    sha256 = "1dg8ywqif20g0fs8dnd6364n080nvwx7f444zcfwqwz6iax61qv1";
   };
 
-  patches = [
-    (fetchpatch {
-      name = "fix-smpi-dirs-absolute.patch";
-      url = "https://framagit.org/simgrid/simgrid/-/commit/71f01e667577be1076646eb841e0a57bd5388545.patch";
-      sha256 = "0x3y324b6269687zfy43ilc48bwrs4nb7svh2mpg88lrz53rky15";
-    })
-  ];
-
   propagatedBuildInputs = [ boost ];
-  nativeBuildInputs = [ cmake perl python3 valgrind ]
-      ++ optionals fortranSupport [ gfortran ]
-      ++ optionals buildJavaBindings [ openjdk ]
-      ++ optionals buildDocumentation [ fig2dev ghostscript doxygen ]
-      ++ optionals modelCheckingSupport [ libunwind libevent elfutils ];
+  nativeBuildInputs = [ cmake perl python3 ]
+    ++ optionals fortranSupport [ gfortran ]
+    ++ optionals buildJavaBindings [ openjdk ]
+    ++ optionals buildPythonBindings [ python3Packages.pybind11 ]
+    ++ optionals buildDocumentation [ fig2dev ghostscript doxygen ]
+    ++ optionals modelCheckingSupport [ libunwind libevent elfutils ];
 
-  #buildInputs = optional luaSupport lua5;
+  outputs = [ "out" ]
+    ++ optionals buildPythonBindings [ "python" ];
 
-  # Make it so that libsimgrid.so will be found when running programs from
-  # the build dir.
-  preConfigure = ''
-    export LD_LIBRARY_PATH="$PWD/build/lib"
-  '';
-
-  # Release mode is not supported in SimGrid
+  # "Release" does not work. non-debug mode is Debug compiled with optimization
   cmakeBuildType = "Debug";
-
-  # Disable/Enable functionality
-  # Note: those packages are not packaged in Nixpkgs yet so some options
-  # are disabled:
-  # - papi:   for enable_smpi_papi
-  # - ns3:    for enable_ns3
-  # - lua53:  for enable_lua
-  #
-  # For more information see:
-  # https://simgrid.org/doc/3.22/Installing_SimGrid.html#simgrid-compilation-options)
   cmakeFlags = [
     "-Denable_documentation=${optionOnOff buildDocumentation}"
     "-Denable_java=${optionOnOff buildJavaBindings}"
+    "-Denable_python=${optionOnOff buildPythonBindings}"
+    "-DSIMGRID_PYTHON_LIBDIR=./" # prevents CMake to install in ${python3} dir
+    "-Denable_msg=${optionOnOff buildJavaBindings}"
     "-Denable_fortran=${optionOnOff fortranSupport}"
     "-Denable_model-checking=${optionOnOff modelCheckingSupport}"
     "-Denable_ns3=off"
@@ -75,27 +57,28 @@ stdenv.mkDerivation rec {
     "-Denable_mallocators=on"
     "-Denable_debug=on"
     "-Denable_smpi=on"
+    "-Dminimal-bindings=${optionOnOff minimalBindings}"
     "-Denable_smpi_ISP_testsuite=${optionOnOff moreTests}"
     "-Denable_smpi_MPICH3_testsuite=${optionOnOff moreTests}"
-    "-Denable_compile_warnings=${optionOnOff debug}"
-    "-Denable_compile_optimizations=${optionOnOff (!debug)}"
-    "-Denable_lto=${optionOnOff (!debug)}"
-    # "-Denable_lua=${optionOnOff luaSupport}"
-    # "-Denable_smpi_papi=${optionOnOff moreTests}"
+    "-Denable_compile_warnings=off"
+    "-Denable_compile_optimizations=${optionOnOff optimize}"
+    "-Denable_lto=${optionOnOff optimize}"
   ];
-
   makeFlags = optional debug "VERBOSE=1";
 
-  # Some Perl scripts are called to generate test during build which
-  # is before the fixupPhase, so do this manualy here:
+  # needed to run tests and to ensure correct shabangs in output scripts
   preBuild = ''
     patchShebangs ..
   '';
 
-  doCheck = true;
+  # needed by tests (so libsimgrid.so is found)
+  preConfigure = ''
+    export LD_LIBRARY_PATH="$PWD/build/lib"
+  '';
 
-  # Prevent the execution of tests known to fail.
+  doCheck = true;
   preCheck = ''
+    # prevent the execution of tests known to fail
     cat <<EOW >CTestCustom.cmake
     SET(CTEST_CUSTOM_TESTS_IGNORE smpi-replay-multiple)
     EOW
@@ -104,6 +87,20 @@ stdenv.mkDerivation rec {
     make tests -j $NIX_BUILD_CORES
   '';
 
+  postInstall = lib.optionalString withoutBin ''
+    # remove bin from output if requested.
+    # having a specific bin output would be cleaner but it does not work currently (circular references)
+    rm -rf $out/bin
+  '' + lib.optionalString buildPythonBindings ''
+    # manually install the python binding if requested.
+    mkdir -p $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
+    cp ./lib/simgrid.cpython*.so $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
+   '';
+
+  # improve debuggability if requested
+  hardeningDisable = lib.optionals debug [ "fortify" ];
+  dontStrip = debug;
+
   meta = {
     description = "Framework for the simulation of distributed applications";
     longDescription = ''