summary refs log tree commit diff
path: root/pkgs/development/compilers/zulu/8.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/zulu/8.nix')
-rw-r--r--pkgs/development/compilers/zulu/8.nix152
1 files changed, 33 insertions, 119 deletions
diff --git a/pkgs/development/compilers/zulu/8.nix b/pkgs/development/compilers/zulu/8.nix
index ed4d529ebd5..91aaaf06cd1 100644
--- a/pkgs/development/compilers/zulu/8.nix
+++ b/pkgs/development/compilers/zulu/8.nix
@@ -1,120 +1,34 @@
-{ stdenv
-, lib
-, fetchurl
-, autoPatchelfHook
-, unzip
-, makeWrapper
-, setJavaClassPath
-, zulu
-# minimum dependencies
-, alsa-lib
-, fontconfig
-, freetype
-, xorg
-# runtime dependencies
-, cups
-# runtime dependencies for GTK+ Look and Feel
-, gtkSupport ? stdenv.isLinux
-, cairo
-, glib
-, gtk3
-}:
-
-let
-  version = "8.68.0.19";
-  openjdk = "8.0.362";
-
-  sha256_linux = "sha256-jNty0iJoXG+sp7v2fGCrwZWCSZfQ4tkYe8ERixQMKL0=";
-  sha256_darwin = "sha256-3/P3puM6a7tCHP5eZM6IzbdPrqnhY1dTa7QWss9M08M=";
-
-  platform = if stdenv.isDarwin then "macosx" else "linux";
-  hash = if stdenv.isDarwin then sha256_darwin else sha256_linux;
-  extension = if stdenv.isDarwin then "zip" else "tar.gz";
-
-  runtimeDependencies = [
-    cups
-  ] ++ lib.optionals gtkSupport [
-    cairo glib gtk3
-  ];
-  runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
-
-in stdenv.mkDerivation {
-  inherit version openjdk platform hash extension;
-
-  pname = "zulu";
-
-  src = fetchurl {
-    url = "https://cdn.azul.com/zulu/bin/zulu${version}-ca-jdk${openjdk}-${platform}_x64.${extension}";
-    sha256 = hash;
-  };
-
-  buildInputs = lib.optionals stdenv.isLinux [
-    alsa-lib # libasound.so wanted by lib/libjsound.so
-    fontconfig
-    freetype
-    stdenv.cc.cc # libstdc++.so.6
-    xorg.libX11
-    xorg.libXext
-    xorg.libXi
-    xorg.libXrender
-    xorg.libXtst
-  ];
-
-  nativeBuildInputs = [
-    makeWrapper
-  ] ++ lib.optionals stdenv.isLinux [
-    autoPatchelfHook
-  ] ++ lib.optionals stdenv.isDarwin [
-    unzip
-  ];
-
-  installPhase = ''
-    runHook preInstall
-
-    mkdir -p $out
-    cp -r ./* "$out/"
-  '' + lib.optionalString stdenv.isLinux ''
-    # jni.h expects jni_md.h to be in the header search path.
-    ln -s $out/include/linux/*_md.h $out/include/
-  '' + ''
-    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
-  '' + lib.optionalString stdenv.isLinux ''
-    # We cannot use -exec since wrapProgram is a function but not a command.
-    for bin in $( find "$out" -executable -type f ); do
-      if patchelf --print-interpreter "$bin" &> /dev/null; then
-        wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
-      fi
-    done
-  '' + ''
-    runHook postInstall
-  '';
-
-  preFixup = ''
-    find "$out" -name libfontmanager.so -exec \
-      patchelf --add-needed libfontconfig.so {} \;
-  '';
-
-  passthru = {
-    home = zulu;
-  };
-
-  meta = with lib; {
-    homepage = "https://www.azul.com/products/zulu/";
-    sourceProvenance = with sourceTypes; [ binaryBytecode binaryNativeCode ];
-    license = licenses.gpl2;
-    description = "Certified builds of OpenJDK";
-    longDescription = ''
-      Certified builds of OpenJDK that can be deployed across multiple
-      operating systems, containers, hypervisors and Cloud platforms.
-    '';
-    maintainers = with maintainers; [ ];
-    platforms = [ "x86_64-linux" "x86_64-darwin" ];
-    mainProgram = "java";
+{ callPackage
+, enableJavaFX ? false
+, ...
+}@args:
+
+callPackage ./common.nix ({
+  # Details from https://www.azul.com/downloads/?version=java-8-lts&package=jdk
+  # Note that the latest build may differ by platform
+  dists = {
+    x86_64-linux = {
+      zuluVersion = "8.72.0.17";
+      jdkVersion = "8.0.382";
+      hash =
+        if enableJavaFX then "sha256-mIPCFESU7hy2naYur2jvFBtVn/LZQRcFiyiG61buCYs="
+        else "sha256-exWlbyrgBb7aD4daJps9qtFP+hKWkwbMdFR4OFslupY=";
+    };
+
+    x86_64-darwin = {
+      zuluVersion = "8.72.0.17";
+      jdkVersion = "8.0.382";
+      hash =
+        if enableJavaFX then "sha256-/x8FqygivzddXsOwIV8aj/u+LPXMmokgu97vLAVEv80="
+        else "sha256-3dTPIPGUeT6nb3gncNvEa4VTRyQIBJpp8oZadrT2ToE=";
+    };
+
+    aarch64-darwin = {
+      zuluVersion = "8.72.0.17";
+      jdkVersion = "8.0.382";
+      hash =
+        if enableJavaFX then "sha256-FkQ+0MzSZWUzc/HmiDVZEHGOrdKAVCdK5pm9wXXzzaU="
+        else "sha256-rN5AI4xAWppE4kJlzMod0JmGyHdHjTXYtx8/wOW6CFk=";
+    };
   };
-}
+} // builtins.removeAttrs args [ "callPackage" ])