1{
2 lib,
3 stdenv,
4 removeReferencesTo,
5 fetchFromGitHub,
6 autoconf,
7 automake,
8 libtool,
9 gitMinimal,
10 perl,
11 python3,
12 flex,
13 hwloc,
14 libevent,
15 zlib,
16 pmix,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "prrte";
21 version = "3.0.11";
22
23 src = fetchFromGitHub {
24 owner = "openpmix";
25 repo = "prrte";
26 rev = "v${version}";
27 hash = "sha256-4JEh4N/38k0Xgp0CqnFipaEZlJBQr8nyxoncyz0/7yo=";
28 fetchSubmodules = true;
29 };
30
31 outputs = [
32 "out"
33 "dev"
34 ];
35
36 postPatch = ''
37 patchShebangs ./autogen.pl ./config
38
39 # This is needed for multi-node jobs.
40 # mpirun/srun/prterun does not have "prted" in its path unless
41 # it is actively pulled in. Hard-coding the nix store path
42 # as a default universally solves this issue.
43 substituteInPlace src/runtime/prte_mca_params.c --replace-fail \
44 "prte_launch_agent = \"prted\"" "prte_launch_agent = \"$out/bin/prted\""
45 '';
46
47 preConfigure = ''
48 ./autogen.pl
49 '';
50
51 postInstall = ''
52 moveToOutput "bin/prte_info" "''${!outputDev}"
53 # Fix a broken symlink, created due to FHS assumptions
54 rm "$out/bin/pcc"
55 ln -s ${lib.getDev pmix}/bin/pmixcc "''${!outputDev}"/bin/pcc
56
57 remove-references-to -t "''${!outputDev}" $(readlink -f $out/lib/libprrte${stdenv.hostPlatform.extensions.library})
58 '';
59
60 nativeBuildInputs = [
61 removeReferencesTo
62 perl
63 python3
64 autoconf
65 automake
66 libtool
67 flex
68 gitMinimal
69 ];
70
71 buildInputs = [
72 libevent
73 hwloc
74 zlib
75 pmix
76 ];
77
78 # Setting this manually, required for RiscV cross-compile
79 configureFlags = [
80 "--with-pmix=${lib.getDev pmix}"
81 "--with-pmix-libdir=${lib.getLib pmix}/lib"
82 ];
83
84 enableParallelBuilding = true;
85
86 meta = {
87 description = "PMIx Reference Runtime Environment";
88 homepage = "https://docs.prrte.org/";
89 license = lib.licenses.bsd3;
90 maintainers = with lib.maintainers; [ markuskowa ];
91 platforms = lib.platforms.unix;
92 };
93}