Merge pull request #157617 from mpoquet/simgrid-3.28-to-3.30

simgrid: 3.28 -> 3.30 + python + clean
This commit is contained in:
Renaud 2022-02-19 13:58:50 +01:00 committed by GitHub
commit 7f96f015f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = ''
@ -118,5 +115,6 @@ stdenv.mkDerivation rec {
license = licenses.lgpl2Plus;
maintainers = with maintainers; [ mickours mpoquet ];
platforms = platforms.all;
broken = stdenv.isDarwin;
};
}