2021-03-09 03:18:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, autoPatchelfHook
|
|
|
|
, unzip
|
|
|
|
, makeWrapper
|
|
|
|
, setJavaClassPath
|
|
|
|
, zulu
|
|
|
|
# minimum dependencies
|
2021-06-28 23:13:55 +00:00
|
|
|
, alsa-lib
|
2021-03-09 03:18:52 +00:00
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, zlib
|
|
|
|
, xorg
|
|
|
|
# runtime dependencies
|
|
|
|
, cups
|
|
|
|
# runtime dependencies for GTK+ Look and Feel
|
|
|
|
, gtkSupport ? stdenv.isLinux
|
|
|
|
, cairo
|
|
|
|
, glib
|
|
|
|
, gtk3
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2022-01-19 23:45:15 +00:00
|
|
|
version = "11.52.13";
|
|
|
|
openjdk = "11.0.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
sha256_x64_linux = "77a126669b26b3a89e0117b0f28cddfcd24fcd7699b2c1d35f921487148b9a9f";
|
|
|
|
sha256_x64_darwin = "a96f9f859350f977319ebb5c2a999c182ab6b99b24c60e19d97c54367868a63e";
|
|
|
|
sha256_aarch64_darwin = "dmzfergSUVz39T30PT/6ZtT8JNqv5lzdX7zUsXsFGJg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
platform = if stdenv.isDarwin then "macosx" else "linux";
|
2022-07-14 12:49:19 +00:00
|
|
|
hash = if stdenv.isAarch64 && stdenv.isDarwin then sha256_aarch64_darwin else if stdenv.isDarwin then sha256_x64_darwin else sha256_x64_linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
extension = if stdenv.isDarwin then "zip" else "tar.gz";
|
2022-07-14 12:49:19 +00:00
|
|
|
architecture = if stdenv.isAarch64 then "aarch64" else "x64";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
runtimeDependencies = [
|
|
|
|
cups
|
|
|
|
] ++ lib.optionals gtkSupport [
|
|
|
|
cairo glib gtk3
|
|
|
|
];
|
|
|
|
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit version openjdk platform hash extension;
|
|
|
|
|
|
|
|
pname = "zulu";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2022-07-14 12:49:19 +00:00
|
|
|
url = "https://cdn.azul.com/zulu/bin/zulu${version}-ca-jdk${openjdk}-${platform}_${architecture}.${extension}";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = hash;
|
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [
|
2021-06-28 23:13:55 +00:00
|
|
|
alsa-lib # libasound.so wanted by lib/libjsound.so
|
2021-03-09 03:18:52 +00:00
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
stdenv.cc.cc # libstdc++.so.6
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXi
|
|
|
|
xorg.libXrender
|
|
|
|
xorg.libXtst
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2022-04-27 09:35:20 +00:00
|
|
|
makeWrapper
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
autoPatchelfHook
|
2021-03-09 03:18:52 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
unzip
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r ./* "$out/"
|
2021-08-25 08:27:29 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2021-08-05 21:33:18 +00:00
|
|
|
# jni.h expects jni_md.h to be in the header search path.
|
|
|
|
ln -s $out/include/linux/*_md.h $out/include/
|
2021-08-25 08:27:29 +00:00
|
|
|
'' + ''
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2021-03-09 03:18:52 +00:00
|
|
|
'' + 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
|
2022-04-27 09:35:20 +00:00
|
|
|
'' + ''
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
preFixup = ''
|
|
|
|
find "$out" -name libfontmanager.so -exec \
|
|
|
|
patchelf --add-needed libfontconfig.so {} \;
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
home = zulu;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.azul.com/products/zulu/";
|
|
|
|
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.
|
|
|
|
'';
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2022-07-14 12:49:19 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2021-05-03 20:48:10 +00:00
|
|
|
mainProgram = "java";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|