diff options
author | Arnout Engelen <arnout@bzzt.net> | 2021-03-09 13:24:03 +0100 |
---|---|---|
committer | Arnout Engelen <arnout@bzzt.net> | 2021-03-11 14:27:02 +0100 |
commit | d3e904068665e9358afbd0757e87c941092620cf (patch) | |
tree | 1397e319747a0fb0cd664dd9a8c17fdb924e6388 | |
parent | 102eb68ceecbbd32ab1906a53ef5a7269dc9794a (diff) | |
download | nixlib-d3e904068665e9358afbd0757e87c941092620cf.tar nixlib-d3e904068665e9358afbd0757e87c941092620cf.tar.gz nixlib-d3e904068665e9358afbd0757e87c941092620cf.tar.bz2 nixlib-d3e904068665e9358afbd0757e87c941092620cf.tar.lz nixlib-d3e904068665e9358afbd0757e87c941092620cf.tar.xz nixlib-d3e904068665e9358afbd0757e87c941092620cf.tar.zst nixlib-d3e904068665e9358afbd0757e87c941092620cf.zip |
jre_minimal: strip libraries
runCommand doesn't invoke the automatic stripping from stdenv, expanding the derivation like this does. Fixes #115486
-rw-r--r-- | pkgs/development/compilers/openjdk/jre.nix | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/pkgs/development/compilers/openjdk/jre.nix b/pkgs/development/compilers/openjdk/jre.nix index 817cdf9c26a9..436bd0468c52 100644 --- a/pkgs/development/compilers/openjdk/jre.nix +++ b/pkgs/development/compilers/openjdk/jre.nix @@ -1,19 +1,34 @@ -{ jdk -, runCommand -, patchelf +{ stdenv +, jdk , lib , modules ? [ "java.base" ] }: let - jre = runCommand "${jdk.name}-jre" { - nativeBuildInputs = [ patchelf ]; + jre = stdenv.mkDerivation { + name = "${jdk.name}-minimal-jre"; + version = jdk.version; + buildInputs = [ jdk ]; + + dontUnpack = true; + + # Strip more heavily than the default '-S', since if you're + # using this derivation you probably care about this. + stripDebugFlags = [ "--strip-unneeded" ]; + + buildPhase = '' + runHook preBuild + + jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out + + runHook postBuild + ''; + + dontInstall = true; + passthru = { home = "${jre}"; }; - } '' - jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out - patchelf --shrink-rpath $out/bin/* $out/lib/jexec $out/lib/jspawnhelper $out/lib/*.so $out/lib/*/*.so - ''; + }; in jre |