Skip to content

Instantly share code, notes, and snippets.

@taku0
Created August 10, 2019 07:14
Show Gist options
  • Save taku0/74fe5aba9e9230b363dc8a19fc7c07f1 to your computer and use it in GitHub Desktop.
Save taku0/74fe5aba9e9230b363dc8a19fc7c07f1 to your computer and use it in GitHub Desktop.
diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix
index 96abdffe368..4b6e49e8b89 100644
--- a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix
+++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix
@@ -3,9 +3,9 @@ sourcePerArch:
{ stdenv
, lib
, fetchurl
-, autoPatchelfHook
, alsaLib
, freetype
+, fontconfig
, zlib
, xorg
}:
@@ -26,11 +26,30 @@ let result = stdenv.mkDerivation rec {
};
buildInputs = [
- alsaLib freetype zlib xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi
- xorg.libXrender
+ alsaLib freetype fontconfig zlib
+ xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender
];
- nativeBuildInputs = [ autoPatchelfHook ];
+ libraries = buildInputs;
+
+ rSubPaths = [
+ "lib/jli"
+ "lib/server"
+ "lib/compressedrefs" # OpenJ9
+ "lib/j9vm" # OpenJ9
+ "lib"
+ ];
+
+ postFixup = ''
+ rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$out/${a}") rSubPaths)}"
+ # set all the dynamic linkers
+ find $out -type f -perm -0100 \
+ -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+ --set-rpath "$rpath" {} \;
+ find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
+ '';
+
+ rpath = stdenv.lib.strings.makeLibraryPath libraries;
# See: https://github.com/NixOS/patchelf/issues/10
dontStrip = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment