openjdk18: init at 18+36

authored by xeals and committed by Mario Rodas da40a449 b6cb656c

+290 -1
+1 -1
pkgs/development/compilers/openjdk/17.nix
··· 40 ./read-truststore-from-env-jdk10.patch 41 ./currency-date-range-jdk10.patch 42 ./increase-javadoc-heap-jdk13.patch 43 - ./ignore-LegalNoticeFilePlugin.patch 44 ./fix-library-path-jdk17.patch 45 46 # -Wformat etc. are stricter in newer gccs, per
··· 40 ./read-truststore-from-env-jdk10.patch 41 ./currency-date-range-jdk10.patch 42 ./increase-javadoc-heap-jdk13.patch 43 + ./ignore-LegalNoticeFilePlugin-jdk17.patch 44 ./fix-library-path-jdk17.patch 45 46 # -Wformat etc. are stricter in newer gccs, per
+167
pkgs/development/compilers/openjdk/18.nix
···
··· 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, openjdk18-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 = "18"; 14 + build = "36"; 15 + }; 16 + 17 + openjdk = stdenv.mkDerivation { 18 + pname = "openjdk" + lib.optionalString headless "-headless"; 19 + version = "${version.feature}+${version.build}"; 20 + 21 + src = fetchFromGitHub { 22 + owner = "openjdk"; 23 + repo = "jdk${version.feature}u"; 24 + rev = "jdk-${version.feature}+${version.build}"; 25 + sha256 = "sha256-yGPC8VA983Ml6Fv/oiEgRrcVe4oe+Q4oCHbzOmFbZq8="; 26 + }; 27 + 28 + nativeBuildInputs = [ pkg-config autoconf unzip ]; 29 + buildInputs = [ 30 + cpio file which zip perl zlib cups freetype alsa-lib libjpeg giflib 31 + libpng zlib lcms2 libX11 libICE libXrender libXext libXtst libXt libXtst 32 + libXi libXinerama libXcursor libXrandr fontconfig openjdk18-bootstrap 33 + ] ++ lib.optionals (!headless && enableGnome2) [ 34 + gtk3 gnome_vfs GConf glib 35 + ]; 36 + 37 + patches = [ 38 + ./fix-java-home-jdk10.patch 39 + ./read-truststore-from-env-jdk10.patch 40 + ./currency-date-range-jdk10.patch 41 + ./increase-javadoc-heap-jdk13.patch 42 + ./ignore-LegalNoticeFilePlugin-jdk18.patch 43 + 44 + # -Wformat etc. are stricter in newer gccs, per 45 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 46 + # so grab the work-around from 47 + # https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24 48 + (fetchurl { 49 + url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch"; 50 + sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r"; 51 + }) 52 + ] ++ lib.optionals (!headless && enableGnome2) [ 53 + ./swing-use-gtk-jdk13.patch 54 + ]; 55 + 56 + postPatch = '' 57 + chmod +x configure 58 + patchShebangs --build configure 59 + ''; 60 + 61 + configureFlags = [ 62 + "--with-boot-jdk=${openjdk18-bootstrap.home}" 63 + "--with-version-build=${version.build}" 64 + "--with-version-opt=nixos" 65 + "--with-version-pre=" 66 + "--enable-unlimited-crypto" 67 + "--with-native-debug-symbols=internal" 68 + "--with-libjpeg=system" 69 + "--with-giflib=system" 70 + "--with-libpng=system" 71 + "--with-zlib=system" 72 + "--with-lcms=system" 73 + "--with-stdc++lib=dynamic" 74 + ] ++ lib.optional stdenv.isx86_64 "--with-jvm-features=zgc" 75 + ++ lib.optional headless "--enable-headless-only" 76 + ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}"; 77 + 78 + separateDebugInfo = true; 79 + 80 + NIX_CFLAGS_COMPILE = "-Wno-error"; 81 + 82 + NIX_LDFLAGS = toString (lib.optionals (!headless) [ 83 + "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic" 84 + ] ++ lib.optionals (!headless && enableGnome2) [ 85 + "-lgtk-3" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2" 86 + ]); 87 + 88 + # -j flag is explicitly rejected by the build system: 89 + # Error: 'make -jN' is not supported, use 'make JOBS=N' 90 + # Note: it does not make build sequential. Build system 91 + # still runs in parallel. 92 + enableParallelBuilding = false; 93 + 94 + buildFlags = [ "images" ]; 95 + 96 + installPhase = '' 97 + mkdir -p $out/lib 98 + 99 + mv build/*/images/jdk $out/lib/openjdk 100 + 101 + # Remove some broken manpages. 102 + rm -rf $out/lib/openjdk/man/ja* 103 + 104 + # Mirror some stuff in top-level. 105 + mkdir -p $out/share 106 + ln -s $out/lib/openjdk/include $out/include 107 + ln -s $out/lib/openjdk/man $out/share/man 108 + 109 + # IDEs use the provided src.zip to navigate the Java codebase (https://github.com/NixOS/nixpkgs/pull/95081) 110 + ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip 111 + 112 + # jni.h expects jni_md.h to be in the header search path. 113 + ln -s $out/include/linux/*_md.h $out/include/ 114 + 115 + # Remove crap from the installation. 116 + rm -rf $out/lib/openjdk/demo 117 + ${lib.optionalString headless '' 118 + rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so 119 + ''} 120 + 121 + ln -s $out/lib/openjdk/bin $out/bin 122 + ''; 123 + 124 + preFixup = '' 125 + # Propagate the setJavaClassPath setup hook so that any package 126 + # that depends on the JDK has $CLASSPATH set up properly. 127 + mkdir -p $out/nix-support 128 + #TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040 129 + echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs 130 + 131 + # Set JAVA_HOME automatically. 132 + mkdir -p $out/nix-support 133 + cat <<EOF > $out/nix-support/setup-hook 134 + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi 135 + EOF 136 + ''; 137 + 138 + postFixup = '' 139 + # Build the set of output library directories to rpath against 140 + LIBDIRS="" 141 + for output in $outputs; do 142 + if [ "$output" = debug ]; then continue; fi 143 + LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS" 144 + done 145 + # Add the local library paths to remove dependencies on the bootstrap 146 + for output in $outputs; do 147 + if [ "$output" = debug ]; then continue; fi 148 + OUTPUTDIR=$(eval echo \$$output) 149 + BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*) 150 + echo "$BINLIBS" | while read i; do 151 + patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true 152 + patchelf --shrink-rpath "$i" || true 153 + done 154 + done 155 + ''; 156 + 157 + disallowedReferences = [ openjdk18-bootstrap ]; 158 + 159 + meta = import ./meta.nix lib version.feature; 160 + 161 + passthru = { 162 + architecture = ""; 163 + home = "${openjdk}/lib/openjdk"; 164 + inherit gtk3; 165 + }; 166 + }; 167 + in openjdk
+81
pkgs/development/compilers/openjdk/darwin/18.nix
···
··· 1 + { lib, stdenv, fetchurl, unzip, setJavaClassPath }: 2 + let 3 + # Details from https://www.azul.com/downloads/?version=java-18-sts&os=macos&package=jdk 4 + # Note that the latest build may differ by platform 5 + dist = { 6 + x86_64-darwin = { 7 + arch = "x64"; 8 + zuluVersion = "18.28.13"; 9 + jdkVersion = "18.0.0"; 10 + sha256 = "0hc5m3d4q3n7sighq3pxkdg93vsrgj1kzla1py9nfnm9pnj9l2kq"; 11 + }; 12 + 13 + aarch64-darwin = { 14 + arch = "aarch64"; 15 + zuluVersion = "18.28.13"; 16 + jdkVersion = "18.0.0"; 17 + sha256 = "0ch4jp2d4pjvxbmbswvjwf7w2flajrvjg5f16ggiy80y8l0y15cm"; 18 + }; 19 + }."${stdenv.hostPlatform.system}"; 20 + 21 + jce-policies = fetchurl { 22 + # Ugh, unversioned URLs... I hope this doesn't change often enough to cause pain before we move to a Darwin source build of OpenJDK! 23 + url = "http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip"; 24 + sha256 = "0nk7m0lgcbsvldq2wbfni2pzq8h818523z912i7v8hdcij5s48c0"; 25 + }; 26 + 27 + jdk = stdenv.mkDerivation rec { 28 + pname = "zulu${dist.zuluVersion}-ca-jdk"; 29 + version = dist.jdkVersion; 30 + 31 + src = fetchurl { 32 + url = "https://cdn.azul.com/zulu/bin/zulu${dist.zuluVersion}-ca-jdk${dist.jdkVersion}-macosx_${dist.arch}.tar.gz"; 33 + inherit (dist) sha256; 34 + curlOpts = "-H Referer:https://www.azul.com/downloads/zulu/"; 35 + }; 36 + 37 + nativeBuildInputs = [ unzip ]; 38 + 39 + installPhase = '' 40 + mkdir -p $out 41 + mv * $out 42 + 43 + unzip ${jce-policies} 44 + mv -f ZuluJCEPolicies/*.jar $out/lib/security/ 45 + 46 + # jni.h expects jni_md.h to be in the header search path. 47 + ln -s $out/include/darwin/*_md.h $out/include/ 48 + 49 + if [ -f $out/LICENSE ]; then 50 + install -D $out/LICENSE $out/share/zulu/LICENSE 51 + rm $out/LICENSE 52 + fi 53 + ''; 54 + 55 + preFixup = '' 56 + # Propagate the setJavaClassPath setup hook from the JDK so that 57 + # any package that depends on the JDK has $CLASSPATH set up 58 + # properly. 59 + mkdir -p $out/nix-support 60 + printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs 61 + 62 + # Set JAVA_HOME automatically. 63 + cat <<EOF >> $out/nix-support/setup-hook 64 + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi 65 + EOF 66 + ''; 67 + 68 + # fixupPhase is moving the man to share/man which breaks it because it's a 69 + # relative symlink. 70 + postFixup = '' 71 + ln -nsf ../zulu-${lib.versions.major version}.jdk/Contents/Home/man $out/share/man 72 + ''; 73 + 74 + passthru = { 75 + home = jdk; 76 + }; 77 + 78 + meta = import ./meta.nix lib version; 79 + }; 80 + in 81 + jdk
+21
pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin-jdk18.patch
···
··· 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.isEmpty()) { 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(),
pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin.patch pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin-jdk17.patch
+6
pkgs/top-level/all-packages.nix
··· 14050 14051 openjdk16-bootstrap = javaPackages.compiler.openjdk16-bootstrap; 14052 14053 /* default JDK */ 14054 jdk = jdk17; 14055
··· 14050 14051 openjdk16-bootstrap = javaPackages.compiler.openjdk16-bootstrap; 14052 14053 + openjdk18-bootstrap = javaPackages.compiler.openjdk18-bootstrap; 14054 + openjdk18 = javaPackages.compiler.openjdk18; 14055 + openjdk18_headless = javaPackages.compiler.openjdk18.headless; 14056 + jdk18 = openjdk18; 14057 + jdk18_headless = openjdk18_headless; 14058 + 14059 /* default JDK */ 14060 jdk = jdk17; 14061
+14
pkgs/top-level/java-packages.nix
··· 133 inherit openjdk16-bootstrap; 134 }); 135 136 openjdk8 = mkOpenjdk 137 ../development/compilers/openjdk/8.nix 138 ../development/compilers/openjdk/darwin/8.nix ··· 177 ../development/compilers/openjdk/darwin/17.nix 178 { 179 inherit openjdk17-bootstrap; 180 openjfx = openjfx17; 181 }; 182 };
··· 133 inherit openjdk16-bootstrap; 134 }); 135 136 + openjdk18-bootstrap = mkBootstrap adoptopenjdk-17 137 + ../development/compilers/openjdk/17.nix 138 + (bootstrapArgs // { 139 + inherit openjdk17-bootstrap; 140 + }); 141 + 142 openjdk8 = mkOpenjdk 143 ../development/compilers/openjdk/8.nix 144 ../development/compilers/openjdk/darwin/8.nix ··· 183 ../development/compilers/openjdk/darwin/17.nix 184 { 185 inherit openjdk17-bootstrap; 186 + openjfx = openjfx17; 187 + }; 188 + 189 + openjdk18 = mkOpenjdk 190 + ../development/compilers/openjdk/18.nix 191 + ../development/compilers/openjdk/darwin/18.nix 192 + { 193 + inherit openjdk18-bootstrap; 194 openjfx = openjfx17; 195 }; 196 };