mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-13 07:34:21 +00:00
openjdk: format generic.nix
with nixfmt-rfc-style
This commit is contained in:
parent
a25242518c
commit
77acd709f9
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user