2 Commits

Author SHA1 Message Date
96ff6ce512 openjdk: format
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2024-11-09 06:46:37 +01:00
a2ff18c06a openjdk: remove references also in CA-derivations
analog to #350137

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
2024-11-09 06:45:44 +01:00

View File

@@ -12,6 +12,7 @@
lndir,
unzip,
ensureNewerSourcesForZipFilesHook,
removeReferencesTo,
cpio,
file,
@@ -133,13 +134,7 @@ stdenv.mkDerivation (finalAttrs: {
pname = "openjdk" + lib.optionalString headless "-headless";
inherit version;
outputs =
[
"out"
]
++ lib.optionals (!atLeast11) [
"jre"
];
outputs = [ "out" ] ++ lib.optionals (!atLeast11) [ "jre" ];
inherit (source) src;
@@ -244,19 +239,12 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs =
[
pkg-config
removeReferencesTo
]
++ lib.optionals atLeast11 [
autoconf
]
++ lib.optionals (!atLeast11) [
lndir
]
++ [
unzip
]
++ lib.optionals atLeast21 [
ensureNewerSourcesForZipFilesHook
];
++ lib.optionals atLeast11 [ autoconf ]
++ lib.optionals (!atLeast11) [ lndir ]
++ [ unzip ]
++ lib.optionals atLeast21 [ ensureNewerSourcesForZipFilesHook ];
buildInputs =
[
@@ -270,9 +258,7 @@ stdenv.mkDerivation (finalAttrs: {
cups
freetype
]
++ lib.optionals (atLeast11 && !atLeast21) [
harfbuzz
]
++ lib.optionals (atLeast11 && !atLeast21) [ harfbuzz ]
++ [
alsa-lib
libjpeg
@@ -287,15 +273,9 @@ stdenv.mkDerivation (finalAttrs: {
libX11
libICE
]
++ lib.optionals (!atLeast11) [
libXext
]
++ [
libXrender
]
++ lib.optionals atLeast11 [
libXext
]
++ lib.optionals (!atLeast11) [ libXext ]
++ [ libXrender ]
++ lib.optionals atLeast11 [ libXext ]
++ [
libXtst
libXt
@@ -314,9 +294,7 @@ stdenv.mkDerivation (finalAttrs: {
propagatedBuildInputs = lib.optionals (!atLeast11) [ setJavaClassPath ];
nativeInstallCheckInputs = lib.optionals atLeast23 [
versionCheckHook
];
nativeInstallCheckInputs = lib.optionals atLeast23 [ versionCheckHook ];
# JDK's build system attempts to specifically detect
# and special-case WSL, and we don't want it to do that,
@@ -328,9 +306,7 @@ stdenv.mkDerivation (finalAttrs: {
# https://openjdk.org/groups/build/doc/building.html
configureFlags =
[
"--with-boot-jdk=${jdk-bootstrap'.home}"
]
[ "--with-boot-jdk=${jdk-bootstrap'.home}" ]
++ (
if atLeast23 then
[
@@ -342,9 +318,7 @@ stdenv.mkDerivation (finalAttrs: {
"--with-version-build=${versionBuild}"
"--with-version-opt=nixos"
]
++ [
"--with-version-pre="
]
++ [ "--with-version-pre=" ]
else
[
"--with-update-version=${lib.removePrefix "${featureVersion}u" (lib.elemAt versionSplit 0)}"
@@ -363,9 +337,7 @@ stdenv.mkDerivation (finalAttrs: {
"--with-harfbuzz=system"
]
else
[
"--disable-freetype-bundling"
]
[ "--disable-freetype-bundling" ]
)
++ (
if atLeast11 then
@@ -382,12 +354,8 @@ stdenv.mkDerivation (finalAttrs: {
"--with-giflib=system"
]
)
++ [
"--with-stdc++lib=dynamic"
]
++ lib.optionals (featureVersion == "11") [
"--disable-warnings-as-errors"
]
++ [ "--with-stdc++lib=dynamic" ]
++ lib.optionals (featureVersion == "11") [ "--disable-warnings-as-errors" ]
# OpenJDK 11 cannot be built by recent versions of Clang, as far as I can tell (see
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260319). Known to
# compile with LLVM 12.
@@ -576,6 +544,8 @@ stdenv.mkDerivation (finalAttrs: {
mkdir -p $out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
# remove references also in CA-derivations
find "$out" -type f -exec remove-references-to -t ${jdk-bootstrap'} '{}' +
''
else
''
@@ -584,6 +554,8 @@ stdenv.mkDerivation (finalAttrs: {
# properly.
mkdir -p $jre/nix-support
printWords ${setJavaClassPath} > $jre/nix-support/propagated-build-inputs
# remove references also in CA-derivations
find "$out" -type f -exec remove-references-to -t ${jdk-bootstrap} '{}' +
''
)
+ ''
@@ -617,9 +589,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
# TODO: The OpenJDK 8 derivation got this wrong.
disallowedReferences = [
(if atLeast11 then jdk-bootstrap' else jdk-bootstrap)
];
disallowedReferences = [ (if atLeast11 then jdk-bootstrap' else jdk-bootstrap) ];
passthru =
{
@@ -628,9 +598,7 @@ stdenv.mkDerivation (finalAttrs: {
inherit (source) updateScript;
}
// (if atLeast11 then { inherit gtk3; } else { inherit gtk2; })
// lib.optionalAttrs (!atLeast23) {
inherit architecture;
};
// lib.optionalAttrs (!atLeast23) { inherit architecture; };
meta = {
description = "Open-source Java Development Kit";
@@ -652,9 +620,7 @@ stdenv.mkDerivation (finalAttrs: {
"armv6l-linux"
"powerpc64le-linux"
]
++ lib.optionals atLeast17 [
"riscv64-linux"
];
++ lib.optionals atLeast17 [ "riscv64-linux" ];
# OpenJDK 8 was broken for musl at 2024-01-17. Tracking issue:
# https://github.com/NixOS/nixpkgs/issues/281618
# error: isnanf was not declared in this scope