Merge pull request #282034 from markuskowa/fix-closure-pmix

pmix: split outputs to out and dev
This commit is contained in:
markuskowa 2024-01-23 22:57:40 +01:00 committed by GitHub
commit 407a0285c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 4 deletions

View File

@ -36,14 +36,16 @@ stdenv.mkDerivation rec {
"FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
"FCFLAGS=-fallow-argument-mismatch"
] ++ lib.optionals pmixSupport [
"--with-pmix=${lib.getDev pmix}"
"--with-pmix"
];
enableParallelBuilding = true;
nativeBuildInputs = [ gfortran python3 ];
buildInputs = [ perl openssh hwloc ]
++ lib.optional (!stdenv.isDarwin) ch4backend;
++ lib.optional (!stdenv.isDarwin) ch4backend
++ lib.optional pmixSupport pmix;
doCheck = true;

View File

@ -1,5 +1,7 @@
{ lib, stdenv, fetchFromGitHub, perl, autoconf, automake
, libtool, python3, flex, libevent, hwloc, munge, zlib, pandoc, gitMinimal
, removeReferencesTo, libtool, python3, flex, libevent
, targetPackages, makeWrapper
, hwloc, munge, zlib, pandoc, gitMinimal
} :
stdenv.mkDerivation rec {
@ -14,6 +16,8 @@ stdenv.mkDerivation rec {
fetchSubmodules = true;
};
outputs = [ "out" "dev" ];
postPatch = ''
patchShebangs ./autogen.pl
patchShebangs ./config
@ -28,6 +32,8 @@ stdenv.mkDerivation rec {
flex
gitMinimal
python3
removeReferencesTo
makeWrapper
];
buildInputs = [ libevent hwloc munge zlib ];
@ -46,6 +52,27 @@ stdenv.mkDerivation rec {
postInstall = ''
find $out/lib/ -name "*.la" -exec rm -f \{} \;
moveToOutput "bin/pmix_info" "''${!outputDev}"
moveToOutput "bin/pmixcc" "''${!outputDev}"
moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}"
# The path to the pmixcc-wrapper-data.txt is hard coded and
# points to $out instead of dev. Use wrapper to fix paths.
wrapProgram $dev/bin/pmixcc \
--set PMIX_INCLUDEDIR $dev/include \
--set PMIX_PKGDATADIR $dev/share/pmix
'';
postFixup = ''
# The build info (parameters to ./configure) are hardcoded
# into the library. This clears all references to $dev/include.
remove-references-to -t $dev $(readlink -f $out/lib/libpmix.so)
# Pin the compiler to the current version in a cross compiler friendly way.
# Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427).
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$dev/share/pmix/pmixcc-wrapper-data.txt
'';
enableParallelBuilding = true;

View File

@ -37,6 +37,13 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace src/common/env.c \
--replace "/bin/echo" "${coreutils}/bin/echo"
# Autoconf does not support split packages for pmix (libs and headers).
# Fix the path to the pmix libraries, so dlopen can find it.
substituteInPlace src/plugins/mpi/pmix/mpi_pmix.c \
--replace 'xstrfmtcat(full_path, "%s/", PMIXP_LIBPATH)' \
'xstrfmtcat(full_path, "${lib.getLib pmix}/lib/")'
'' + (lib.optionalString enableX11 ''
substituteInPlace src/common/x11_util.c \
--replace '"/usr/bin/xauth"' '"${xorg.xauth}/bin/xauth"'
@ -68,7 +75,7 @@ stdenv.mkDerivation rec {
"--with-yaml=${lib.getDev libyaml}"
"--with-ofed=${lib.getDev rdma-core}"
"--sysconfdir=/etc/slurm"
"--with-pmix=${pmix}"
"--with-pmix=${lib.getDev pmix}"
"--with-bpf=${libbpf}"
"--without-rpath" # Required for configure to pick up the right dlopen path
] ++ (optional enableGtk2 "--disable-gtktest")