nixpkgs/pkgs/development/compilers/zulu/default.nix

80 lines
2.4 KiB
Nix
Raw Normal View History

2017-07-11 22:04:13 +01:00
{ stdenv, lib, fetchurl, unzip, makeWrapper, setJavaClassPath
2021-02-03 10:28:36 +00:00
, zulu, glib, libxml2, ffmpeg_3, libxslt, libGL, alsaLib
2020-10-25 19:38:25 +00:00
, fontconfig, freetype, pango, gtk2, cairo, gdk-pixbuf, atk, xorg, zlib
2017-07-11 22:04:13 +01:00
, swingSupport ? true }:
2017-01-23 00:21:01 +00:00
let
2020-08-11 08:57:55 +01:00
version = "11.41.23";
openjdk = "11.0.8";
2017-01-23 00:21:01 +00:00
2020-08-11 08:57:55 +01:00
sha256_linux = "f8aee4ab30ca11ab3c8f401477df0e455a9d6b06f2710b2d1b1ddcf06067bc79";
sha256_darwin = "643c6648cc4374f39e830e4fcb3d68f8667893d487c07eb7091df65937025cc3";
2017-01-23 00:21:01 +00: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";
2017-07-11 22:04:13 +01:00
libraries = [
2021-02-03 10:28:36 +00:00
stdenv.cc.libc glib libxml2 ffmpeg_3 libxslt libGL
2020-10-25 19:38:25 +00:00
xorg.libXxf86vm alsaLib fontconfig freetype pango
gtk2 cairo gdk-pixbuf atk zlib
2017-07-11 22:04:13 +01:00
] ++ (lib.optionals swingSupport (with xorg; [
xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp
xorg.libXt xorg.libXrender stdenv.cc.cc
]));
2019-08-13 22:52:01 +01:00
in stdenv.mkDerivation {
2017-01-23 00:21:01 +00:00
inherit version openjdk platform hash extension;
pname = "zulu";
2017-01-23 00:21:01 +00:00
src = fetchurl {
2020-08-11 08:57:55 +01:00
url = "https://cdn.azul.com/zulu/bin/zulu${version}-ca-jdk${openjdk}-${platform}_x64.${extension}";
2017-01-23 00:21:01 +00:00
sha256 = hash;
};
2017-07-11 22:04:13 +01:00
buildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin unzip;
2017-01-23 00:21:01 +00:00
installPhase = ''
mkdir -p $out
cp -r ./* "$out/"
2017-09-21 23:56:54 +01:00
rpath=$rpath''${rpath:+:}$out/lib/jli
rpath=$rpath''${rpath:+:}$out/lib/server
rpath=$rpath''${rpath:+:}$out/lib
2017-01-23 00:21:01 +00:00
# set all the dynamic linkers
find $out -type f -perm -0100 \
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$rpath" {} \;
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
mkdir -p $out/nix-support
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
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
2017-01-23 00:21:01 +00:00
EOF
'';
rpath = lib.strings.makeLibraryPath libraries;
2017-01-23 00:21:01 +00:00
2017-01-27 00:46:51 +00:00
passthru = {
2019-09-09 00:38:31 +01:00
home = zulu;
2017-01-27 00:46:51 +00:00
};
meta = with lib; {
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 22:04:13 +01:00
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-01-23 00:21:01 +00:00
platforms = [ "x86_64-linux" "x86_64-darwin" ];
};
}