From 77acd709f994edb175dee3fc97ffa3cf858281c1 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 6 Oct 2024 02:31:03 +0100 Subject: [PATCH] openjdk: format `generic.nix` with `nixfmt-rfc-style` --- .../development/compilers/openjdk/generic.nix | 262 ++++++++++-------- 1 file changed, 139 insertions(+), 123 deletions(-) diff --git a/pkgs/development/compilers/openjdk/generic.nix b/pkgs/development/compilers/openjdk/generic.nix index 420335b55bf6..9aba729061c6 100644 --- a/pkgs/development/compilers/openjdk/generic.nix +++ b/pkgs/development/compilers/openjdk/generic.nix @@ -1,48 +1,49 @@ -{ stdenv -, lib -, fetchurl -, fetchpatch -, fetchFromGitHub -, pkg-config -, autoconf -, cpio -, file -, which -, unzip -, zip -, perl -, cups -, freetype -, alsa-lib -, libjpeg -, giflib -, libpng -, zlib -, lcms2 -, libX11 -, libICE -, libXrender -, libXext -, libXt -, libXtst -, libXi -, libXinerama -, libXcursor -, libXrandr -, fontconfig -, openjdk23-bootstrap -, ensureNewerSourcesForZipFilesHook -, setJavaClassPath +{ + stdenv, + lib, + fetchurl, + fetchpatch, + fetchFromGitHub, + pkg-config, + autoconf, + cpio, + file, + which, + unzip, + zip, + perl, + cups, + freetype, + alsa-lib, + libjpeg, + giflib, + libpng, + zlib, + lcms2, + libX11, + libICE, + libXrender, + libXext, + libXt, + libXtst, + libXi, + libXinerama, + libXcursor, + libXrandr, + fontconfig, + openjdk23-bootstrap, + ensureNewerSourcesForZipFilesHook, + setJavaClassPath, # TODO(@sternenseemann): gtk3 fails to evaluate in pkgsCross.ghcjs.buildPackages # which should be fixable, this is a no-rebuild workaround for GHC. -, headless ? stdenv.targetPlatform.isGhcjs -, enableJavaFX ? false -, openjfx -, enableGtk ? true -, gtk3 -, glib -, writeShellScript -, versionCheckHook + headless ? stdenv.targetPlatform.isGhcjs, + enableJavaFX ? false, + openjfx, + enableGtk ? true, + gtk3, + glib, + writeShellScript, + versionCheckHook, }: let @@ -71,56 +72,65 @@ stdenv.mkDerivation (finalAttrs: { hash = info.hash; }; - nativeBuildInputs = [ pkg-config autoconf unzip ensureNewerSourcesForZipFilesHook ]; - buildInputs = [ - cpio - file - which - zip - perl - zlib - cups - freetype - alsa-lib - libjpeg - giflib - libpng - zlib - lcms2 - libX11 - libICE - libXrender - libXext - libXtst - libXt - libXtst - libXi - libXinerama - libXcursor - libXrandr - fontconfig - openjdk-bootstrap - ] ++ lib.optionals (!headless && enableGtk) [ - gtk3 - glib + nativeBuildInputs = [ + pkg-config + autoconf + unzip + ensureNewerSourcesForZipFilesHook ]; + buildInputs = + [ + cpio + file + which + zip + perl + zlib + cups + freetype + alsa-lib + libjpeg + giflib + libpng + zlib + lcms2 + libX11 + libICE + libXrender + libXext + libXtst + libXt + libXtst + libXi + libXinerama + libXcursor + libXrandr + fontconfig + openjdk-bootstrap + ] + ++ lib.optionals (!headless && enableGtk) [ + gtk3 + glib + ]; - patches = [ - ./fix-java-home-jdk21.patch - ./read-truststore-from-env-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk18.patch + patches = + [ + ./fix-java-home-jdk21.patch + ./read-truststore-from-env-jdk10.patch + ./increase-javadoc-heap-jdk13.patch + ./ignore-LegalNoticeFilePlugin-jdk18.patch - # Fix build for gnumake-4.4.1: - # https://github.com/openjdk/jdk/pull/12992 - (fetchpatch { - name = "gnumake-4.4.1"; - url = "https://github.com/openjdk/jdk/commit/9341d135b855cc208d48e47d30cd90aafa354c36.patch"; - hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; - }) - ] ++ lib.optionals (!headless && enableGtk) [ - ./swing-use-gtk-jdk13.patch - ]; + # Fix build for gnumake-4.4.1: + # https://github.com/openjdk/jdk/pull/12992 + (fetchpatch { + name = "gnumake-4.4.1"; + url = "https://github.com/openjdk/jdk/commit/9341d135b855cc208d48e47d30cd90aafa354c36.patch"; + hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; + }) + ] + ++ lib.optionals (!headless && enableGtk) [ + ./swing-use-gtk-jdk13.patch + ]; postPatch = '' chmod +x configure @@ -130,46 +140,52 @@ stdenv.mkDerivation (finalAttrs: { # JDK's build system attempts to specifically detect # and special-case WSL, and we don't want it to do that, # so pass the correct platform names explicitly - configurePlatforms = [ "build" "host" ]; - + configurePlatforms = [ + "build" + "host" + ]; # https://openjdk.org/groups/build/doc/building.html - configureFlags = [ - "--with-boot-jdk=${openjdk-bootstrap.home}" - "--with-version-string=${version}" - "--with-vendor-version-string=(nix)" - "--enable-unlimited-crypto" - "--with-native-debug-symbols=internal" - "--with-libjpeg=system" - "--with-giflib=system" - "--with-libpng=system" - "--with-zlib=system" - "--with-lcms=system" - "--with-stdc++lib=dynamic" - ] - ++ lib.optionals stdenv.cc.isClang [ - "--with-toolchain-type=clang" - # Explicitly tell Clang to compile C++ files as C++, see - # https://github.com/NixOS/nixpkgs/issues/150655#issuecomment-1935304859 - "--with-extra-cxxflags=-xc++" - ] - ++ lib.optional headless "--enable-headless-only" - ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}"; + configureFlags = + [ + "--with-boot-jdk=${openjdk-bootstrap.home}" + "--with-version-string=${version}" + "--with-vendor-version-string=(nix)" + "--enable-unlimited-crypto" + "--with-native-debug-symbols=internal" + "--with-libjpeg=system" + "--with-giflib=system" + "--with-libpng=system" + "--with-zlib=system" + "--with-lcms=system" + "--with-stdc++lib=dynamic" + ] + ++ lib.optionals stdenv.cc.isClang [ + "--with-toolchain-type=clang" + # Explicitly tell Clang to compile C++ files as C++, see + # https://github.com/NixOS/nixpkgs/issues/150655#issuecomment-1935304859 + "--with-extra-cxxflags=-xc++" + ] + ++ lib.optional headless "--enable-headless-only" + ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}"; separateDebugInfo = true; env.NIX_CFLAGS_COMPILE = "-Wno-error"; - NIX_LDFLAGS = toString (lib.optionals (!headless) [ - "-lfontconfig" - "-lcups" - "-lXinerama" - "-lXrandr" - "-lmagic" - ] ++ lib.optionals (!headless && enableGtk) [ - "-lgtk-3" - "-lgio-2.0" - ]); + NIX_LDFLAGS = toString ( + lib.optionals (!headless) [ + "-lfontconfig" + "-lcups" + "-lXinerama" + "-lXrandr" + "-lmagic" + ] + ++ lib.optionals (!headless && enableGtk) [ + "-lgtk-3" + "-lgio-2.0" + ] + ); # -j flag is explicitly rejected by the build system: # Error: 'make -jN' is not supported, use 'make JOBS=N'