[Nix-dev] nix function patchelfExecutables - does this make sense?

Marc Weber marco-oweber at gmx.de
Wed Aug 15 00:31:54 CEST 2007


Could be applied to ghcboot and acroread (if buildInputs would be used
instead of libPath ..  adding more libraries to rpath than necessary
doesn't harm, does it? As long as they belong to the nix system ..)

  patchelfExecutables = drv : drv // {
    postBuild =     
        " 
          # copied and modified from acroread and ghcboot

          fullPath=
          for i in \$buildInputs; do
              fullPath=\$fullPath\${fullPath:+:}\$i/lib
          done

          find . -type f -perm +100 \\
          -exec patchelf --interpreter \"\$(cat \$NIX_GCC/nix-support/dynamic-linker)\" \\
          --set-rpath \$fullPath {};

          # in case the installation took place in the build script
          find \$out -type f -perm +100 \\
          -exec patchelf --interpreter \"$(cat \$NIX_GCC/nix-support/dynamic-linker)\" \\
          --set-rpath \$fullPath {};
        ";
  };

Marc Weber



More information about the nix-dev mailing list