From 8faebb17ac811c784ff4d2ad55330223268524c4 Mon Sep 17 00:00:00 2001 From: taku0 Date: Sat, 13 Oct 2018 23:42:21 +0900 Subject: [PATCH] adoptopenjdk-bin: init at 11 --- .../adoptopenjdk-bin/jdk-linux-base.nix | 119 ++++++++++++++++++ .../adoptopenjdk-bin/jdk11-linux.nix | 36 ++++++ pkgs/top-level/all-packages.nix | 9 ++ 3 files changed, 164 insertions(+) create mode 100644 pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix create mode 100644 pkgs/development/compilers/adoptopenjdk-bin/jdk11-linux.nix diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix new file mode 100644 index 00000000000..cf38ca9eaeb --- /dev/null +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix @@ -0,0 +1,119 @@ +{ name +, url +, sha256 +}: + +{ swingSupport ? true +, stdenv +, fetchurl +, file +, xorg ? null +, glib +, libxml2 +, ffmpeg_2 +, libxslt +, libGL +, freetype +, fontconfig +, gtk2 +, pango +, cairo +, alsaLib +, atk +, gdk_pixbuf +, zlib +, elfutils +}: + +assert swingSupport -> xorg != null; + +let + rSubPaths = [ + "lib/jli" + "lib/server" + "lib/compressedrefs" # OpenJ9 + "lib/j9vm" # OpenJ9 + "lib" + ]; + + libraries = [ + stdenv.cc.libc glib libxml2 ffmpeg_2 libxslt libGL + xorg.libXxf86vm alsaLib fontconfig freetype pango gtk2 cairo gdk_pixbuf + atk zlib elfutils + ] ++ (stdenv.lib.optionals swingSupport [ + xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp xorg.libXt + xorg.libXrender + stdenv.cc.cc + ]); +in + +let result = stdenv.mkDerivation rec { + inherit name; + + src = fetchurl { + inherit url sha256; + }; + + nativeBuildInputs = [ file ]; + + # See: https://github.com/NixOS/patchelf/issues/10 + dontStrip = 1; + + installPhase = '' + cd .. + + # Set PaX markings + exes=$(file $sourceRoot/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//') + for file in $exes; do + paxmark m "$file" + # On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well. + ${stdenv.lib.optionalString stdenv.isi686 ''paxmark msp "$file"''} + done + + mv $sourceRoot $out + + rm -rf $out/demo + + # Remove some broken manpages. + rm -rf $out/man/ja* + + # for backward compatibility + ln -s $out $out/jre + + mkdir -p $out/nix-support + + # Set JAVA_HOME automatically. + cat <> $out/nix-support/setup-hook + if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + EOF + ''; + + postFixup = '' + rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$out/${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" {} \; + ''; + + rpath = stdenv.lib.strings.makeLibraryPath libraries; + + # FIXME: use multiple outputs or return actual JRE package + passthru.jre = result; + + passthru.home = result; + + # for backward compatibility + passthru.architecture = ""; + + meta = with stdenv.lib; { + license = licenses.gpl2Classpath; + description = "AdoptOpenJDK, prebuilt OpenJDK binary"; + platforms = [ "x86_64-linux" ]; # some inherit jre.meta.platforms + maintainers = with stdenv.lib.maintainers; [ taku0 ]; + }; + +}; in result diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk11-linux.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk11-linux.nix new file mode 100644 index 00000000000..6e00782c391 --- /dev/null +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk11-linux.nix @@ -0,0 +1,36 @@ +let + version = "11"; + buildNumber = "28"; + baseUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${version}%2B${buildNumber}"; + makePackage = { packageType, vmType, sha256 }: import ./jdk-linux-base.nix { + name = if packageType == "jdk" + then + "adoptopenjdk-${vmType}-bin-${version}" + else + "adoptopenjdk-${packageType}-${vmType}-bin-${version}"; + url = "${baseUrl}/OpenJDK${version}-${packageType}_x64_linux_${vmType}_${version}_${buildNumber}.tar.gz"; + inherit sha256; + }; +in +{ + jdk-hotspot = makePackage { + packageType = "jdk"; + vmType = "hotspot"; + sha256 = "e1e18fc9ce2917473da3e0acb5a771bc651f600c0195a3cb40ef6f22f21660af"; + }; + jre-hotspot = makePackage { + packageType = "jre"; + vmType = "hotspot"; + sha256 = "346448142d46c6e51d0fadcaadbcde31251d7678922ec3eb010fcb1b6e17804c"; + }; + jdk-openj9 = makePackage { + packageType = "jdk"; + vmType = "openj9"; + sha256 = "fd77f22eb74078bcf974415abd888296284d2ceb81dbaca6ff32f59416ebc57f"; + }; + jre-openj9 = makePackage { + packageType = "jre"; + vmType = "openj9"; + sha256 = "83a7c95e6b2150a739bdd5e8a6fe0315904fd13d8867c95db67c0318304a2c42"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 69e3c196ca5..9dd951d681c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6431,6 +6431,15 @@ with pkgs; abcl = callPackage ../development/compilers/abcl {}; + adoptopenjdk-bin-11-packages = import ../development/compilers/adoptopenjdk-bin/jdk11-linux.nix; + adoptopenjdk-hotspot-bin-11 = callPackage adoptopenjdk-bin-11-packages.jdk-hotspot {}; + adoptopenjdk-jre-hotspot-bin-11 = callPackage adoptopenjdk-bin-11-packages.jre-hotspot {}; + adoptopenjdk-openj9-bin-11 = callPackage adoptopenjdk-bin-11-packages.jdk-openj9 {}; + adoptopenjdk-jre-openj9-bin-11 = callPackage adoptopenjdk-bin-11-packages.jre-openj9 {}; + + adoptopenjdk-bin = adoptopenjdk-hotspot-bin-11; + adoptopenjdk-jre-bin = adoptopenjdk-jre-hotspot-bin-11; + aldor = callPackage ../development/compilers/aldor { }; aliceml = callPackage ../development/compilers/aliceml { };