@ -1,4 +1,4 @@
{ stdenv , lib , fetchurl , bash , cpio , pkgconfig , file , which , unzip , zip , cups , freetype
{ stdenv , lib , fetchurl , bash , cpio , autoconf , pkgconfig , file , which , unzip , zip , cups , freetype
, alsaLib , bootjdk , perl , liberation_ttf , fontconfig , zlib , lndir
, libX11 , libICE , libXrender , libXext , libXt , libXtst , libXi , libXinerama , libXcursor , libXrandr
, libjpeg , giflib
@ -10,31 +10,30 @@
let
/* *
* The JRE libraries are in directories that depend on the CPU .
* The JDK libraries are in directories that depend on the CPU .
* /
architecture =
if stdenv . hostPlatform . system == " i 6 8 6 - l i n u x " then
" i 3 8 6 "
else " a m d 6 4 " ;
update = " 1 0 . 0 . 2 " ;
major = " 1 1 " ;
update = " . 0 . 1 " ;
build = " 1 3 " ;
repover = " j d k - ${ update } + ${ build } " ;
repover = " j d k - ${ major } ${ update } + ${ build } " ;
paxflags = if stdenv . isi686 then " m s p " else " m " ;
openjdk10 = stdenv . mkDerivation {
name = " o p e n j d k - ${ update } - b ${ build } " ;
openjdk = stdenv . mkDerivation {
name = " o p e n j d k - ${ major } ${ update } - b ${ build } " ;
src = fetchurl {
url = " h t t p : / / h g . o p e n j d k . j a v a . n e t / j d k - u p d a t e s / j d k 1 0 u / a r c h i v e / ${ repover } . t a r . g z " ;
sha256 = " 0 y 7 h y z g v n 6 z 8 g y p 3 h 9 x v x w j 6 z d a 8 9 9 y 6 i 6 2 9 j n 6 y x q z j 9 6 q 5 6 j p k " ;
url = " h t t p : / / h g . o p e n j d k . j a v a . n e t / j d k - u p d a t e s / j d k ${ major } u / a r c h i v e / ${ repover } . t a r . g z " ;
sha256 = " 1 r i 3 f v 6 7 r v s 9 x x h c 3 y n k l b p r h x b d s g p w a f b w 6 w q j 9 5 0 x y 5 c r g y s m " ;
} ;
outputs = [ " o u t " " j r e " ] ;
nativeBuildInputs = [ pkgconfig ] ;
buildInputs = [
cpio file which unzip zip perl bootjdk zlib cups freetype alsaLib
autoconf cpio file which unzip zip perl bootjdk zlib cups freetype alsaLib
libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst
libXi libXinerama libXcursor libXrandr lndir fontconfig
] ++ lib . optionals ( ! minimal && enableGnome2 ) [
@ -55,12 +54,11 @@ let
configureFlagsArray = (
" - - w i t h - b o o t - j d k = ${ bootjdk . home } "
" - - w i t h - u p d a t e - v e r s i o n = ${ update } "
" - - w i t h - u p d a t e - v e r s i o n = ${ major } ${ update } "
" - - w i t h - b u i l d - n u m b e r = ${ build } "
" - - w i t h - m i l e s t o n e = f c s "
" - - e n a b l e - u n l i m i t e d - c r y p t o "
" - - d i s a b l e - d e b u g - s y m b o l s "
" - - d i s a b l e - f r e e t y p e - b u n d l i n g "
" - - w i t h - z l i b = s y s t e m "
" - - w i t h - g i f l i b = s y s t e m "
" - - w i t h - s t d c + + l i b = d y n a m i c "
@ -86,7 +84,7 @@ let
buildFlags = [ " a l l " ] ;
installPhase = ''
mkdir - p $ out/lib/openjdk $ out/share $ jre/lib/openjdk
mkdir - p $ out/lib/openjdk $ out/share
cp - av build /* / i m a g e s / j d k / * $ o u t / l i b / o p e n j d k
@ -101,57 +99,29 @@ let
# jni.h expects jni_md.h to be in the header search path.
ln - s $ out/include/linux /* _ m d . h $ o u t / i n c l u d e /
# Copy the JRE to a separate output and setup fallback fonts
cp - av build /* / i m a g e s / j r e $ j r e / l i b / o p e n j d k /
mkdir $ out/lib/openjdk/jre
$ { lib . optionalString ( ! minimal ) ''
mkdir - p $ jre/lib/openjdk/jre/lib/fonts/fallback
lndir $ { liberation_ttf } /share/fonts/truetype $ jre/lib/openjdk/jre/lib/fonts/fallback
'' }
# Remove crap from the installation.
rm - rf $ out/lib/openjdk/demo
$ { lib . optionalString minimal ''
for d in $ out/lib/openjdk/lib $ jre/lib/openjdk/jre/lib ; do
rm '' ${ d } / { l i b j s o u n d , l i b j s o u n d a l s a , l i b f o n t m a n a g e r } . s o
done
rm $ out/lib/openjdk/lib / { libjsound , libfontmanager } . so
'' }
lndir $ jre/lib/openjdk/jre $ out/lib/openjdk/jre
# Set PaX markings
exes = $ ( file $ out/lib/openjdk/bin /* $ j r e / l i b / o p e n j d k / j r e / b i n / * 2 > / d e v / n u l l | g r e p - E ' E L F . * ( e x e c u t a b l e | s h a r e d o b j e c t ) ' | s e d - e ' s / : . * $ / / ' )
exes = $ ( file $ out/lib/openjdk/bin /* 2 > / d e v / n u l l | g r e p - E ' E L F . * ( e x e c u t a b l e | s h a r e d o b j e c t ) ' | s e d - e ' s / : . * $ / / ' )
echo " t o m a r k : * $ e x e s * "
for file in $ exes ; do
echo " m a r k i n g * $ f i l e * "
paxmark $ { paxflags } " $ f i l e "
done
# Remove duplicate binaries.
for i in $ ( cd $ out/lib/openjdk/bin && echo * ) ; do
if [ " $ i " = java ] ; then continue ; fi
if cmp - s $ out/lib/openjdk/bin / $ i $ jre/lib/openjdk/jre/bin / $ i ; then
ln - sfn $ jre/lib/openjdk/jre/bin / $ i $ out/lib/openjdk/bin / $ i
fi
done
ln - s $ out/lib/openjdk/bin $ out/bin
ln - s $ jre/lib/openjdk/jre/bin $ jre/bin
ln - s $ jre/lib/openjdk/jre $ out/jre
'' ;
# FIXME: this is unnecessary once the multiple-outputs branch is merged.
preFixup = ''
prefix = $ jre stripDirs " $ S T R I P " " $ s t r i p D e b u g L i s t " " ' ' ${ stripDebugFlags:--S } "
patchELF $ jre
propagatedBuildInputs + = " $ j r e "
# Propagate the setJavaClassPath setup hook from the JRE so that
# any package that depends on the JRE has $CLASSPATH set up
# properly.
mkdir - p $ jre/nix-support
# Propagate the setJavaClassPath setup hook so that any package
# that depends on the JDK has $CLASSPATH set up properly.
mkdir - p $ out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo - n " ${ setJavaClassPath } " > $ jre /nix-support/propagated-build-inputs
echo - n " ${ setJavaClassPath } " > $ out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
mkdir - p $ out/nix-support
@ -196,7 +166,7 @@ let
passthru = {
inherit architecture ;
home = " ${ openjdk10 } / l i b / o p e n j d k " ;
home = " ${ openjdk } / l i b / o p e n j d k " ;
} ;
} ;
in openjdk10
in openjdk