Merge pull request #115523 from raboof/jre_minimal-strip-library
jre_minimal: strip libraries
This commit is contained in:
commit
fb45a00d63
@ -1,19 +1,34 @@
|
|||||||
{ jdk
|
{ stdenv
|
||||||
, runCommand
|
, jdk
|
||||||
, patchelf
|
|
||||||
, lib
|
, lib
|
||||||
, modules ? [ "java.base" ]
|
, modules ? [ "java.base" ]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
jre = runCommand "${jdk.name}-jre" {
|
jre = stdenv.mkDerivation {
|
||||||
nativeBuildInputs = [ patchelf ];
|
name = "${jdk.name}-minimal-jre";
|
||||||
|
version = jdk.version;
|
||||||
|
|
||||||
buildInputs = [ jdk ];
|
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 = {
|
passthru = {
|
||||||
home = "${jre}";
|
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
|
in jre
|
||||||
|
Loading…
Reference in New Issue
Block a user