···4040 ./read-truststore-from-env-jdk10.patch4141 ./currency-date-range-jdk10.patch4242 ./increase-javadoc-heap-jdk13.patch4343- ./ignore-LegalNoticeFilePlugin.patch4343+ ./ignore-LegalNoticeFilePlugin-jdk17.patch4444 ./fix-library-path-jdk17.patch45454646 # -Wformat etc. are stricter in newer gccs, per
+167
pkgs/development/compilers/openjdk/18.nix
···11+{ stdenv, lib, fetchurl, fetchFromGitHub, bash, pkg-config, autoconf, cpio22+, file, which, unzip, zip, perl, cups, freetype, alsa-lib, libjpeg, giflib33+, libpng, zlib, lcms2, libX11, libICE, libXrender, libXext, libXt, libXtst44+, libXi, libXinerama, libXcursor, libXrandr, fontconfig, openjdk18-bootstrap55+, setJavaClassPath66+, headless ? false77+, enableJavaFX ? openjfx.meta.available, openjfx88+, enableGnome2 ? true, gtk3, gnome_vfs, glib, GConf99+}:1010+1111+let1212+ version = {1313+ feature = "18";1414+ build = "36";1515+ };1616+1717+ openjdk = stdenv.mkDerivation {1818+ pname = "openjdk" + lib.optionalString headless "-headless";1919+ version = "${version.feature}+${version.build}";2020+2121+ src = fetchFromGitHub {2222+ owner = "openjdk";2323+ repo = "jdk${version.feature}u";2424+ rev = "jdk-${version.feature}+${version.build}";2525+ sha256 = "sha256-yGPC8VA983Ml6Fv/oiEgRrcVe4oe+Q4oCHbzOmFbZq8=";2626+ };2727+2828+ nativeBuildInputs = [ pkg-config autoconf unzip ];2929+ buildInputs = [3030+ cpio file which zip perl zlib cups freetype alsa-lib libjpeg giflib3131+ libpng zlib lcms2 libX11 libICE libXrender libXext libXtst libXt libXtst3232+ libXi libXinerama libXcursor libXrandr fontconfig openjdk18-bootstrap3333+ ] ++ lib.optionals (!headless && enableGnome2) [3434+ gtk3 gnome_vfs GConf glib3535+ ];3636+3737+ patches = [3838+ ./fix-java-home-jdk10.patch3939+ ./read-truststore-from-env-jdk10.patch4040+ ./currency-date-range-jdk10.patch4141+ ./increase-javadoc-heap-jdk13.patch4242+ ./ignore-LegalNoticeFilePlugin-jdk18.patch4343+4444+ # -Wformat etc. are stricter in newer gccs, per4545+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=796774646+ # so grab the work-around from4747+ # https://src.fedoraproject.org/rpms/java-openjdk/pull-request/244848+ (fetchurl {4949+ url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";5050+ sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";5151+ })5252+ ] ++ lib.optionals (!headless && enableGnome2) [5353+ ./swing-use-gtk-jdk13.patch5454+ ];5555+5656+ postPatch = ''5757+ chmod +x configure5858+ patchShebangs --build configure5959+ '';6060+6161+ configureFlags = [6262+ "--with-boot-jdk=${openjdk18-bootstrap.home}"6363+ "--with-version-build=${version.build}"6464+ "--with-version-opt=nixos"6565+ "--with-version-pre="6666+ "--enable-unlimited-crypto"6767+ "--with-native-debug-symbols=internal"6868+ "--with-libjpeg=system"6969+ "--with-giflib=system"7070+ "--with-libpng=system"7171+ "--with-zlib=system"7272+ "--with-lcms=system"7373+ "--with-stdc++lib=dynamic"7474+ ] ++ lib.optional stdenv.isx86_64 "--with-jvm-features=zgc"7575+ ++ lib.optional headless "--enable-headless-only"7676+ ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}";7777+7878+ separateDebugInfo = true;7979+8080+ NIX_CFLAGS_COMPILE = "-Wno-error";8181+8282+ NIX_LDFLAGS = toString (lib.optionals (!headless) [8383+ "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic"8484+ ] ++ lib.optionals (!headless && enableGnome2) [8585+ "-lgtk-3" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2"8686+ ]);8787+8888+ # -j flag is explicitly rejected by the build system:8989+ # Error: 'make -jN' is not supported, use 'make JOBS=N'9090+ # Note: it does not make build sequential. Build system9191+ # still runs in parallel.9292+ enableParallelBuilding = false;9393+9494+ buildFlags = [ "images" ];9595+9696+ installPhase = ''9797+ mkdir -p $out/lib9898+9999+ mv build/*/images/jdk $out/lib/openjdk100100+101101+ # Remove some broken manpages.102102+ rm -rf $out/lib/openjdk/man/ja*103103+104104+ # Mirror some stuff in top-level.105105+ mkdir -p $out/share106106+ ln -s $out/lib/openjdk/include $out/include107107+ ln -s $out/lib/openjdk/man $out/share/man108108+109109+ # IDEs use the provided src.zip to navigate the Java codebase (https://github.com/NixOS/nixpkgs/pull/95081)110110+ ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip111111+112112+ # jni.h expects jni_md.h to be in the header search path.113113+ ln -s $out/include/linux/*_md.h $out/include/114114+115115+ # Remove crap from the installation.116116+ rm -rf $out/lib/openjdk/demo117117+ ${lib.optionalString headless ''118118+ rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so119119+ ''}120120+121121+ ln -s $out/lib/openjdk/bin $out/bin122122+ '';123123+124124+ preFixup = ''125125+ # Propagate the setJavaClassPath setup hook so that any package126126+ # that depends on the JDK has $CLASSPATH set up properly.127127+ mkdir -p $out/nix-support128128+ #TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040129129+ echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs130130+131131+ # Set JAVA_HOME automatically.132132+ mkdir -p $out/nix-support133133+ cat <<EOF > $out/nix-support/setup-hook134134+ if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi135135+ EOF136136+ '';137137+138138+ postFixup = ''139139+ # Build the set of output library directories to rpath against140140+ LIBDIRS=""141141+ for output in $outputs; do142142+ if [ "$output" = debug ]; then continue; fi143143+ LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS"144144+ done145145+ # Add the local library paths to remove dependencies on the bootstrap146146+ for output in $outputs; do147147+ if [ "$output" = debug ]; then continue; fi148148+ OUTPUTDIR=$(eval echo \$$output)149149+ BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)150150+ echo "$BINLIBS" | while read i; do151151+ patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true152152+ patchelf --shrink-rpath "$i" || true153153+ done154154+ done155155+ '';156156+157157+ disallowedReferences = [ openjdk18-bootstrap ];158158+159159+ meta = import ./meta.nix lib version.feature;160160+161161+ passthru = {162162+ architecture = "";163163+ home = "${openjdk}/lib/openjdk";164164+ inherit gtk3;165165+ };166166+ };167167+in openjdk
+81
pkgs/development/compilers/openjdk/darwin/18.nix
···11+{ lib, stdenv, fetchurl, unzip, setJavaClassPath }:22+let33+ # Details from https://www.azul.com/downloads/?version=java-18-sts&os=macos&package=jdk44+ # Note that the latest build may differ by platform55+ dist = {66+ x86_64-darwin = {77+ arch = "x64";88+ zuluVersion = "18.28.13";99+ jdkVersion = "18.0.0";1010+ sha256 = "0hc5m3d4q3n7sighq3pxkdg93vsrgj1kzla1py9nfnm9pnj9l2kq";1111+ };1212+1313+ aarch64-darwin = {1414+ arch = "aarch64";1515+ zuluVersion = "18.28.13";1616+ jdkVersion = "18.0.0";1717+ sha256 = "0ch4jp2d4pjvxbmbswvjwf7w2flajrvjg5f16ggiy80y8l0y15cm";1818+ };1919+ }."${stdenv.hostPlatform.system}";2020+2121+ jce-policies = fetchurl {2222+ # Ugh, unversioned URLs... I hope this doesn't change often enough to cause pain before we move to a Darwin source build of OpenJDK!2323+ url = "http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip";2424+ sha256 = "0nk7m0lgcbsvldq2wbfni2pzq8h818523z912i7v8hdcij5s48c0";2525+ };2626+2727+ jdk = stdenv.mkDerivation rec {2828+ pname = "zulu${dist.zuluVersion}-ca-jdk";2929+ version = dist.jdkVersion;3030+3131+ src = fetchurl {3232+ url = "https://cdn.azul.com/zulu/bin/zulu${dist.zuluVersion}-ca-jdk${dist.jdkVersion}-macosx_${dist.arch}.tar.gz";3333+ inherit (dist) sha256;3434+ curlOpts = "-H Referer:https://www.azul.com/downloads/zulu/";3535+ };3636+3737+ nativeBuildInputs = [ unzip ];3838+3939+ installPhase = ''4040+ mkdir -p $out4141+ mv * $out4242+4343+ unzip ${jce-policies}4444+ mv -f ZuluJCEPolicies/*.jar $out/lib/security/4545+4646+ # jni.h expects jni_md.h to be in the header search path.4747+ ln -s $out/include/darwin/*_md.h $out/include/4848+4949+ if [ -f $out/LICENSE ]; then5050+ install -D $out/LICENSE $out/share/zulu/LICENSE5151+ rm $out/LICENSE5252+ fi5353+ '';5454+5555+ preFixup = ''5656+ # Propagate the setJavaClassPath setup hook from the JDK so that5757+ # any package that depends on the JDK has $CLASSPATH set up5858+ # properly.5959+ mkdir -p $out/nix-support6060+ printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs6161+6262+ # Set JAVA_HOME automatically.6363+ cat <<EOF >> $out/nix-support/setup-hook6464+ if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi6565+ EOF6666+ '';6767+6868+ # fixupPhase is moving the man to share/man which breaks it because it's a6969+ # relative symlink.7070+ postFixup = ''7171+ ln -nsf ../zulu-${lib.versions.major version}.jdk/Contents/Home/man $out/share/man7272+ '';7373+7474+ passthru = {7575+ home = jdk;7676+ };7777+7878+ meta = import ./meta.nix lib version;7979+ };8080+in8181+jdk
···11+--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java22++++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java33+@@ -112,18 +112,6 @@44+ .filter(e -> Arrays.equals(e.contentBytes(), entry.contentBytes()))55+ .findFirst();66+ if (otarget.isEmpty()) {77+- if (errorIfNotSameContent) {88+- // all legal notices of the same file name are expected99+- // to contain the same content1010+- Optional<ResourcePoolEntry> ores =1111+- entries.stream().filter(e -> e.linkedTarget() == null)1212+- .findAny();1313+-1414+- if (ores.isPresent()) {1515+- throw new PluginException(ores.get().path() + " " +1616+- entry.path() + " contain different content");1717+- }1818+- }1919+ entries.add(entry);2020+ } else {2121+ entries.add(ResourcePoolEntry.createSymLink(entry.path(),