Skip to content

Commit e87ff4c

Browse files
committedFeb 2, 2025
treewide: produce darwin JDK bundles at a consistent path
1 parent 46eadeb commit e87ff4c

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed
 

‎pkgs/development/compilers/temurin-bin/jdk-darwin-base.nix

+9-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let
1919
providedCpuTypes = builtins.filter (arch: builtins.elem arch validCpuTypes) (
2020
builtins.attrNames sourcePerArch
2121
);
22-
result = stdenv.mkDerivation {
22+
result = stdenv.mkDerivation rec {
2323
pname =
2424
if sourcePerArch.packageType == "jdk" then
2525
"${name-prefix}-bin"
@@ -40,16 +40,19 @@ let
4040
installPhase = ''
4141
cd ..
4242
43-
mv $sourceRoot $out
43+
mkdir -p $out/Library/Java/JavaVirtualMachines
44+
45+
bundle=$out/Library/Java/JavaVirtualMachines/${name-prefix}-${lib.versions.major version}.jdk
46+
mv $sourceRoot $bundle
4447
4548
# jni.h expects jni_md.h to be in the header search path.
46-
ln -s $out/Contents/Home/include/darwin/*_md.h $out/Contents/Home/include/
49+
ln -s $bundle/Contents/Home/include/darwin/*_md.h $bundle/Contents/Home/include/
4750
4851
# Remove some broken manpages.
4952
# Only for 11 and earlier.
50-
[ -e "$out/Contents/Home/man/ja" ] && rm -r $out/Contents/Home/man/ja
53+
[ -e "$bundle/Contents/Home/man/ja" ] && rm -r $bundle/Contents/Home/man/ja
5154
52-
ln -s $out/Contents/Home/* $out/
55+
ln -s $bundle/Contents/Home/* $out/
5356
5457
# Propagate the setJavaClassPath setup hook from the JDK so that
5558
# any package that depends on the JDK has $CLASSPATH set up
@@ -67,7 +70,7 @@ let
6770
passthru = {
6871
jre = result;
6972
home = result;
70-
bundle = result;
73+
bundle = "${result}/Library/Java/JavaVirtualMachines/${name-prefix}-${lib.versions.major version}.jdk";
7174
};
7275

7376
meta = with lib; {

‎pkgs/development/compilers/zulu/common.nix

+11-2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ let
120120
mkdir -p $out
121121
mv * $out
122122
123+
${lib.optionalString stdenv.hostPlatform.isDarwin ''
124+
mkdir -p $out/Library/Java/JavaVirtualMachines
125+
bundle=$out/Library/Java/JavaVirtualMachines/zulu-${lib.versions.major version}.jdk
126+
mv $out/zulu-${lib.versions.major version}.jdk $bundle
127+
ln -sf $bundle/Contents/Home/* $out/
128+
''}
129+
123130
unzip ${jce-policies}
124131
mv -f ZuluJCEPolicies/*.jar $out/${lib.optionalString isJdk8 "jre/"}lib/security/
125132
@@ -174,8 +181,10 @@ let
174181
})
175182
// {
176183
home = jdk;
177-
bundle = "${jdk}/zulu-${lib.versions.major version}.jdk";
178-
};
184+
}
185+
// (lib.optionalAttrs stdenv.hostPlatform.isDarwin {
186+
bundle = "${jdk}/Library/Java/JavaVirtualMachines/zulu-${lib.versions.major version}.jdk";
187+
});
179188

180189
meta = {
181190
description = "Certified builds of OpenJDK";

0 commit comments

Comments
 (0)
Failed to load comments.