2020-12-26 07:29:15 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, autoPatchelfHook
|
|
|
|
, unzip
|
|
|
|
, makeWrapper
|
|
|
|
, setJavaClassPath
|
|
|
|
, zulu
|
|
|
|
# minimum dependencies
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2020-12-26 07:29:15 +00:00
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, zlib
|
|
|
|
, xorg
|
|
|
|
# runtime dependencies
|
|
|
|
, cups
|
|
|
|
# runtime dependencies for GTK+ Look and Feel
|
|
|
|
, gtkSupport ? stdenv.isLinux
|
|
|
|
, cairo
|
|
|
|
, glib
|
|
|
|
, gtk3
|
|
|
|
}:
|
2017-01-23 00:21:01 +00:00
|
|
|
|
|
|
|
let
|
2023-01-24 01:28:05 +00:00
|
|
|
version = "11.62.17";
|
|
|
|
openjdk = "11.0.18";
|
2017-01-23 00:21:01 +00:00
|
|
|
|
2023-01-24 01:28:05 +00:00
|
|
|
sha256_x64_linux = "sha256-b65oEbDzrrsUw+WaX94USBz/QS74yiMiGZPxqzMmmqs=";
|
|
|
|
sha256_x64_darwin = "sha256-nRRWTWiog8bRblmmPIPE5YibA34St3ZrJpZN91qEDUg=";
|
|
|
|
sha256_aarch64_darwin = "sha256-TBTrBxOfGo6MV+Md49P3sDfqVG1e+NraqfVbw9WTppk=";
|
2017-01-23 00:21:01 +00:00
|
|
|
|
|
|
|
platform = if stdenv.isDarwin then "macosx" else "linux";
|
2022-05-17 18:39:36 +00:00
|
|
|
hash = if stdenv.isAarch64 && stdenv.isDarwin then sha256_aarch64_darwin else if stdenv.isDarwin then sha256_x64_darwin else sha256_x64_linux;
|
2017-01-23 00:21:01 +00:00
|
|
|
extension = if stdenv.isDarwin then "zip" else "tar.gz";
|
2022-05-17 18:39:36 +00:00
|
|
|
architecture = if stdenv.isAarch64 then "aarch64" else "x64";
|
2017-07-11 21:04:13 +00:00
|
|
|
|
2020-12-26 07:29:15 +00:00
|
|
|
runtimeDependencies = [
|
|
|
|
cups
|
|
|
|
] ++ lib.optionals gtkSupport [
|
|
|
|
cairo glib gtk3
|
|
|
|
];
|
|
|
|
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
|
2017-07-11 21:04:13 +00:00
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
in stdenv.mkDerivation {
|
2017-01-23 00:21:01 +00:00
|
|
|
inherit version openjdk platform hash extension;
|
|
|
|
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "zulu";
|
2017-01-23 00:21:01 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-05-17 18:39:36 +00:00
|
|
|
url = "https://cdn.azul.com/zulu/bin/zulu${version}-ca-jdk${openjdk}-${platform}_${architecture}.${extension}";
|
2017-01-23 00:21:01 +00:00
|
|
|
sha256 = hash;
|
|
|
|
};
|
|
|
|
|
2020-12-26 07:29:15 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [
|
2021-06-10 02:57:09 +00:00
|
|
|
alsa-lib # libasound.so wanted by lib/libjsound.so
|
2020-12-26 07:29:15 +00:00
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
stdenv.cc.cc # libstdc++.so.6
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXi
|
|
|
|
xorg.libXrender
|
|
|
|
xorg.libXtst
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2022-03-22 17:59:05 +00:00
|
|
|
makeWrapper
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
autoPatchelfHook
|
2020-12-26 07:29:15 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
unzip
|
|
|
|
];
|
2017-01-23 00:21:01 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2022-03-22 17:59:05 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2017-01-23 00:21:01 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r ./* "$out/"
|
2021-08-23 10:07:32 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2021-01-23 06:35:21 +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-23 10:07:32 +00:00
|
|
|
'' + ''
|
2017-01-23 00:21:01 +00:00
|
|
|
mkdir -p $out/nix-support
|
2017-11-17 18:26:21 +00:00
|
|
|
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
|
2017-01-23 00:21:01 +00:00
|
|
|
|
|
|
|
# Set JAVA_HOME automatically.
|
|
|
|
cat <<EOF >> $out/nix-support/setup-hook
|
2019-11-01 19:30:09 +00:00
|
|
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
2017-01-23 00:21:01 +00:00
|
|
|
EOF
|
2020-12-26 07:29:15 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
|
|
|
# We cannot use -exec since wrapProgram is a function but not a command.
|
2021-02-27 10:20:23 +00:00
|
|
|
#
|
|
|
|
# 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
|
2020-12-26 07:29:15 +00:00
|
|
|
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
|
|
|
|
done
|
2022-03-22 17:59:05 +00:00
|
|
|
'' + ''
|
|
|
|
runHook postInstall
|
2017-01-23 00:21:01 +00:00
|
|
|
'';
|
|
|
|
|
2020-12-26 07:29:15 +00:00
|
|
|
preFixup = ''
|
|
|
|
find "$out" -name libfontmanager.so -exec \
|
|
|
|
patchelf --add-needed libfontconfig.so {} \;
|
|
|
|
'';
|
2017-01-23 00:21:01 +00:00
|
|
|
|
2017-01-27 00:46:51 +00:00
|
|
|
passthru = {
|
2019-09-08 23:38:31 +00:00
|
|
|
home = zulu;
|
2017-01-27 00:46:51 +00:00
|
|
|
};
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.azul.com/products/zulu/";
|
2017-01-23 00:21:01 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
description = "Certified builds of OpenJDK";
|
2017-07-11 21:04:13 +00:00
|
|
|
longDescription = ''
|
|
|
|
Certified builds of OpenJDK that can be deployed across multiple
|
|
|
|
operating systems, containers, hypervisors and Cloud platforms.
|
|
|
|
'';
|
2022-08-03 12:13:56 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2022-05-17 18:39:36 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2021-04-29 13:28:39 +00:00
|
|
|
mainProgram = "java";
|
2017-01-23 00:21:01 +00:00
|
|
|
};
|
|
|
|
}
|