summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pr/prrte/package.nix
blob: 48e132e0f8dd945792c821996d33fa90db71620f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
  lib,
  stdenv,
  removeReferencesTo,
  fetchFromGitHub,
  autoconf,
  automake,
  libtool,
  pkg-config,
  gitMinimal,
  perl,
  python3,
  flex,
  hwloc,
  libevent,
  zlib,
  pmix,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "prrte";
  version = "4.1.0";

  src = fetchFromGitHub {
    owner = "openpmix";
    repo = "prrte";
    tag = "v${finalAttrs.version}";
    hash = "sha256-FO2dFqvJ3Ahc7rE2gAiQhmM5GTc7LJ8nE4y5fe+FgDg=";
    fetchSubmodules = true;
  };

  outputs = [
    "out"
    "dev"
  ];

  postPatch = ''
    patchShebangs ./autogen.pl ./config

    # This is needed for multi-node jobs.
    # mpirun/srun/prterun does not have "prted" in its path unless
    # it is actively pulled in. Hard-coding the nix store path
    # as a default universally solves this issue.
    substituteInPlace src/runtime/prte_mca_params.c --replace-fail \
      "prte_launch_agent = \"prted\"" "prte_launch_agent = \"$out/bin/prted\""
  '';

  preConfigure = ''
    ./autogen.pl
    patchShebangs --build ./src/util/prte-convert-help.py
  '';

  postInstall = ''
    moveToOutput "bin/prte_info" "''${!outputDev}"
    moveToOutput "bin/prte-info" "''${!outputDev}"
    # Fix a broken symlink, created due to FHS assumptions
    rm "$out/bin/pcc"
    ln -s ${lib.getDev pmix}/bin/pmixcc "''${!outputDev}"/bin/pcc

    remove-references-to -t "''${!outputDev}" $(readlink -f $out/lib/libprrte${stdenv.hostPlatform.extensions.library})
  '';

  nativeBuildInputs = [
    removeReferencesTo
    perl
    python3
    autoconf
    automake
    libtool
    flex
    gitMinimal
    pkg-config
  ];

  buildInputs = [
    libevent
    hwloc
    zlib
    pmix
  ];

  # Setting this manually, required for RiscV cross-compile
  configureFlags = [
    "--with-pmix=${lib.getDev pmix}"
    "--with-pmix-libdir=${lib.getLib pmix}/lib"
  ];

  enableParallelBuilding = true;

  meta = {
    description = "PMIx Reference Runtime Environment";
    homepage = "https://docs.prrte.org/";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ markuskowa ];
    platforms = lib.platforms.unix;
  };
})