libreoffice: replace openjdk runtime-input with minimal JRE

Previously, `pkgs.libreoffice` had a total closure-size of 2.4GB where
`pkgs.openjdk` was a significant part:

    $ nix path-info ./result -Sh
    /nix/store/7xyfklmiz2azcnrfa8n9cz12dyyqc85r-libreoffice-7.1.7.2	   2.4G
    $ nix path-info ./result -shr | grep openjdk
    /nix/store/qcn7ihaak9g8ayyj4995ila2z0pkm37i-openjdk-17.0.1+12             	 643.6M

However we need exactly two components:

* a `javac` from `pkgs.openjdk`
* a minimal runtime (i.e. a JRE) for `libofficebean.so` where
  `libjawt.so` is also available.

I moved `jdk` to the `nativeBuildInputs` to ensure that `javac` is still
available in the build-environment and created a minimal JRE that seems
sufficient.

Now, the total closure-size is reduced by ~29.1% (basically the 600M
from `pkgs.openjdk`):

    $ nix path-info ./result -Sh
    /nix/store/zv34xijv64k7sz7rv50g3v6y59qg7p8k-libreoffice-7.1.7.2	   1.7G
This commit is contained in:
Maximilian Bosch 2021-11-23 19:15:24 +01:00
parent c70341a409
commit 2f9426ad83
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -2,7 +2,7 @@
, IOCompress, zlib, libjpeg, expat, freetype, libwpd
, libxml2, db, curl, fontconfig, libsndfile, neon
, bison, flex, zip, unzip, gtk3, libmspack, getopt, file, cairo, which
, icu, boost, jdk, ant, cups, xorg, fontforge
, icu, boost, jdk, ant, cups, xorg, fontforge, jre_minimal
, openssl, gperf, cppunit, poppler, util-linux
, librsvg, libGLU, libGL, bsh, CoinMP, libwps, libabw, libmysqlclient
, autoconf, automake, openldap, bash, hunspell, librdf_redland, nss, nspr
@ -24,6 +24,10 @@
assert builtins.elem variant [ "fresh" "still" ];
let
jre' = jre_minimal.override {
modules = [ "java.base" "java.desktop" ];
};
importVariant = f: import (./. + "/src-${variant}/${f}");
primary-src = importVariant "primary.nix" { inherit fetchurl; };
@ -318,7 +322,6 @@ in (mkDrv rec {
"--enable-dbus"
"--enable-release-build"
"--enable-epm"
"--with-jdk-home=${jdk.home}"
"--with-ant-home=${ant}/lib/ant"
"--with-system-cairo"
"--with-system-libs"
@ -379,7 +382,7 @@ in (mkDrv rec {
'';
nativeBuildInputs = [
gdb fontforge autoconf automake bison pkg-config libtool
gdb fontforge autoconf automake bison pkg-config libtool jdk
] ++ lib.optional (!kdeIntegration) wrapGAppsHook
++ lib.optional kdeIntegration wrapQtAppsHook;
@ -387,7 +390,7 @@ in (mkDrv rec {
[ ant ArchiveZip boost box2d cairo clucene_core
IOCompress cppunit cups curl db dbus-glib expat file flex fontconfig
freetype getopt gperf gtk3
hunspell icu jdk lcms libcdr libexttextcat unixODBC libjpeg
hunspell icu jre' lcms libcdr libexttextcat unixODBC libjpeg
libmspack librdf_redland librsvg libsndfile libvisio libwpd libwpg libX11
libXaw libXext libXi libXinerama libxml2 libxslt libXtst
libXdmcp libpthreadstubs libGLU libGL mythes
@ -407,7 +410,8 @@ in (mkDrv rec {
++ lib.optional kdeIntegration [ qtbase qtx11extras kcoreaddons kio ];
passthru = {
inherit srcs jdk;
inherit srcs;
jdk = jre';
};
requiredSystemFeatures = [ "big-parallel" ];