3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/zulu/8.nix

114 lines
2.8 KiB
Nix
Raw Normal View History

{ 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
}:
2017-09-21 23:56:54 +01:00
let
2020-08-11 08:57:40 +01:00
version = "8.48.0.53";
openjdk = "8.0.265";
2017-09-21 23:56:54 +01:00
2020-08-11 08:57:40 +01:00
sha256_linux = "ed32513524b32a83b3b388831c69d1884df5675bd5069c6d1485fd1a060be209";
sha256_darwin = "36f189bfbd0255195848835819377474ba9c1c868e3c204633c451c96e21f30a";
2017-09-21 23:56:54 +01:00
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;
2017-09-21 23:56:54 +01:00
2019-08-13 22:52:01 +01:00
in stdenv.mkDerivation {
2017-09-21 23:56:54 +01:00
inherit version openjdk platform hash extension;
pname = "zulu";
2017-09-21 23:56:54 +01:00
src = fetchurl {
2020-08-11 08:57:40 +01:00
url = "https://cdn.azul.com/zulu/bin/zulu${version}-ca-jdk${openjdk}-${platform}_x64.${extension}";
2017-09-21 23:56:54 +01:00
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 = [
autoPatchelfHook makeWrapper
] ++ lib.optionals stdenv.isDarwin [
unzip
];
2017-09-21 23:56:54 +01:00
installPhase = ''
mkdir -p $out
cp -r ./* "$out/"
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
2017-09-21 23:56:54 +01:00
mkdir -p $out/nix-support
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
2017-09-21 23:56:54 +01:00
# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
2017-09-21 23:56:54 +01:00
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
2017-09-21 23:56:54 +01:00
'';
preFixup = ''
find "$out" -name libfontmanager.so -exec \
patchelf --add-needed libfontconfig.so {} \;
'';
2017-09-21 23:56:54 +01:00
passthru = {
2019-09-09 00:38:31 +01:00
home = zulu;
2017-09-21 23:56:54 +01:00
};
meta = with lib; {
homepage = "https://www.azul.com/products/zulu/";
2017-09-21 23:56:54 +01:00
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.
'';
2020-10-08 15:20:53 +01:00
maintainers = with maintainers; [ fpletz ];
2017-09-21 23:56:54 +01:00
platforms = [ "x86_64-linux" "x86_64-darwin" ];
2021-04-29 14:28:39 +01:00
mainProgram = "java";
2017-09-21 23:56:54 +01:00
};
}