openjdk8: enable fontconfig, add fallback fonts and fix emacs highlighting

This commit is contained in:
Edward Tjörnhammar 2015-04-25 00:22:41 +02:00
parent 076dff2f58
commit ad03fb11b3

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, cpio, file, which, unzip, zip, xorg, cups, freetype, alsaLib, openjdk, cacert, perl } : { stdenv, fetchurl, cpio, file, which, unzip, zip, xorg, cups, freetype, alsaLib, openjdk, cacert, perl, liberation_ttf, fontconfig } :
let let
update = "40"; update = "40";
build = "25"; build = "25";
@ -39,12 +39,12 @@ let
}; };
openjdk8 = stdenv.mkDerivation { openjdk8 = stdenv.mkDerivation {
name = "openjdk-8u${update}b${build}"; name = "openjdk-8u${update}b${build}";
srcs = [jdk8 langtools hotspot corba jdk jaxws jaxp nashorn]; srcs = [ jdk8 langtools hotspot corba jdk jaxws jaxp nashorn ];
outputs = [ "out" "jre" ]; outputs = [ "out" "jre" ];
buildInputs = [ cpio file which unzip zip buildInputs = [ cpio file which unzip zip
xorg.libX11 xorg.libXt xorg.libXext xorg.libXrender xorg.libXtst xorg.libX11 xorg.libXt xorg.libXext xorg.libXrender xorg.libXtst
xorg.libXi xorg.libXinerama xorg.libXcursor xorg.lndir xorg.libXi xorg.libXinerama xorg.libXcursor xorg.lndir
cups freetype alsaLib openjdk perl ]; cups freetype alsaLib openjdk perl liberation_ttf fontconfig ];
setSourceRoot = '' setSourceRoot = ''
sourceRoot="jdk8u${update}-jdk8u${update}-b${build}"; sourceRoot="jdk8u${update}-jdk8u${update}-b${build}";
''; '';
@ -77,18 +77,19 @@ let
"--with-build-number=b${build}" "--with-build-number=b${build}"
"--with-milestone=fcs" "--with-milestone=fcs"
]; ];
NIX_LDFLAGS= "-lfontconfig";
buildFlags = "DEBUG_BINARIES=true all"; buildFlags = "DEBUG_BINARIES=true all";
installPhase = '' installPhase = ''
mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk
cp -av build/*/images/j2sdk-image/* $out/lib/openjdk cp -av build"/"*/images/j2sdk-image"/"* $out/lib/openjdk
# Move some stuff to top-level. # Move some stuff to top-level.
mv $out/lib/openjdk/include $out/include mv $out/lib/openjdk/include $out/include
mv $out/lib/openjdk/man $out/share/man mv $out/lib/openjdk/man $out/share/man
# jni.h expects jni_md.h to be in the header search path. # jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/ ln -s $out/include/linux"/"*_md.h $out/include/
# Remove some broken manpages. # Remove some broken manpages.
rm -rf $out/share/man/ja* rm -rf $out/share/man/ja*
@ -96,16 +97,18 @@ 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
# Move the JRE to a separate output. # 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
mkdir -p $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
ln -s $out/lib/openjdk/bin $out/lib/openjdk/jre/bin ln -s $out/lib/openjdk/bin $out/lib/openjdk/jre/bin
# Set PaX markings # Set PaX markings
exes=$(file $out/lib/openjdk/bin/* $jre/lib/openjdk/jre/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//') exes=$(file $out/lib/openjdk/bin"/"* $jre/lib/openjdk/jre/bin"/"* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//')
echo "to mark: *$exes*" echo "to mark: *$exes*"
for file in $exes; do for file in $exes; do
echo "marking *$file*" echo "marking *$file*"
@ -128,15 +131,16 @@ let
ln -s $out/lib/openjdk/bin $out/bin ln -s $out/lib/openjdk/bin $out/bin
ln -s $jre/lib/openjdk/jre/bin $jre/bin ln -s $jre/lib/openjdk/jre/bin $jre/bin
''; '';
meta = { meta = with stdenv.lib; {
homepage = http://openjdk.java.net/; homepage = http://openjdk.java.net/;
license = stdenv.lib.licenses.gpl2; license = licenses.gpl2;
description = "The open-source Java Development Kit"; description = "The open-source Java Development Kit";
maintainers = [ stdenv.lib.maintainers.cocreature ]; maintainers = with maintainers; [ cocreature edwtjo ];
platforms = stdenv.lib.platforms.linux; platforms = platforms.linux;
}; };
passthru.home = "${openjdk8}/lib/openjdk"; passthru.home = "${openjdk8}/lib/openjdk";
}; in openjdk8 }; in openjdk8