diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/oraclejdk')
4 files changed, 291 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh b/nixpkgs/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh new file mode 100644 index 000000000000..459bfce50988 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh @@ -0,0 +1,60 @@ +source $stdenv/setup + +echo "Unpacking distribution" +unzip ${src} || true + +# set the dynamic linker of unpack200, necessary for construct script +echo "patching unpack200" +patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "" */bin/unpack200 + +echo "constructing JDK and JRE installations" +if test -z "$installjdk"; then + sh ${construct} . tmp-linux-jdk tmp-linux-jre + mkdir -p $out + cp -R tmp-linux-jre/* $out +else + sh ${construct} . $out tmp-linux-jre +fi + +echo "removing files at top level of installation" +for file in $out/* +do + if test -f $file ; then + rm $file + fi +done +rm -rf $out/docs + +# construct the rpath +rpath= +for i in $libraries; do + rpath=$rpath${rpath:+:}$i/lib +done + +if test -z "$installjdk"; then + jrePath=$out +else + jrePath=$out/jre +fi + +if test -n "$jce"; then + unzip $jce + cp -v jce/*.jar $jrePath/lib/security +fi + +rpath=$rpath${rpath:+:}$jrePath/lib/$architecture/jli + +# set all the dynamic linkers +find $out -type f -perm -0100 \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "$rpath" {} \; + +find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \; + +if test -z "$pluginSupport"; then + rm -f $out/bin/javaws +fi + +mkdir $jrePath/lib/$architecture/plugins +ln -s $jrePath/lib/$architecture/libnpjp2.so $jrePath/lib/$architecture/plugins + diff --git a/nixpkgs/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix new file mode 100644 index 000000000000..8342c9fd3359 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix @@ -0,0 +1,203 @@ +{ productVersion +, patchVersion +, buildVersion +, sha256 +, jceName +, releaseToken +, sha256JCE +}: + +{ swingSupport ? true +, stdenv +, fetchurl +, makeWrapper +, unzip +, file +, xorg ? null +, installjdk ? true +, pluginSupport ? true +, installjce ? false +, config +, licenseAccepted ? config.oraclejdk.accept_license or false +, glib +, libxml2 +, libav_0_8 +, ffmpeg +, libxslt +, libGL +, freetype +, fontconfig +, gtk2 +, pango +, cairo +, alsaLib +, atk +, gdk_pixbuf +, setJavaClassPath +}: + +assert swingSupport -> xorg != null; + +if !licenseAccepted then throw '' + You must accept the Oracle Binary Code License Agreement for Java SE at + https://www.oracle.com/technetwork/java/javase/terms/license/index.html + by setting nixpkgs config option 'oraclejdk.accept_license = true;' + '' +else assert licenseAccepted; + +let + + /** + * The JRE libraries are in directories that depend on the CPU. + */ + architecture = { + i686-linux = "i386"; + x86_64-linux = "amd64"; + armv7l-linux = "arm"; + aarch64-linux = "aarch64"; + }.${stdenv.hostPlatform.system}; + + jce = + if installjce then + fetchurl { + url = "http://download.oracle.com/otn-pub/java/jce/${productVersion}/${jceName}"; + sha256 = sha256JCE; + curlOpts = "-b oraclelicense=a"; + } + else + ""; + + rSubPaths = [ + "lib/${architecture}/jli" + "lib/${architecture}/server" + "lib/${architecture}/xawt" + "lib/${architecture}" + ]; + +in + +assert sha256 ? ${stdenv.hostPlatform.system}; + +let result = stdenv.mkDerivation rec { + name = + if installjdk then "oraclejdk-${productVersion}u${patchVersion}" else "oraclejre-${productVersion}u${patchVersion}"; + + src = let + platformName = { + i686-linux = "linux-i586"; + x86_64-linux = "linux-x64"; + armv7l-linux = "linux-arm32-vfp-hflt"; + aarch64-linux = "linux-arm64-vfp-hflt"; + }.${stdenv.hostPlatform.system}; + in fetchurl { + url = "http://download.oracle.com/otn-pub/java/jdk/${productVersion}u${patchVersion}-b${buildVersion}/${releaseToken}/jdk-${productVersion}u${patchVersion}-${platformName}.tar.gz"; + curlOpts = "-b oraclelicense=a"; + sha256 = sha256.${stdenv.hostPlatform.system}; + }; + + nativeBuildInputs = [ file ] + ++ stdenv.lib.optional installjce unzip; + + buildInputs = [ makeWrapper ]; + + # See: https://github.com/NixOS/patchelf/issues/10 + dontStrip = 1; + + installPhase = '' + cd .. + + if test -z "$installjdk"; then + mv $sourceRoot/jre $out + else + mv $sourceRoot $out + fi + + shopt -s extglob + for file in $out/!(*src.zip) + do + if test -f $file ; then + rm $file + fi + done + + if test -n "$installjdk"; then + for file in $out/jre/* + do + if test -f $file ; then + rm $file + fi + done + fi + + if test -z "$installjdk"; then + jrePath=$out + else + jrePath=$out/jre + fi + + if test -n "${jce}"; then + unzip ${jce} + cp -v UnlimitedJCEPolicy*/*.jar $jrePath/lib/security + fi + + if test -z "$pluginSupport"; then + rm -f $out/bin/javaws + if test -n "$installjdk"; then + rm -f $out/jre/bin/javaws + fi + fi + + mkdir $jrePath/lib/${architecture}/plugins + ln -s $jrePath/lib/${architecture}/libnpjp2.so $jrePath/lib/${architecture}/plugins + + mkdir -p $out/nix-support + printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs + + # Set JAVA_HOME automatically. + cat <<EOF >> $out/nix-support/setup-hook + if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + EOF + ''; + + postFixup = '' + rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$jrePath/${a}") rSubPaths)}" + + # set all the dynamic linkers + find $out -type f -perm -0100 \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "$rpath" {} \; + + find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \; + + # Oracle Java Mission Control needs to know where libgtk-x11 and related is + if test -n "$installjdk" -a -x $out/bin/jmc; then + wrapProgram "$out/bin/jmc" \ + --suffix-each LD_LIBRARY_PATH ':' "$rpath" + fi + ''; + + inherit installjdk pluginSupport; + + /** + * libXt is only needed on amd64 + */ + libraries = + [stdenv.cc.libc glib libxml2 libav_0_8 ffmpeg libxslt libGL xorg.libXxf86vm alsaLib fontconfig freetype pango gtk2 cairo gdk_pixbuf atk] ++ + (if swingSupport then [xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp xorg.libXt xorg.libXrender stdenv.cc.cc] else []); + + rpath = stdenv.lib.strings.makeLibraryPath libraries; + + passthru.mozillaPlugin = if installjdk then "/jre/lib/${architecture}/plugins" else "/lib/${architecture}/plugins"; + + passthru.jre = result; # FIXME: use multiple outputs or return actual JRE package + + passthru.home = result; + + passthru.architecture = architecture; + + meta = with stdenv.lib; { + license = licenses.unfree; + platforms = [ "i686-linux" "x86_64-linux" "armv7l-linux" "aarch64-linux" ]; # some inherit jre.meta.platforms + }; + +}; in stdenv.lib.trivial.warn "Public updates for Oracle Java SE 8 released after January 2019 will not be available for business, commercial or production use without a commercial license. See https://java.com/en/download/release_notice.jsp for more information." result diff --git a/nixpkgs/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix new file mode 100644 index 000000000000..81f4ef3c7dba --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix @@ -0,0 +1,14 @@ +# http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html; +# jce download url: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html; +import ./jdk-linux-base.nix { + productVersion = "8"; + patchVersion = "201"; + buildVersion = "09"; + sha256.i686-linux = "1f9n93zmkggchaxkchp4bqasvxznn96zjci34f52h7v392jkzqac"; + sha256.x86_64-linux = "0w730v2q0iaxf2lprabwmy7129byrs0hhdbwas575p1xmk00qw6b"; + sha256.armv7l-linux = "0y6bvq93lsf21v6ca536dpfhkk5ljsj7c6di0qzkban37bivj0si"; + sha256.aarch64-linux = "1bybysgg9llqzllsmdszmmb73v5az2l1shxn6lxwv3wwiazpf47q"; + releaseToken = "42970487e3af4f5aa5bca3f542482c60"; + jceName = "jce_policy-8.zip"; + sha256JCE = "0n8b6b8qmwb14lllk2lk1q1ahd3za9fnjigz5xn65mpg48whl0pk"; +} diff --git a/nixpkgs/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix new file mode 100644 index 000000000000..0263bdde8d28 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix @@ -0,0 +1,14 @@ +# http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html; +# jce download url: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html; +import ./jdk-linux-base.nix { + productVersion = "8"; + patchVersion = "202"; + buildVersion = "09"; + sha256.i686-linux = "19np392dwdqdq39lmm10607w2h042lrm5953fnsfh1bb9jli1pgj"; + sha256.x86_64-linux = "1q4l8pymjvsvxfwaw0rdcnhryh1la2bvg5f4d4my41ka390k4p4s"; + sha256.armv7l-linux = "06aljl7dqmmhmp7xswgvkcgh9mam71wnqydg9yb3hkcc443cm581"; + sha256.aarch64-linux = "12v9ndv7a2c9zqq6ai2vsgwad0lzmf4c6jxy4p9miapmhjzx5vii"; + releaseToken = "42970487e3af4f5aa5bca3f542482c60"; + jceName = "jce_policy-8.zip"; + sha256JCE = "0n8b6b8qmwb14lllk2lk1q1ahd3za9fnjigz5xn65mpg48whl0pk"; +} |