diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2004-10-02 18:27:50 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2004-10-02 18:27:50 +0000 |
commit | b6001eed67e4136c5f3a655712134851b582045a (patch) | |
tree | abe1f1172cdc54b4674c70998e8ab4eb238ebdb0 /pkgs/stdenv | |
parent | 8cb8bdd418cec8e9f95f93a2169327f2d16927cb (diff) | |
download | nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.tar nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.tar.gz nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.tar.bz2 nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.tar.lz nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.tar.xz nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.tar.zst nixpkgs-b6001eed67e4136c5f3a655712134851b582045a.zip |
* 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
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 14 | ||||
-rw-r--r-- | pkgs/stdenv/nix-linux/default.nix | 5 | ||||
-rw-r--r-- | pkgs/stdenv/nix-linux/prehook.sh | 1 |
3 files changed, 19 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 0e2dac944e3..901c461ee2b 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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" diff --git a/pkgs/stdenv/nix-linux/default.nix b/pkgs/stdenv/nix-linux/default.nix index c06f2cf815a..9c48b9ef0a4 100644 --- a/pkgs/stdenv/nix-linux/default.nix +++ b/pkgs/stdenv/nix-linux/default.nix @@ -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; diff --git a/pkgs/stdenv/nix-linux/prehook.sh b/pkgs/stdenv/nix-linux/prehook.sh index 08bb6c0332c..5b9c6f87879 100644 --- a/pkgs/stdenv/nix-linux/prehook.sh +++ b/pkgs/stdenv/nix-linux/prehook.sh @@ -1 +1,2 @@ export NIX_ENFORCE_PURITY=1 +havePatchELF=1 \ No newline at end of file |