1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

zulu: add darwin support

This commit is contained in:
Weijia Wang 2023-10-08 01:26:09 +02:00
parent 8d8796f341
commit 2e692b3ddb
13 changed files with 82 additions and 276 deletions

View file

@ -1,26 +0,0 @@
{ 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-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" ])

View file

@ -7,6 +7,22 @@ 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";

View file

@ -0,0 +1,26 @@
{ 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-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" ])

View file

@ -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
}:
{ callPackage
, enableJavaFX ? false
, ...
}@args:
let
version = "8.68.0.19";
openjdk = "8.0.362";
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=";
};
sha256_linux = "sha256-jNty0iJoXG+sp7v2fGCrwZWCSZfQ4tkYe8ERixQMKL0=";
sha256_darwin = "sha256-3/P3puM6a7tCHP5eZM6IzbdPrqnhY1dTa7QWss9M08M=";
x86_64-darwin = {
zuluVersion = "8.72.0.17";
jdkVersion = "8.0.382";
hash =
if enableJavaFX then "sha256-/x8FqygivzddXsOwIV8aj/u+LPXMmokgu97vLAVEv80="
else "sha256-3dTPIPGUeT6nb3gncNvEa4VTRyQIBJpp8oZadrT2ToE=";
};
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;
aarch64-darwin = {
zuluVersion = "8.72.0.17";
jdkVersion = "8.0.382";
hash =
if enableJavaFX then "sha256-FkQ+0MzSZWUzc/HmiDVZEHGOrdKAVCdK5pm9wXXzzaU="
else "sha256-rN5AI4xAWppE4kJlzMod0JmGyHdHjTXYtx8/wOW6CFk=";
};
};
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";
};
}
} // builtins.removeAttrs args [ "callPackage" ])

View file

@ -142,7 +142,7 @@ let
home = jdk;
};
meta = (import ../../openjdk/meta.nix lib version) // {
meta = (import ../openjdk/meta.nix lib version) // {
description = "Certified builds of OpenJDK";
longDescription = ''
Certified builds of OpenJDK that can be deployed across multiple

View file

@ -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";
};
}

View file

@ -17688,7 +17688,8 @@ with pkgs;
zulip-term = callPackage ../applications/networking/instant-messengers/zulip-term { };
zulu8 = callPackage ../development/compilers/zulu/8.nix { };
zulu = callPackage ../development/compilers/zulu { };
zulu11 = callPackage ../development/compilers/zulu/11.nix { };
zulu = zulu11;
### DEVELOPMENT / INTERPRETERS

View file

@ -141,12 +141,12 @@ in {
openjdk8 = mkOpenjdk
../development/compilers/openjdk/8.nix
../development/compilers/openjdk/darwin/8.nix
../development/compilers/zulu/8.nix
{ };
openjdk11 = mkOpenjdk
../development/compilers/openjdk/11.nix
../development/compilers/openjdk/darwin/11.nix
../development/compilers/zulu/11.nix
{ openjfx = openjfx11; };
openjdk12 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/12.nix {
@ -172,7 +172,7 @@ in {
openjdk16 = mkOpenjdk
../development/compilers/openjdk/16.nix
../development/compilers/openjdk/darwin/16.nix
../development/compilers/zulu/16.nix
{
inherit openjdk16-bootstrap;
openjfx = openjfx15;
@ -180,7 +180,7 @@ in {
openjdk17 = mkOpenjdk
../development/compilers/openjdk/17.nix
../development/compilers/openjdk/darwin/17.nix
../development/compilers/zulu/17.nix
{
inherit openjdk17-bootstrap;
openjfx = openjfx17;
@ -188,7 +188,7 @@ in {
openjdk18 = mkOpenjdk
../development/compilers/openjdk/18.nix
../development/compilers/openjdk/darwin/18.nix
../development/compilers/zulu/18.nix
{
inherit openjdk18-bootstrap;
openjfx = openjfx17;
@ -196,7 +196,7 @@ in {
openjdk19 = mkOpenjdk
../development/compilers/openjdk/19.nix
../development/compilers/openjdk/darwin/19.nix
../development/compilers/zulu/19.nix
{
openjdk19-bootstrap = temurin-bin.jdk-19;
openjfx = openjfx19;
@ -204,7 +204,7 @@ in {
openjdk20 = mkOpenjdk
../development/compilers/openjdk/20.nix
../development/compilers/openjdk/darwin/20.nix
../development/compilers/zulu/20.nix
{
openjdk20-bootstrap = temurin-bin.jdk-20;
openjfx = openjfx20;