* Use patchelf to remove unnecessary directories automatically (in the

installation phase) from the rpaths of ELF executables and
  libraries.  This results in smaller closures.

svn path=/nixpkgs/trunk/; revision=1534
This commit is contained in:
Eelco Dolstra 2004-10-02 18:27:50 +00:00
parent 8cb8bdd418
commit b6001eed67
4 changed files with 22 additions and 4 deletions

View File

@ -1,10 +1,10 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "patchelf-0.1pre1514";
name = "patchelf-0.1pre1513";
src = fetchurl {
url = http://catamaran.labs.cs.uu.nl/dist/nix/patchelf-0.1pre1514/patchelf-0.1pre1514.tar.gz;
md5 = "b3d82ce1dc68304770fe5411ed718e3a";
url = http://losser.st-lab.cs.uu.nl/~eelco/dist/patchelf-0.1pre1513.tar.gz;
md5 = "874928f46117828c1d8019986aa2eaac";
};
# src = /home/eelco/Dev/patchelf/patchelf-0.1.tar.gz;
}

View File

@ -527,6 +527,16 @@ checkPhase() {
}
patchELF() {
# Patch all ELF executables and shared libraries.
header "patching ELF executables and libraries"
find "$prefix" \( -name "*.so*" -o \
\( -type f -a -perm +0100 \) \
\) -exec patchelf --shrink-rpath {} \;
stopNest
}
installW() {
if test -n "$installPhase"; then
$installPhase
@ -549,6 +559,10 @@ installW() {
-exec strip -S {} \; || fail
fi
if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then
patchELF "$prefix"
fi
if test -n "$propagatedBuildInputs"; then
ensureDir "$out/nix-support"
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"

View File

@ -3,7 +3,10 @@
genericStdenv {
name = "stdenv-nix-linux";
preHook = ./prehook.sh;
initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
initialPath = [
((import ../nix/path.nix) {pkgs = pkgs;})
pkgs.patchelf
];
inherit stdenv;

View File

@ -1 +1,2 @@
export NIX_ENFORCE_PURITY=1
havePatchELF=1