summary refs log tree commit diff
path: root/pkgs/development/compilers/adoptopenjdk-bin
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/adoptopenjdk-bin')
-rw-r--r--pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix59
-rw-r--r--pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix119
-rw-r--r--pkgs/development/compilers/adoptopenjdk-bin/jdk11-darwin.nix26
-rw-r--r--pkgs/development/compilers/adoptopenjdk-bin/jdk11-linux.nix36
4 files changed, 240 insertions, 0 deletions
diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
new file mode 100644
index 000000000000..c2c13649f885
--- /dev/null
+++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
@@ -0,0 +1,59 @@
+{ name
+, url
+, sha256
+}:
+
+{ swingSupport ? true # not used for now
+, stdenv
+, fetchurl
+}:
+
+let result = stdenv.mkDerivation rec {
+  inherit name;
+
+  src = fetchurl {
+    inherit url sha256;
+  };
+
+  # See: https://github.com/NixOS/patchelf/issues/10
+  dontStrip = 1;
+
+  installPhase = ''
+    cd ..
+
+    mv $sourceRoot $out
+
+    rm -rf $out/Home/demo
+
+    # Remove some broken manpages.
+    rm -rf $out/Home/man/ja*
+
+    # for backward compatibility
+    ln -s $out/Contents/Home $out/jre
+
+    ln -s $out/Contents/Home/* $out/
+
+    mkdir -p $out/nix-support
+
+    # Set JAVA_HOME automatically.
+    cat <<EOF >> $out/nix-support/setup-hook
+    if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
+    EOF
+  '';
+
+  # 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-darwin" ]; # some inherit jre.meta.platforms
+    maintainers = with stdenv.lib.maintainers; [ taku0 ];
+  };
+
+}; in result
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 000000000000..cf38ca9eaebe
--- /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 <<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: "$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-darwin.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk11-darwin.nix
new file mode 100644
index 000000000000..77d9d85aaa93
--- /dev/null
+++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk11-darwin.nix
@@ -0,0 +1,26 @@
+let
+  version = "11";
+  buildNumber = "28";
+  baseUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${version}%2B${buildNumber}";
+  makePackage = { packageType, vmType, sha256 }: import ./jdk-darwin-base.nix {
+    name = if packageType == "jdk"
+      then
+        "adoptopenjdk-${vmType}-bin-${version}"
+      else
+        "adoptopenjdk-${packageType}-${vmType}-bin-${version}";
+    url = "${baseUrl}/OpenJDK${version}-${packageType}_x64_mac_${vmType}_${version}_${buildNumber}.tar.gz";
+    inherit sha256;
+  };
+in
+{
+  jdk-hotspot = makePackage {
+    packageType = "jdk";
+    vmType = "hotspot";
+    sha256 = "ca0ec49548c626904061b491cae0a29b9b4b00fb34d8973dc217e10ab21fb0f3";
+  };
+  jre-hotspot = makePackage {
+    packageType = "jre";
+    vmType = "hotspot";
+    sha256 = "ef4dbfe5aed6ab2278fcc14db6cc73abbaab56e95f6ebb023790a7ebc6d7f30c";
+  };
+}
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 000000000000..6e00782c3918
--- /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";
+  };
+}