diff options
Diffstat (limited to 'pkgs/development/compilers/zulu')
-rw-r--r-- | pkgs/development/compilers/zulu/11.nix | 42 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/16.nix | 26 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/17.nix | 42 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/18.nix | 26 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/19.nix | 26 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/20.nix | 26 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/21.nix | 42 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/8.nix | 152 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/common.nix | 159 | ||||
-rw-r--r-- | pkgs/development/compilers/zulu/default.nix | 125 |
10 files changed, 422 insertions, 244 deletions
diff --git a/pkgs/development/compilers/zulu/11.nix b/pkgs/development/compilers/zulu/11.nix new file mode 100644 index 00000000000..9272dc75c3e --- /dev/null +++ b/pkgs/development/compilers/zulu/11.nix @@ -0,0 +1,42 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-11-lts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-linux = { + zuluVersion = "11.66.15"; + jdkVersion = "11.0.20"; + hash = + if enableJavaFX then "sha256-CjWtqnirEDrpF61WXm/Yi372IzhpTpi+/AfEqirlZnc=" + else "sha256-o0tAT4egimEUizjhQW2DcYnh33oEDZSedDYz2vRpWjw="; + }; + + aarch64-linux = { + zuluVersion = "11.66.15"; + jdkVersion = "11.0.20"; + hash = + if enableJavaFX then throw "JavaFX is not available for aarch64-linux" + else "sha256-VBdEOfKz/d0R8QSMOX/nu0XUydZtRS1oibAT0E0hxN4="; + }; + + x86_64-darwin = { + zuluVersion = "11.66.15"; + jdkVersion = "11.0.20"; + hash = + if enableJavaFX then "sha256-pVgCJkgYTlFeL7nkkMWLeJ/J8ELhgvWb7gzf3erZP7Y=" + else "sha256-vKqxHP5Yb651g8bZ0xHGQ4Q1T7JjjrmgEuykw/Gh2f0="; + }; + + aarch64-darwin = { + zuluVersion = "11.66.15"; + jdkVersion = "11.0.20"; + hash = + if enableJavaFX then "sha256-VoZo34SCUU+HHnTl6iLe0QBC+4VDkPP14N98oqSg9EQ=" + else "sha256-djK8Kfikt9SSuT87x1p7YWMIlNuF0TZFYDWrKiTTiIU="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) diff --git a/pkgs/development/compilers/zulu/16.nix b/pkgs/development/compilers/zulu/16.nix new file mode 100644 index 00000000000..941a7e8d64f --- /dev/null +++ b/pkgs/development/compilers/zulu/16.nix @@ -0,0 +1,26 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-16-sts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-darwin = { + zuluVersion = "16.32.15"; + jdkVersion = "16.0.2"; + hash = + if enableJavaFX then "sha256-6URaSBNHQWLauO//kCuKXb4Z7AqyshWnoeJEyVRKgaY=" + else "sha256-NXgBj/KixTknaCYbo3B+rOo11NImH5CDUIU0LhTCtMo="; + }; + + aarch64-darwin = { + zuluVersion = "16.32.15"; + jdkVersion = "16.0.2"; + hash = + if enableJavaFX then "sha256-QuyhIAxUY3Vv1adGihW+LIsXtpDX2taCmFsMFj9o5vs=" + else "sha256-3bUfDcLLyahLeURFAgLAVapBZHvqtam8GHbWTA6MQog="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) diff --git a/pkgs/development/compilers/zulu/17.nix b/pkgs/development/compilers/zulu/17.nix new file mode 100644 index 00000000000..fcfe39af10a --- /dev/null +++ b/pkgs/development/compilers/zulu/17.nix @@ -0,0 +1,42 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-17-lts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-linux = { + zuluVersion = "17.44.53"; + jdkVersion = "17.0.8.1"; + hash = + if enableJavaFX then "sha256-R6VJcSjpKFfsO3l32+8s+wlcuAVoXcSsW5Dg2M/hjpI=" + else "sha256-uUgvIwShpophTfrN3PKVaacvD6wy5sdPg9wbmhV7g0A="; + }; + + aarch64-linux = { + zuluVersion = "17.44.53"; + jdkVersion = "17.0.8.1"; + hash = + if enableJavaFX then throw "JavaFX is not available for aarch64-linux" + else "sha256-ZTHO9h5BbVp7aRVVyM8r3/aJIBuKAB/0WrZ0AGK0QxM="; + }; + + x86_64-darwin = { + zuluVersion = "17.44.53"; + jdkVersion = "17.0.8.1"; + hash = + if enableJavaFX then "sha256-9U0XYZRA+LZTQ7eHrT5SWhgcxv43ajC9n9Tj3qPPLWA=" + else "sha256-ZART6K/o/+D7Tc60U1+1DbnCg8ZGZe67C6aLGeZfSx8="; + }; + + aarch64-darwin = { + zuluVersion = "17.44.53"; + jdkVersion = "17.0.8.1"; + hash = + if enableJavaFX then "sha256-udYW3nOADclWqVcVtS9dgjSY0w6xf2nsBpLzPmQCYlI=" + else "sha256-MUsEVo7Arps2ugPJy9Qq3J4SZfdGeJI7GSl9ZuuE3Mo="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) diff --git a/pkgs/development/compilers/zulu/18.nix b/pkgs/development/compilers/zulu/18.nix new file mode 100644 index 00000000000..cbee8ac6e5b --- /dev/null +++ b/pkgs/development/compilers/zulu/18.nix @@ -0,0 +1,26 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-18-sts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-darwin = { + zuluVersion = "18.32.13"; + jdkVersion = "18.0.2.1"; + hash = + if enableJavaFX then "sha256-ZVZ1gbpJwxTduq2PPOCKqbSl+shq2NTFgqG++OXvFcg=" + else "sha256-uHPcyOgxUdTgzmIVRp/awtwve9zSt+1TZNef7DUuoRg="; + }; + + aarch64-darwin = { + zuluVersion = "18.32.13"; + jdkVersion = "18.0.2.1"; + hash = + if enableJavaFX then "sha256-tNx0a1u9iamcN9VFOJ3eqDEA6C204dtIBJZvuAH2Vjk=" + else "sha256-jAZDgxtWMq/74yKAxA69oOU0C9nXvKG5MjmZLsK04iM="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) diff --git a/pkgs/development/compilers/zulu/19.nix b/pkgs/development/compilers/zulu/19.nix new file mode 100644 index 00000000000..28dbf588761 --- /dev/null +++ b/pkgs/development/compilers/zulu/19.nix @@ -0,0 +1,26 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-19-sts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-darwin = { + zuluVersion = if enableJavaFX then "19.32.15" else "19.32.13"; + jdkVersion = "19.0.2"; + hash = + if enableJavaFX then "sha256-AwLcIId0gH5D6DUU8CgJ3qnKVQm28LXYirBeXBHwPYE=" + else "sha256-KARXWumsY+OcqpEOV2EL9SsPni1nGSipjRji/Mn2KsE="; + }; + + aarch64-darwin = { + zuluVersion = if enableJavaFX then "19.32.15" else "19.32.13"; + jdkVersion = "19.0.2"; + hash = + if enableJavaFX then "sha256-/R2rrcBr64qPGEtvhruXBhPwnvurt/hiR1ICzZAdYxE=" + else "sha256-F30FjZaLL756X/Xs6xjNwW9jds4pEATxoxOeeLL7Y5E="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) diff --git a/pkgs/development/compilers/zulu/20.nix b/pkgs/development/compilers/zulu/20.nix new file mode 100644 index 00000000000..38083a881f5 --- /dev/null +++ b/pkgs/development/compilers/zulu/20.nix @@ -0,0 +1,26 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-20-sts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-darwin = { + zuluVersion = "20.32.11"; + jdkVersion = "20.0.2"; + hash = + if enableJavaFX then "sha256-hyxQAivZAXtqMebe30L+EYa7p+TdSdKNYj7Rl/ZwRNQ=" + else "sha256-Ev9KG6DvuBnsZrOguLsO1KQzudHCBcJNwKh45Inpnfo="; + }; + + aarch64-darwin = { + zuluVersion = "20.32.11"; + jdkVersion = "20.0.2"; + hash = + if enableJavaFX then "sha256-iPQzZS4CwaoqT8cSzg4kWCT1OyGBSJLq+NETcbucLo4=" + else "sha256-15uNZ6uMfSASV3QU2q2oA/jBk2PCHOfSjn1GY7/7qIY="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) diff --git a/pkgs/development/compilers/zulu/21.nix b/pkgs/development/compilers/zulu/21.nix new file mode 100644 index 00000000000..09b420d533a --- /dev/null +++ b/pkgs/development/compilers/zulu/21.nix @@ -0,0 +1,42 @@ +{ callPackage +, enableJavaFX ? false +, ... +}@args: + +callPackage ./common.nix ({ + # Details from https://www.azul.com/downloads/?version=java-21-lts&package=jdk + # Note that the latest build may differ by platform + dists = { + x86_64-linux = { + zuluVersion = "21.28.85"; + jdkVersion = "21.0.0"; + hash = + if enableJavaFX then "sha256-ew/tgSdkrPdk1CTguk9nyl30w7se+YZYqyqOTaeketk=" + else "sha256-DA6t+9xHp8pkrqtRucBh9xtuTSXS2HZ0US6bY4fp46Y="; + }; + + aarch64-linux = { + zuluVersion = "21.28.85"; + jdkVersion = "21.0.0"; + hash = + if enableJavaFX then throw "JavaFX is not available for aarch64-linux" + else "sha256-H7ZLgDbF1GPYq1mvBr9bawBoEeYBLjsOtrzPV/HFWDU="; + }; + + x86_64-darwin = { + zuluVersion = "21.28.85"; + jdkVersion = "21.0.0"; + hash = + if enableJavaFX then "sha256-QrgEpLaNGc2aNFF38z2ckUTCpweKnuALYLOWATZFJPA=" + else "sha256-ljm4fbWG0MifepiSrkf0IeRCxkuXuuvf8xeI++IyZb0="; + }; + + aarch64-darwin = { + zuluVersion = "21.28.85"; + jdkVersion = "21.0.0"; + hash = + if enableJavaFX then "sha256-PUVB/R1K1dLTi1FsOYIvcI76M6EYYeMG1Bm+oMno//Y=" + else "sha256-KnqZo+omPb2NMqZ9Hm42O6iyXGRcgm9eFnoCu6+v8fo="; + }; + }; +} // builtins.removeAttrs args [ "callPackage" ]) 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" ]) diff --git a/pkgs/development/compilers/zulu/common.nix b/pkgs/development/compilers/zulu/common.nix new file mode 100644 index 00000000000..d09555b00c9 --- /dev/null +++ b/pkgs/development/compilers/zulu/common.nix @@ -0,0 +1,159 @@ +{ lib +, stdenv +, fetchurl +, setJavaClassPath +, enableJavaFX ? false +, dists + # minimum dependencies +, unzip +, autoPatchelfHook +, makeWrapper +, alsa-lib +, fontconfig +, freetype +, zlib +, xorg + # runtime dependencies +, cups + # runtime dependencies for GTK+ Look and Feel +, gtkSupport ? stdenv.isLinux +, cairo +, glib +, gtk3 +}: +let + dist = dists.${stdenv.hostPlatform.system} + or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + + arch = { + "aarch64" = "aarch64"; + "x86_64" = "x64"; + }.${stdenv.hostPlatform.parsed.cpu.name} + or (throw "Unsupported architecture: ${stdenv.hostPlatform.parsed.cpu.name}"); + + platform = { + "darwin" = "macosx"; + "linux" = "linux"; + }.${stdenv.hostPlatform.parsed.kernel.name} + or (throw "Unsupported platform: ${stdenv.hostPlatform.parsed.kernel.name}"); + + runtimeDependencies = [ + cups + ] ++ lib.optionals gtkSupport [ + cairo + glib + gtk3 + ]; + + runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies; + + jce-policies = fetchurl { + url = "https://web.archive.org/web/20211126120343/http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip"; + hash = "sha256-gCGii4ysQbRPFCH9IQoKCCL8r4jWLS5wo1sv9iioZ1o="; + }; + + javaPackage = if enableJavaFX then "ca-fx-jdk" else "ca-jdk"; + + isJdk8 = lib.versions.major dist.jdkVersion == "8"; + + jdk = stdenv.mkDerivation rec { + pname = "zulu${dist.zuluVersion}-${javaPackage}"; + version = dist.jdkVersion; + + src = fetchurl { + url = "https://cdn.azul.com/zulu/bin/zulu${dist.zuluVersion}-${javaPackage}${dist.jdkVersion}-${platform}_${arch}.tar.gz"; + inherit (dist) hash; + curlOpts = "-H Referer:https://www.azul.com/downloads/zulu/"; + }; + + nativeBuildInputs = [ + unzip + ] ++ lib.optionals stdenv.isLinux [ + autoPatchelfHook + makeWrapper + ]; + + 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 + zlib + ]; + + installPhase = '' + mkdir -p $out + mv * $out + + unzip ${jce-policies} + mv -f ZuluJCEPolicies/*.jar $out/${lib.optionalString isJdk8 "jre/"}lib/security/ + + # jni.h expects jni_md.h to be in the header search path. + ln -s $out/include/${stdenv.hostPlatform.parsed.kernel.name}/*_md.h $out/include/ + + if [ -f $out/LICENSE ]; then + install -D $out/LICENSE $out/share/zulu/LICENSE + rm $out/LICENSE + fi + ''; + + preFixup = '' + # Propagate the setJavaClassPath setup hook from the ${if isJdk8 then "JRE" else "JDK"} so that + # any package that depends on the ${if isJdk8 then "JRE" else "JDK"} has $CLASSPATH set up + # properly. + 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. + # + # jspawnhelper is executed from JVM, so it doesn't need to wrap it, and it + # breaks building OpenJDK (#114495). + for bin in $( find "$out" -executable -type f -not -name jspawnhelper ); do + if patchelf --print-interpreter "$bin" &> /dev/null; then + wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" + fi + done + '' + # FIXME: move all of the above to installPhase. + + lib.optionalString stdenv.isLinux '' + find "$out" -name libfontmanager.so -exec \ + patchelf --add-needed libfontconfig.so {} \; + ''; + + # fixupPhase is moving the man to share/man which breaks it because it's a + # relative symlink. + postFixup = lib.optionalString stdenv.isDarwin '' + ln -nsf ../zulu-${lib.versions.major version}.jdk/Contents/Home/man $out/share/man + ''; + + passthru = (lib.optionalAttrs isJdk8 { + jre = jdk; + }) // { + home = jdk; + }; + + meta = (import ../openjdk/meta.nix lib version) // { + description = "Certified builds of OpenJDK"; + longDescription = '' + Certified builds of OpenJDK that can be deployed across multiple + operating systems, containers, hypervisors and Cloud platforms. + ''; + homepage = "https://www.azul.com/products/zulu/"; + mainProgram = "java"; + maintainers = [ ]; + platforms = builtins.attrNames dists; + sourceProvenance = with lib.sourceTypes; [ binaryBytecode binaryNativeCode ]; + }; + }; +in +jdk diff --git a/pkgs/development/compilers/zulu/default.nix b/pkgs/development/compilers/zulu/default.nix deleted file mode 100644 index 045aa4e5aba..00000000000 --- a/pkgs/development/compilers/zulu/default.nix +++ /dev/null @@ -1,125 +0,0 @@ -{ stdenv -, lib -, fetchurl -, autoPatchelfHook -, unzip -, makeWrapper -, setJavaClassPath -, zulu -# minimum dependencies -, alsa-lib -, fontconfig -, freetype -, zlib -, xorg -# runtime dependencies -, cups -# runtime dependencies for GTK+ Look and Feel -, gtkSupport ? stdenv.isLinux -, cairo -, glib -, gtk3 -}: - -let - version = "11.62.17"; - openjdk = "11.0.18"; - - sha256_x64_linux = "sha256-b65oEbDzrrsUw+WaX94USBz/QS74yiMiGZPxqzMmmqs="; - sha256_x64_darwin = "sha256-nRRWTWiog8bRblmmPIPE5YibA34St3ZrJpZN91qEDUg="; - sha256_aarch64_darwin = "sha256-TBTrBxOfGo6MV+Md49P3sDfqVG1e+NraqfVbw9WTppk="; - - platform = if stdenv.isDarwin then "macosx" else "linux"; - hash = if stdenv.isAarch64 && stdenv.isDarwin then sha256_aarch64_darwin else if stdenv.isDarwin then sha256_x64_darwin else sha256_x64_linux; - extension = if stdenv.isDarwin then "zip" else "tar.gz"; - architecture = if stdenv.isAarch64 then "aarch64" else "x64"; - - 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}_${architecture}.${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 - zlib - ]; - - 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. - # - # jspawnhelper is executed from JVM, so it doesn't need to wrap it, and it - # breaks building OpenJDK (#114495). - for bin in $( find "$out" -executable -type f -not -name jspawnhelper ); do - wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" - 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" "aarch64-darwin" ]; - mainProgram = "java"; - }; -} |