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