summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-06-08 13:56:14 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-06-08 13:56:29 -0700
commit240338638e064b786e85a549aa70cb9a5caabc29 (patch)
tree7eca08ecc021b65f58304fad49adf2d8ca3b6a03
parentae6d05618834aa42e88177039baba5ba18661285 (diff)
downloadnixlib-240338638e064b786e85a549aa70cb9a5caabc29.tar
nixlib-240338638e064b786e85a549aa70cb9a5caabc29.tar.gz
nixlib-240338638e064b786e85a549aa70cb9a5caabc29.tar.bz2
nixlib-240338638e064b786e85a549aa70cb9a5caabc29.tar.lz
nixlib-240338638e064b786e85a549aa70cb9a5caabc29.tar.xz
nixlib-240338638e064b786e85a549aa70cb9a5caabc29.tar.zst
nixlib-240338638e064b786e85a549aa70cb9a5caabc29.zip
openjdk7: Fix refernces to the bootstrap
-rw-r--r--pkgs/development/compilers/openjdk/default.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/development/compilers/openjdk/default.nix b/pkgs/development/compilers/openjdk/default.nix
index 9bdea7bc7ab9..be4ca84bd8dd 100644
--- a/pkgs/development/compilers/openjdk/default.nix
+++ b/pkgs/development/compilers/openjdk/default.nix
@@ -203,6 +203,32 @@ let
       EOF
     '';
 
+    postFixup = ''
+      # Build the set of output library directories to rpath against
+      LIBDIRS=""
+      for output in $outputs; do
+        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':'):$LIBDIRS"
+      done
+
+      # Add the local library paths to remove dependencies on the bootstrap
+      for output in $outputs; do
+        OUTPUTDIR="$(eval echo \$$output)"
+        BINLIBS="$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)"
+        echo "$BINLIBS" | while read i; do
+          patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
+          patchelf --shrink-rpath "$i" || true
+        done
+      done
+
+      # Test to make sure that we don't depend on the bootstrap
+      for output in $outputs; do
+        if grep -q -r '${bootjdk}' $(eval echo \$$output); then
+          echo "Extraneous references to ${bootjdk} detected"
+          exit 1
+        fi
+      done
+    '';
+
     meta = {
       homepage = http://openjdk.java.net/;
       license = stdenv.lib.licenses.gpl2;