summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-06-08 00:00:12 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-06-08 00:00:12 -0700
commit6e68e874b54849a7fe6d9be10dde24d203bfc90d (patch)
tree16b0dc2cab1242ac13b37b069a4a6fe160dd5272
parenta5ef488b11734c16151ddad5105c84fc155babf2 (diff)
downloadnixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.tar
nixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.tar.gz
nixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.tar.bz2
nixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.tar.lz
nixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.tar.xz
nixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.tar.zst
nixlib-6e68e874b54849a7fe6d9be10dde24d203bfc90d.zip
openjdk8: Fix refernces to the bootstrap
-rw-r--r--pkgs/development/compilers/openjdk/openjdk8.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/development/compilers/openjdk/openjdk8.nix b/pkgs/development/compilers/openjdk/openjdk8.nix
index dfac59d859fa..530391c8e7d6 100644
--- a/pkgs/development/compilers/openjdk/openjdk8.nix
+++ b/pkgs/development/compilers/openjdk/openjdk8.nix
@@ -150,6 +150,32 @@ let
       ln -s $jre/lib/openjdk/jre/bin $jre/bin
     '';
 
+    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 = with stdenv.lib; {
       homepage = http://openjdk.java.net/;
       license = licenses.gpl2;