pmix: split output -> out, dev

This reduces the run time closure from 334 MB to 37.8 MB,
mainly by removing gcc from the closure:

nix path-info -hS
/nix/store/jddsvgvf0ayj5x1df9yaa74lhaz6sjz2-pmix-5.0.1     4.1M  334.2M
/nix/store/n6p56psvwpj419f6cjbdlyiri1mv498f-pmix-5.0.1     2.7M   37.8M
This commit is contained in:
Markus Kowalewski 2024-01-17 16:35:51 +01:00
parent a20f3db995
commit 67646d0433

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;