tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
openjdk17: init at 17.0.1+12
Kasper Gałkowski
4 years ago
64a379be
4ee9590d
+211
-24
4 changed files
expand all
collapse all
unified
split
pkgs
development
compilers
openjdk
17.nix
ignore-LegalNoticeFilePlugin.patch
servers
pufferpanel
default.nix
top-level
all-packages.nix
+162
pkgs/development/compilers/openjdk/17.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ stdenv, lib, fetchurl, fetchFromGitHub, bash, pkg-config, autoconf, cpio
2
+
, file, which, unzip, zip, perl, cups, freetype, alsa-lib, libjpeg, giflib
3
+
, libpng, zlib, lcms2, libX11, libICE, libXrender, libXext, libXt, libXtst
4
+
, libXi, libXinerama, libXcursor, libXrandr, fontconfig, openjdk17-bootstrap
5
+
, setJavaClassPath
6
+
, headless ? false
7
+
, enableJavaFX ? openjfx.meta.available, openjfx
8
+
, enableGnome2 ? true, gtk3, gnome_vfs, glib, GConf
9
+
}:
10
+
11
+
let
12
+
version = {
13
+
feature = "17";
14
+
interim = ".0.1";
15
+
build = "12";
16
+
};
17
+
18
+
openjdk = stdenv.mkDerivation {
19
+
pname = "openjdk" + lib.optionalString headless "-headless";
20
+
version = "${version.feature}${version.interim}+${version.build}";
21
+
22
+
src = fetchFromGitHub {
23
+
owner = "openjdk";
24
+
repo = "jdk${version.feature}u";
25
+
rev = "jdk-${version.feature}${version.interim}+${version.build}";
26
+
sha256 = "1l1jgbz8q7zq66npfg88r0l5xga427vrz35iys09j44b6qllrldd";
27
+
};
28
+
29
+
nativeBuildInputs = [ pkg-config autoconf unzip ];
30
+
buildInputs = [
31
+
cpio file which zip perl zlib cups freetype alsa-lib libjpeg giflib
32
+
libpng zlib lcms2 libX11 libICE libXrender libXext libXtst libXt libXtst
33
+
libXi libXinerama libXcursor libXrandr fontconfig openjdk17-bootstrap
34
+
] ++ lib.optionals (!headless && enableGnome2) [
35
+
gtk3 gnome_vfs GConf glib
36
+
];
37
+
38
+
patches = [
39
+
./fix-java-home-jdk10.patch
40
+
./read-truststore-from-env-jdk10.patch
41
+
./currency-date-range-jdk10.patch
42
+
./increase-javadoc-heap-jdk13.patch
43
+
./ignore-LegalNoticeFilePlugin.patch
44
+
45
+
# -Wformat etc. are stricter in newer gccs, per
46
+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
47
+
# so grab the work-around from
48
+
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
49
+
(fetchurl {
50
+
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
51
+
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
52
+
})
53
+
] ++ lib.optionals (!headless && enableGnome2) [
54
+
./swing-use-gtk-jdk13.patch
55
+
];
56
+
57
+
postPatch = ''
58
+
chmod +x configure
59
+
patchShebangs --build configure
60
+
'';
61
+
62
+
configureFlags = [
63
+
"--with-boot-jdk=${openjdk17-bootstrap.home}"
64
+
"--with-version-build=${version.build}"
65
+
"--with-version-opt=nixos"
66
+
"--with-version-pre="
67
+
"--enable-unlimited-crypto"
68
+
"--with-native-debug-symbols=internal"
69
+
"--with-libjpeg=system"
70
+
"--with-giflib=system"
71
+
"--with-libpng=system"
72
+
"--with-zlib=system"
73
+
"--with-lcms=system"
74
+
"--with-stdc++lib=dynamic"
75
+
] ++ lib.optional stdenv.isx86_64 "--with-jvm-features=zgc"
76
+
++ lib.optional headless "--enable-headless-only"
77
+
++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}";
78
+
79
+
separateDebugInfo = true;
80
+
81
+
NIX_CFLAGS_COMPILE = "-Wno-error";
82
+
83
+
NIX_LDFLAGS = toString (lib.optionals (!headless) [
84
+
"-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic"
85
+
] ++ lib.optionals (!headless && enableGnome2) [
86
+
"-lgtk-3" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2"
87
+
]);
88
+
89
+
buildFlags = [ "images" ];
90
+
91
+
installPhase = ''
92
+
mkdir -p $out/lib
93
+
94
+
mv build/*/images/jdk $out/lib/openjdk
95
+
96
+
# Remove some broken manpages.
97
+
rm -rf $out/lib/openjdk/man/ja*
98
+
99
+
# Mirror some stuff in top-level.
100
+
mkdir -p $out/share
101
+
ln -s $out/lib/openjdk/include $out/include
102
+
ln -s $out/lib/openjdk/man $out/share/man
103
+
104
+
# IDEs use the provided src.zip to navigate the Java codebase (https://github.com/NixOS/nixpkgs/pull/95081)
105
+
ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip
106
+
107
+
# jni.h expects jni_md.h to be in the header search path.
108
+
ln -s $out/include/linux/*_md.h $out/include/
109
+
110
+
# Remove crap from the installation.
111
+
rm -rf $out/lib/openjdk/demo
112
+
${lib.optionalString headless ''
113
+
rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
114
+
''}
115
+
116
+
ln -s $out/lib/openjdk/bin $out/bin
117
+
'';
118
+
119
+
preFixup = ''
120
+
# Propagate the setJavaClassPath setup hook so that any package
121
+
# that depends on the JDK has $CLASSPATH set up properly.
122
+
mkdir -p $out/nix-support
123
+
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
124
+
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
125
+
126
+
# Set JAVA_HOME automatically.
127
+
mkdir -p $out/nix-support
128
+
cat <<EOF > $out/nix-support/setup-hook
129
+
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
130
+
EOF
131
+
'';
132
+
133
+
postFixup = ''
134
+
# Build the set of output library directories to rpath against
135
+
LIBDIRS=""
136
+
for output in $outputs; do
137
+
if [ "$output" = debug ]; then continue; fi
138
+
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS"
139
+
done
140
+
# Add the local library paths to remove dependencies on the bootstrap
141
+
for output in $outputs; do
142
+
if [ "$output" = debug ]; then continue; fi
143
+
OUTPUTDIR=$(eval echo \$$output)
144
+
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
145
+
echo "$BINLIBS" | while read i; do
146
+
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
147
+
patchelf --shrink-rpath "$i" || true
148
+
done
149
+
done
150
+
'';
151
+
152
+
disallowedReferences = [ openjdk17-bootstrap ];
153
+
154
+
meta = import ./meta.nix lib;
155
+
156
+
passthru = {
157
+
architecture = "";
158
+
home = "${openjdk}/lib/openjdk";
159
+
inherit gtk3;
160
+
};
161
+
};
162
+
in openjdk
+21
pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java
2
+
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java
3
+
@@ -112,18 +112,6 @@
4
+
.filter(e -> Arrays.equals(e.contentBytes(), entry.contentBytes()))
5
+
.findFirst();
6
+
if (!otarget.isPresent()) {
7
+
- if (errorIfNotSameContent) {
8
+
- // all legal notices of the same file name are expected
9
+
- // to contain the same content
10
+
- Optional<ResourcePoolEntry> ores =
11
+
- entries.stream().filter(e -> e.linkedTarget() == null)
12
+
- .findAny();
13
+
-
14
+
- if (ores.isPresent()) {
15
+
- throw new PluginException(ores.get().path() + " " +
16
+
- entry.path() + " contain different content");
17
+
- }
18
+
- }
19
+
entries.add(entry);
20
+
} else {
21
+
entries.add(ResourcePoolEntry.createSymLink(entry.path(),
+1
-1
pkgs/servers/pufferpanel/default.nix
···
5
, pkgs
6
, stdenv
7
, fetchzip
8
-
, openjdk16
9
, nodejs
10
, pathDeps ? [ ]
11
}:
···
5
, pkgs
6
, stdenv
7
, fetchzip
8
+
, jdk
9
, nodejs
10
, pathDeps ? [ ]
11
}:
+27
-23
pkgs/top-level/all-packages.nix
···
11671
else
11672
callPackage ../development/compilers/openjdk/bootstrap.nix { version = "10"; };
11673
11674
-
/* currently maintained LTS JDK */
11675
openjdk11 =
11676
if stdenv.isDarwin then
11677
callPackage ../development/compilers/openjdk/darwin/11.nix { }
···
11687
else
11688
openjdk11.override { headless = true; };
11689
11690
-
openjdk16-bootstrap =
11691
-
if adoptopenjdk-hotspot-bin-15.meta.available then
11692
-
adoptopenjdk-hotspot-bin-15
11693
else
11694
-
/* adoptopenjdk not available for i686, so fall back to our old builds of 12, 13, & 14 for bootstrapping */
11695
-
callPackage ../development/compilers/openjdk/15.nix {
11696
openjfx = openjfx11; /* need this despite next line :-( */
11697
enableJavaFX = false;
11698
headless = true;
11699
inherit (gnome2) GConf gnome_vfs;
11700
-
openjdk15-bootstrap = callPackage ../development/compilers/openjdk/14.nix {
11701
openjfx = openjfx11; /* need this despite next line :-( */
11702
enableJavaFX = false;
11703
headless = true;
11704
inherit (gnome2) GConf gnome_vfs;
11705
-
openjdk14-bootstrap = callPackage ../development/compilers/openjdk/13.nix {
11706
openjfx = openjfx11; /* need this despite next line :-( */
11707
enableJavaFX = false;
11708
headless = true;
11709
inherit (gnome2) GConf gnome_vfs;
11710
-
openjdk13-bootstrap = callPackage ../development/compilers/openjdk/12.nix {
11711
-
stdenv = gcc8Stdenv; /* build segfaults with gcc9 or newer, so use gcc8 like Debian does */
11712
openjfx = openjfx11; /* need this despite next line :-( */
11713
enableJavaFX = false;
11714
headless = true;
11715
inherit (gnome2) GConf gnome_vfs;
0
0
0
0
0
0
0
11716
};
11717
};
11718
};
···
11722
jdk11_headless = openjdk11_headless;
11723
11724
/* Latest JDK */
11725
-
openjdk16 =
11726
if stdenv.isDarwin then
11727
callPackage ../development/compilers/openjdk/darwin { }
11728
else
11729
-
callPackage ../development/compilers/openjdk/16.nix {
11730
openjfx = openjfx15;
11731
inherit (gnome2) GConf gnome_vfs;
11732
};
11733
11734
-
openjdk16_headless =
11735
if stdenv.isDarwin then
11736
-
openjdk16
11737
else
11738
-
openjdk16.override { headless = true; };
11739
11740
-
jdk16 = openjdk16;
11741
-
jdk16_headless = openjdk16_headless;
11742
11743
/* default JDK */
11744
-
11745
-
jdk = jdk16;
11746
11747
# Since the introduction of the Java Platform Module System in Java 9, Java
11748
# no longer ships a separate JRE package.
···
11751
# 'jre_minimal' to build a bespoke JRE containing only the modules you need.
11752
#
11753
# For a general-purpose system, 'jre' defaults to the full JDK:
11754
-
jre = jdk16;
11755
-
jre_headless = jdk16_headless;
11756
11757
jre_minimal = callPackage ../development/compilers/openjdk/jre.nix { };
11758
11759
-
openjdk = openjdk16;
11760
-
openjdk_headless = openjdk16_headless;
11761
11762
inherit (callPackages ../development/compilers/graalvm {
11763
gcc = if stdenv.targetPlatform.isDarwin then gcc8 else gcc;
···
11671
else
11672
callPackage ../development/compilers/openjdk/bootstrap.nix { version = "10"; };
11673
0
11674
openjdk11 =
11675
if stdenv.isDarwin then
11676
callPackage ../development/compilers/openjdk/darwin/11.nix { }
···
11686
else
11687
openjdk11.override { headless = true; };
11688
11689
+
openjdk17-bootstrap =
11690
+
if adoptopenjdk-hotspot-bin-16.meta.available then
11691
+
adoptopenjdk-hotspot-bin-16
11692
else
11693
+
/* adoptopenjdk not available for i686, so fall back to our old builds for bootstrapping */
11694
+
callPackage ../development/compilers/openjdk/16.nix {
11695
openjfx = openjfx11; /* need this despite next line :-( */
11696
enableJavaFX = false;
11697
headless = true;
11698
inherit (gnome2) GConf gnome_vfs;
11699
+
openjdk16-bootstrap = callPackage ../development/compilers/openjdk/15.nix {
11700
openjfx = openjfx11; /* need this despite next line :-( */
11701
enableJavaFX = false;
11702
headless = true;
11703
inherit (gnome2) GConf gnome_vfs;
11704
+
openjdk15-bootstrap = callPackage ../development/compilers/openjdk/14.nix {
11705
openjfx = openjfx11; /* need this despite next line :-( */
11706
enableJavaFX = false;
11707
headless = true;
11708
inherit (gnome2) GConf gnome_vfs;
11709
+
openjdk14-bootstrap = callPackage ../development/compilers/openjdk/13.nix {
0
11710
openjfx = openjfx11; /* need this despite next line :-( */
11711
enableJavaFX = false;
11712
headless = true;
11713
inherit (gnome2) GConf gnome_vfs;
11714
+
openjdk13-bootstrap = callPackage ../development/compilers/openjdk/12.nix {
11715
+
stdenv = gcc8Stdenv; /* build segfaults with gcc9 or newer, so use gcc8 like Debian does */
11716
+
openjfx = openjfx11; /* need this despite next line :-( */
11717
+
enableJavaFX = false;
11718
+
headless = true;
11719
+
inherit (gnome2) GConf gnome_vfs;
11720
+
};
11721
};
11722
};
11723
};
···
11727
jdk11_headless = openjdk11_headless;
11728
11729
/* Latest JDK */
11730
+
openjdk17 =
11731
if stdenv.isDarwin then
11732
callPackage ../development/compilers/openjdk/darwin { }
11733
else
11734
+
callPackage ../development/compilers/openjdk/17.nix {
11735
openjfx = openjfx15;
11736
inherit (gnome2) GConf gnome_vfs;
11737
};
11738
11739
+
openjdk17_headless =
11740
if stdenv.isDarwin then
11741
+
openjdk17
11742
else
11743
+
openjdk17.override { headless = true; };
11744
11745
+
jdk17 = openjdk17;
11746
+
jdk17_headless = openjdk17_headless;
11747
11748
/* default JDK */
11749
+
jdk = jdk17;
0
11750
11751
# Since the introduction of the Java Platform Module System in Java 9, Java
11752
# no longer ships a separate JRE package.
···
11755
# 'jre_minimal' to build a bespoke JRE containing only the modules you need.
11756
#
11757
# For a general-purpose system, 'jre' defaults to the full JDK:
11758
+
jre = jdk17;
11759
+
jre_headless = jdk17_headless;
11760
11761
jre_minimal = callPackage ../development/compilers/openjdk/jre.nix { };
11762
11763
+
openjdk = openjdk17;
11764
+
openjdk_headless = openjdk17_headless;
11765
11766
inherit (callPackages ../development/compilers/graalvm {
11767
gcc = if stdenv.targetPlatform.isDarwin then gcc8 else gcc;