openjdk8: rework dependencies

This makes several adjustments around what is linked into JRE.

* system giflib, libjpeg, zlib are now used unconditionally;
* libstdc++ is linked dynamically.

For full version:

* GTK+ and GNOME libraries are linked;
* Extra X11 libraries are linked;
* CUPS is linked;
* libmagic (file) is linked.

For minimal version:

* All X11 support is removed;
* Sound support is removed.
* Fonts and their support are not lined.

jre8_headless is added as a minimal build.

Overall this adds support for all things GUI into the default Java build and
removes them from the minimal build.
This commit is contained in:
Nikolay Amiantov 2016-10-02 19:44:21 +03:00
parent ce8d2aad27
commit a15c943337
2 changed files with 35 additions and 19 deletions

View File

@ -1,8 +1,11 @@
{ stdenv, fetchurl, cpio, pkgconfig, file, which, unzip, zip, xorg, cups, freetype { stdenv, lib, fetchurl, cpio, pkgconfig, file, which, unzip, zip, cups, freetype
, alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib , alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib, lndir
, libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor
, libjpeg, giflib
, setJavaClassPath , setJavaClassPath
, minimal ? false , minimal ? false
, enableInfinality ? true # font rendering patch , enableInfinality ? true # font rendering patch
, enableGnome2 ? true, gtk2, gnome_vfs, glib, GConf
}: }:
let let
@ -65,10 +68,11 @@ let
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ buildInputs = [
cpio file which unzip zip cpio file which unzip zip perl bootjdk zlib cups freetype alsaLib
xorg.libX11 xorg.libXt xorg.libXext xorg.libXrender xorg.libXtst libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst
xorg.libXi xorg.libXinerama xorg.libXcursor xorg.lndir libXi libXinerama libXcursor lndir fontconfig
cups freetype alsaLib perl liberation_ttf fontconfig bootjdk zlib ] ++ lib.optionals (!minimal && enableGnome2) [
gtk2 gnome_vfs GConf glib
]; ];
prePatch = '' prePatch = ''
@ -82,10 +86,10 @@ let
./fix-java-home-jdk8.patch ./fix-java-home-jdk8.patch
./read-truststore-from-env-jdk8.patch ./read-truststore-from-env-jdk8.patch
./currency-date-range-jdk8.patch ./currency-date-range-jdk8.patch
] ++ (if enableInfinality then [ ] ++ lib.optionals (!minimal && enableInfinality) [
./004_add-fontconfig.patch ./004_add-fontconfig.patch
./005_enable-infinality.patch ./005_enable-infinality.patch
] else []); ];
preConfigure = '' preConfigure = ''
chmod +x configure chmod +x configure
@ -101,21 +105,22 @@ let
"--enable-unlimited-crypto" "--enable-unlimited-crypto"
"--disable-debug-symbols" "--disable-debug-symbols"
"--disable-freetype-bundling" "--disable-freetype-bundling"
"--with-zlib=system"
"--with-giflib=system"
"--with-stdc++lib=dynamic"
# glibc 2.24 deprecated readdir_r so we need this # glibc 2.24 deprecated readdir_r so we need this
# See https://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg49006.html # See https://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg49006.html
"--with-extra-cflags=\"-Wno-error=deprecated-declarations\"" "--with-extra-cflags=\"-Wno-error=deprecated-declarations\""
] ++ (if minimal then [ ] ++ lib.optional minimal "--disable-headful";
"--disable-headful"
"--with-zlib=bundled"
"--with-giflib=bundled"
] else [
"--with-zlib=system"
]);
NIX_LDFLAGS= if minimal then null else "-lfontconfig"; NIX_LDFLAGS= lib.optionals (!minimal) [
"-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic"
] ++ lib.optionals (!minimal && enableGnome2) [
"-lgtk-x11-2.0" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2"
];
buildFlags = "all"; buildFlags = [ "all" ];
installPhase = '' installPhase = ''
mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk
@ -135,12 +140,19 @@ let
# Remove crap from the installation. # Remove crap from the installation.
rm -rf $out/lib/openjdk/demo $out/lib/openjdk/sample rm -rf $out/lib/openjdk/demo $out/lib/openjdk/sample
${lib.optionalString minimal ''
rm $out/lib/openjdk/jre/lib/${architecture}/{libjsound,libjsoundalsa,libsplashscreen,libawt*,libfontmanager}.so
rm $out/lib/openjdk/jre/bin/policytool
rm $out/lib/openjdk/bin/{policytool,appletviewer}
''}
# Move the JRE to a separate output and setup fallback fonts # Move the JRE to a separate output and setup fallback fonts
mv $out/lib/openjdk/jre $jre/lib/openjdk/ mv $out/lib/openjdk/jre $jre/lib/openjdk/
mkdir $out/lib/openjdk/jre mkdir $out/lib/openjdk/jre
${lib.optionalString (!minimal) ''
mkdir -p $jre/lib/openjdk/jre/lib/fonts/fallback mkdir -p $jre/lib/openjdk/jre/lib/fonts/fallback
lndir ${liberation_ttf}/share/fonts/truetype $jre/lib/openjdk/jre/lib/fonts/fallback lndir ${liberation_ttf}/share/fonts/truetype $jre/lib/openjdk/jre/lib/fonts/fallback
''}
lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre
rm -rf $out/lib/openjdk/jre/bina rm -rf $out/lib/openjdk/jre/bina

View File

@ -4862,6 +4862,7 @@ in
else else
callPackage ../development/compilers/openjdk/8.nix { callPackage ../development/compilers/openjdk/8.nix {
bootjdk = callPackage ../development/compilers/openjdk/bootstrap.nix { version = "8"; }; bootjdk = callPackage ../development/compilers/openjdk/bootstrap.nix { version = "8"; };
inherit (gnome2) GConf gnome_vfs;
}; };
openjdk = if stdenv.isDarwin then openjdk7 else openjdk8; openjdk = if stdenv.isDarwin then openjdk7 else openjdk8;
@ -4875,6 +4876,9 @@ in
jre8 = lib.setName "openjre-${lib.getVersion pkgs.openjdk8.jre}" jre8 = lib.setName "openjre-${lib.getVersion pkgs.openjdk8.jre}"
(lib.addMetaAttrs { outputsToInstall = [ "jre" ]; } (lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
(openjdk8.jre // { outputs = [ "jre" ]; })); (openjdk8.jre // { outputs = [ "jre" ]; }));
jre8_headless = lib.setName "openjre-${lib.getVersion pkgs.openjdk8.jre}-headless"
(lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
((openjdk8.override { minimal = true; }).jre // { outputs = [ "jre" ]; }));
jdk = if stdenv.isDarwin then jdk7 else jdk8; jdk = if stdenv.isDarwin then jdk7 else jdk8;
jre = if stdenv.isDarwin then jre7 else jre8; jre = if stdenv.isDarwin then jre7 else jre8;