openjdk: remove adoptopenjdk-bin, openjdk 12/13/14/15/16

AdoptOpenJDK is a long-deprecated project, having been superceded by
Eclipse Temurin quite a while ago. Additionally, after running the
generate sources command, many of its subpackages fail to evaluate due
to missing binaries for versions the package expects. Because everything
provided by AdoptOpenJDK is either long-deprecated or also provided by
Temurin, its removal should not cause many problems.

By the same token, OpenJDK 12, 13, 14, 15, and 16 have also all been long
deemed EOL, and 13/14 are both actively broken and fail to build. These
packages, and their associated (and unnecessary) bootstrap chain are a
major factor in the tech debt of OpenJDK as an ecosystem in Nixpkgs.

OpenJDK 16 was the only user of OpenJFX 15, so it has also been removed.

By removing these packages, OpenJDK should hopefully be more
maintainable into the future.
This commit is contained in:
Infinidoge 2024-05-09 20:47:39 -04:00
parent 0979f40aeb
commit 535dd96948
No known key found for this signature in database
28 changed files with 26 additions and 2777 deletions

View File

@ -1,68 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ requests ])"
import json
import re
import requests
import sys
# openjdk15 is only for bootstrapping openjdk
releases = ("openjdk8", "openjdk11", "openjdk13", "openjdk14", "openjdk15", "openjdk16", "openjdk17")
oses = ("mac", "linux", "alpine_linux")
types = ("jre", "jdk")
impls = ("hotspot", "openj9")
arch_to_nixos = {
"x64": ("x86_64",),
"aarch64": ("aarch64",),
"arm": ("armv6l", "armv7l"),
"ppc64le": ("powerpc64le",),
}
def get_sha256(url):
resp = requests.get(url)
if resp.status_code != 200:
print("error: could not fetch checksum from url {}: code {}".format(url, resp.status_code), file=sys.stderr)
sys.exit(1)
return resp.text.strip().split(" ")[0]
def generate_sources(release, assets):
out = {}
for asset in assets:
if asset["os"] not in oses: continue
if asset["binary_type"] not in types: continue
if asset["openjdk_impl"] not in impls: continue
if asset["heap_size"] != "normal": continue
if asset["architecture"] not in arch_to_nixos: continue
# examples: 11.0.1+13, 8.0.222+10
version, build = asset["version_data"]["semver"].split("+")
type_map = out.setdefault(asset["os"], {})
impl_map = type_map.setdefault(asset["binary_type"], {})
arch_map = impl_map.setdefault(asset["openjdk_impl"], {
"packageType": asset["binary_type"],
"vmType": asset["openjdk_impl"],
})
for nixos_arch in arch_to_nixos[asset["architecture"]]:
arch_map[nixos_arch] = {
"url": asset["binary_link"],
"sha256": get_sha256(asset["checksum_link"]),
"version": version,
"build": build,
}
return out
out = {}
for release in releases:
resp = requests.get("https://api.adoptopenjdk.net/v2/latestAssets/releases/" + release)
if resp.status_code != 200:
print("error: could not fetch data for release {} (code {})".format(release, resp.code), file=sys.stderr)
sys.exit(1)
out[release] = generate_sources(release, resp.json())
with open("sources.json", "w") as f:
json.dump(out, f, indent=2, sort_keys=True)
f.write('\n')

View File

@ -1,66 +0,0 @@
{ sourcePerArch, knownVulnerabilities ? [] }:
{ swingSupport ? true # not used for now
, lib, stdenv
, fetchurl
, setJavaClassPath
}:
assert (stdenv.isDarwin && stdenv.isx86_64);
let cpuName = stdenv.hostPlatform.parsed.cpu.name;
result = stdenv.mkDerivation {
pname = if sourcePerArch.packageType == "jdk"
then "adoptopenjdk-${sourcePerArch.vmType}-bin"
else "adoptopenjdk-${sourcePerArch.packageType}-${sourcePerArch.vmType}-bin";
version = sourcePerArch.${cpuName}.version or (throw "unsupported CPU ${cpuName}");
src = fetchurl {
inherit (sourcePerArch.${cpuName}) url sha256;
};
# See: https://github.com/NixOS/patchelf/issues/10
dontStrip = 1;
installPhase = ''
cd ..
mv $sourceRoot $out
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/Contents/Home/include/darwin/*_md.h $out/Contents/Home/include/
rm -rf $out/Home/demo
# Remove some broken manpages.
rm -rf $out/Home/man/ja*
ln -s $out/Contents/Home/* $out/
# Propagate the setJavaClassPath setup hook from the JDK so that
# any package that depends on the JDK has $CLASSPATH set up
# properly.
mkdir -p $out/nix-support
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';
# FIXME: use multiple outputs or return actual JRE package
passthru.jre = result;
passthru.home = result;
meta = with lib; {
license = licenses.gpl2Classpath;
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
platforms = [ "x86_64-darwin" ]; # some inherit jre.meta.platforms
maintainers = with lib.maintainers; [ taku0 ];
inherit knownVulnerabilities;
mainProgram = "java";
};
}; in result

View File

@ -1,123 +0,0 @@
{ sourcePerArch, knownVulnerabilities ? [] }:
{ stdenv
, lib
, fetchurl
, autoPatchelfHook
, makeWrapper
, setJavaClassPath
# minimum dependencies
, alsa-lib
, fontconfig
, freetype
, libffi
, xorg
, zlib
# runtime dependencies
, cups
# runtime dependencies for GTK+ Look and Feel
, gtkSupport ? true
, cairo
, glib
, gtk3
}:
let
cpuName = stdenv.hostPlatform.parsed.cpu.name;
runtimeDependencies = [
cups
] ++ lib.optionals gtkSupport [
cairo glib gtk3
];
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
in
let result = stdenv.mkDerivation rec {
pname = if sourcePerArch.packageType == "jdk"
then "adoptopenjdk-${sourcePerArch.vmType}-bin"
else "adoptopenjdk-${sourcePerArch.packageType}-${sourcePerArch.vmType}-bin";
version = sourcePerArch.${cpuName}.version or (throw "unsupported CPU ${cpuName}");
src = fetchurl {
inherit (sourcePerArch.${cpuName}) url sha256;
};
buildInputs = [
alsa-lib # libasound.so wanted by lib/libjsound.so
fontconfig
freetype
stdenv.cc.cc.lib # libstdc++.so.6
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXrender
xorg.libXtst
zlib
] ++ lib.optional stdenv.isAarch32 libffi;
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
# See: https://github.com/NixOS/patchelf/issues/10
dontStrip = 1;
installPhase = ''
cd ..
mv $sourceRoot $out
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
rm -rf $out/demo
# Remove some broken manpages.
rm -rf $out/man/ja*
# Remove embedded freetype to avoid problems like
# https://github.com/NixOS/nixpkgs/issues/57733
find "$out" -name 'libfreetype.so*' -delete
# Propagate the setJavaClassPath setup hook from the JDK so that
# any package that depends on the JDK has $CLASSPATH set up
# properly.
mkdir -p $out/nix-support
printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
cat <<EOF >> "$out/nix-support/setup-hook"
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
# We cannot use -exec since wrapProgram is a function but not a command.
#
# jspawnhelper is executed from JVM, so it doesn't need to wrap it, and it
# breaks building OpenJDK (#114495).
for bin in $( find "$out" -executable -type f -not -name jspawnhelper ); do
if patchelf --print-interpreter "$bin" &> /dev/null; then
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
fi
done
'';
preFixup = ''
find "$out" -name libfontmanager.so -exec \
patchelf --add-needed libfontconfig.so {} \;
'';
# FIXME: use multiple outputs or return actual JRE package
passthru.jre = result;
passthru.home = result;
meta = with lib; {
license = licenses.gpl2Classpath;
sourceProvenance = with sourceTypes; [ binaryNativeCode binaryBytecode ];
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
platforms = lib.mapAttrsToList (arch: _: arch + "-linux") sourcePerArch; # some inherit jre.meta.platforms
maintainers = with lib.maintainers; [ taku0 ];
inherit knownVulnerabilities;
mainProgram = "java";
};
}; in result

View File

@ -1,11 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk11.mac.jdk.hotspot; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk11.mac.jre.hotspot; };
jdk-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk11.mac.jdk.openj9; };
jre-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk11.mac.jre.openj9; };
}

View File

@ -1,12 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk11.${variant}.jdk.hotspot; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk11.${variant}.jre.hotspot; };
jdk-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk11.${variant}.jdk.openj9; };
jre-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk11.${variant}.jre.openj9; };
}

View File

@ -1,11 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk13.mac.jdk.hotspot; knownVulnerabilities = ["Support ended"]; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk13.mac.jre.hotspot; knownVulnerabilities = ["Support ended"]; };
jdk-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk13.mac.jdk.openj9; knownVulnerabilities = ["Support ended"]; };
jre-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk13.mac.jre.openj9; knownVulnerabilities = ["Support ended"]; };
}

View File

@ -1,12 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk13.${variant}.jdk.hotspot; knownVulnerabilities = ["Support ended"]; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk13.${variant}.jre.hotspot; knownVulnerabilities = ["Support ended"]; };
jdk-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk13.${variant}.jdk.openj9; knownVulnerabilities = ["Support ended"]; };
jre-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk13.${variant}.jre.openj9; knownVulnerabilities = ["Support ended"]; };
}

View File

@ -1,11 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk14.mac.jdk.hotspot; knownVulnerabilities = ["Support ended"]; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk14.mac.jre.hotspot; knownVulnerabilities = ["Support ended"]; };
jdk-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk14.mac.jdk.openj9; knownVulnerabilities = ["Support ended"]; };
jre-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk14.mac.jre.openj9; knownVulnerabilities = ["Support ended"]; };
}

View File

@ -1,12 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk14.${variant}.jdk.hotspot; knownVulnerabilities = ["Support ended"]; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk14.${variant}.jre.hotspot; knownVulnerabilities = ["Support ended"]; };
jdk-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk14.${variant}.jdk.openj9; knownVulnerabilities = ["Support ended"]; };
jre-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk14.${variant}.jre.openj9; knownVulnerabilities = ["Support ended"]; };
}

View File

@ -1,11 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk15.mac.jdk.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk15.mac.jre.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jdk-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk15.mac.jdk.openj9; knownVulnerabilities = [ "Support ended" ]; };
jre-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk15.mac.jre.openj9; knownVulnerabilities = [ "Support ended" ]; };
}

View File

@ -1,12 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk15.${variant}.jdk.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk15.${variant}.jre.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jdk-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk15.${variant}.jdk.openj9; knownVulnerabilities = [ "Support ended" ]; };
jre-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk15.${variant}.jre.openj9; knownVulnerabilities = [ "Support ended" ]; };
}

View File

@ -1,11 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk16.mac.jdk.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk16.mac.jre.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jdk-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk16.mac.jdk.openj9; knownVulnerabilities = [ "Support ended" ]; };
jre-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk16.mac.jre.openj9; knownVulnerabilities = [ "Support ended" ]; };
}

View File

@ -1,12 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk16.${variant}.jdk.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk16.${variant}.jre.hotspot; knownVulnerabilities = [ "Support ended" ]; };
jdk-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk16.${variant}.jdk.openj9; knownVulnerabilities = [ "Support ended" ]; };
jre-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk16.${variant}.jre.openj9; knownVulnerabilities = [ "Support ended" ]; };
}

View File

@ -1,9 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk17.mac.jdk.hotspot; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk17.mac.jre.hotspot; };
}

View File

@ -1,10 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk17.${variant}.jdk.hotspot; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk17.${variant}.jre.hotspot; };
}

View File

@ -1,11 +0,0 @@
{ lib }:
let
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk8.mac.jdk.hotspot; };
jre-hotspot = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk8.mac.jre.hotspot; };
jdk-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk8.mac.jdk.openj9; };
jre-openj9 = import ./jdk-darwin-base.nix { sourcePerArch = sources.openjdk8.mac.jre.openj9; };
}

View File

@ -1,12 +0,0 @@
{ stdenv, lib }:
let
variant = if stdenv.hostPlatform.isMusl then "alpine_linux" else "linux";
sources = import ./sources.nix;
in
{
jdk-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk8.${variant}.jdk.hotspot; };
jre-hotspot = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk8.${variant}.jre.hotspot; };
jdk-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk8.${variant}.jdk.openj9; };
jre-openj9 = import ./jdk-linux-base.nix { sourcePerArch = sources.openjdk8.${variant}.jre.openj9; };
}

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
builtins.fromJSON (builtins.readFile ./sources.json)

View File

@ -1,172 +0,0 @@
{ stdenv, lib, fetchurl, bash, 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, openjdk11-bootstrap, fetchpatch
, setJavaClassPath
, headless ? false
, enableJavaFX ? false, openjfx
, enableGtk ? true, gtk3, glib
}:
let
major = "12";
update = ".0.2";
build = "ga";
# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk11-bootstrap.override { gtkSupport = !headless; };
openjdk = stdenv.mkDerivation rec {
pname = "openjdk" + lib.optionalString headless "-headless";
version = "${major}${update}-${build}";
src = fetchurl {
url = "http://hg.openjdk.java.net/jdk-updates/jdk${major}u/archive/jdk-${version}.tar.gz";
sha256 = "1ndlxmikyy298z7lqpr1bd0zxq7yx6xidj8y3c8mw9m9fy64h9c7";
};
nativeBuildInputs = [ pkg-config autoconf unzip ];
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-jdk10.patch
./read-truststore-from-env-jdk10.patch
./currency-date-range-jdk10.patch
./increase-javadoc-heap.patch
# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
# so grab the work-around from
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
(fetchurl {
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
})
# Fix gnumake 4.3 incompatibility
(fetchpatch {
url = "https://github.com/openjdk/panama-foreign/commit/af5c725b8109ce83fc04ef0f8bf6aaf0b50c0441.patch";
sha256 = "0ja84kih5wkjn58pml53s59qnavb1z92dc88cbgw7vcyqwc1gs0h";
})
] ++ lib.optionals (!headless && enableGtk) [
./swing-use-gtk-jdk10.patch
];
prePatch = ''
chmod +x configure
patchShebangs --build configure
'';
configureFlags = [
"--with-boot-jdk=${openjdk-bootstrap.home}"
"--with-version-pre="
"--enable-unlimited-crypto"
"--with-native-debug-symbols=internal"
"--with-freetype=system"
"--with-libjpeg=system"
"--with-giflib=system"
"--with-libpng=system"
"--with-zlib=system"
"--with-lcms=system"
"--with-stdc++lib=dynamic"
] ++ lib.optional stdenv.isx86_64 "--with-jvm-features=zgc"
++ lib.optional headless "--enable-headless-only"
++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}";
separateDebugInfo = true;
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error" ];
NIX_LDFLAGS = 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'
# Note: it does not make build sequential. Build system
# still runs in parallel.
enableParallelBuilding = false;
buildFlags = [ "all" ];
postBuild = ''
cd build/linux*
make images
cd -
'';
installPhase = ''
mkdir -p $out/lib
mv build/*/images/jdk $out/lib/openjdk
# Remove some broken manpages.
rm -rf $out/lib/openjdk/man/ja*
# Mirror some stuff in top-level.
mkdir -p $out/share
ln -s $out/lib/openjdk/include $out/include
ln -s $out/lib/openjdk/man $out/share/man
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
# Remove crap from the installation.
rm -rf $out/lib/openjdk/demo
${lib.optionalString headless ''
rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
''}
ln -s $out/lib/openjdk/bin $out/bin
'';
preFixup = ''
# Propagate the setJavaClassPath setup hook so that any package
# that depends on the JDK has $CLASSPATH set up properly.
mkdir -p $out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';
postFixup = ''
# Build the set of output library directories to rpath against
LIBDIRS=""
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
done
# Add the local library paths to remove dependencies on the bootstrap
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
OUTPUTDIR=$(eval echo \$$output)
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
echo "$BINLIBS" | while read i; do
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
patchelf --shrink-rpath "$i" || true
done
done
'';
disallowedReferences = [ openjdk-bootstrap ];
meta = import ./meta.nix lib version;
passthru = {
architecture = "";
home = "${openjdk}/lib/openjdk";
inherit gtk3;
};
};
in openjdk

View File

@ -1,177 +0,0 @@
{ stdenv, lib, fetchurl, bash, 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, openjdk13-bootstrap, fetchpatch
, setJavaClassPath
, headless ? false
, enableJavaFX ? false, openjfx
, enableGtk ? true, gtk3, glib
}:
let
major = "13";
update = ".0.2";
build = "-ga";
# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk13-bootstrap.override { gtkSupport = !headless; };
openjdk = stdenv.mkDerivation rec {
pname = "openjdk" + lib.optionalString headless "-headless";
version = "${major}${update}${build}";
src = fetchurl {
url = "http://hg.openjdk.java.net/jdk-updates/jdk${major}u/archive/jdk-${version}.tar.gz";
sha256 = "1871ziss7ny19rw8f7bay5vznmhpqbfi4ihn3yygs06wyxhm0zmv";
};
nativeBuildInputs = [ pkg-config autoconf unzip ];
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-jdk10.patch
./read-truststore-from-env-jdk10.patch
./currency-date-range-jdk10.patch
./increase-javadoc-heap-jdk13.patch
# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
# so grab the work-around from
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
(fetchurl {
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
})
# Fix gnumake 4.3 incompatibility
(fetchpatch {
url = "https://github.com/openjdk/panama-foreign/commit/af5c725b8109ce83fc04ef0f8bf6aaf0b50c0441.patch";
sha256 = "0ja84kih5wkjn58pml53s59qnavb1z92dc88cbgw7vcyqwc1gs0h";
})
] ++ lib.optionals (!headless && enableGtk) [
./swing-use-gtk-jdk13.patch
];
prePatch = ''
chmod +x configure
patchShebangs --build configure
'';
# 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"];
configureFlags = [
"--with-boot-jdk=${openjdk-bootstrap.home}"
"--with-version-pre="
"--enable-unlimited-crypto"
"--with-native-debug-symbols=internal"
"--with-freetype=system"
"--with-libjpeg=system"
"--with-giflib=system"
"--with-libpng=system"
"--with-zlib=system"
"--with-lcms=system"
"--with-stdc++lib=dynamic"
] ++ lib.optional stdenv.isx86_64 "--with-jvm-features=zgc"
++ 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"
]);
# -j flag is explicitly rejected by the build system:
# Error: 'make -jN' is not supported, use 'make JOBS=N'
# Note: it does not make build sequential. Build system
# still runs in parallel.
enableParallelBuilding = false;
buildFlags = [ "all" ];
postBuild = ''
cd build/linux*
make images
cd -
'';
installPhase = ''
mkdir -p $out/lib
mv build/*/images/jdk $out/lib/openjdk
# Remove some broken manpages.
rm -rf $out/lib/openjdk/man/ja*
# Mirror some stuff in top-level.
mkdir -p $out/share
ln -s $out/lib/openjdk/include $out/include
ln -s $out/lib/openjdk/man $out/share/man
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
# Remove crap from the installation.
rm -rf $out/lib/openjdk/demo
${lib.optionalString headless ''
rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
''}
ln -s $out/lib/openjdk/bin $out/bin
'';
preFixup = ''
# Propagate the setJavaClassPath setup hook so that any package
# that depends on the JDK has $CLASSPATH set up properly.
mkdir -p $out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';
postFixup = ''
# Build the set of output library directories to rpath against
LIBDIRS=""
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
done
# Add the local library paths to remove dependencies on the bootstrap
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
OUTPUTDIR=$(eval echo \$$output)
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
echo "$BINLIBS" | while read i; do
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
patchelf --shrink-rpath "$i" || true
done
done
'';
disallowedReferences = [ openjdk-bootstrap ];
meta = (import ./meta.nix lib version) // { broken = true; };
passthru = {
architecture = "";
home = "${openjdk}/lib/openjdk";
inherit gtk3;
};
};
in openjdk

View File

@ -1,173 +0,0 @@
{ stdenv, lib, fetchurl, bash, 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, openjdk14-bootstrap
, setJavaClassPath
, headless ? false
, enableJavaFX ? false, openjfx
, enableGtk ? true, gtk3, glib
}:
let
major = "14";
update = ".0.2";
build = "-ga";
# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk14-bootstrap.override { gtkSupport = !headless; };
openjdk = stdenv.mkDerivation rec {
pname = "openjdk" + lib.optionalString headless "-headless";
version = "${major}${update}${build}";
src = fetchurl {
url = "https://hg.openjdk.java.net/jdk-updates/jdk${major}u/archive/jdk-${version}.tar.gz";
sha256 = "1s1pc6ihzf0awp4hbaqfxmbica0hnrg8nr7s0yd2hfn7nan8xmf3";
};
nativeBuildInputs = [ pkg-config autoconf unzip ];
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-jdk10.patch
./read-truststore-from-env-jdk10.patch
./currency-date-range-jdk10.patch
./increase-javadoc-heap-jdk13.patch
# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
# so grab the work-around from
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
(fetchurl {
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
})
] ++ lib.optionals (!headless && enableGtk) [
./swing-use-gtk-jdk13.patch
];
prePatch = ''
chmod +x configure
patchShebangs --build configure
'';
# 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"];
configureFlags = [
"--with-boot-jdk=${openjdk-bootstrap.home}"
"--with-version-pre="
"--enable-unlimited-crypto"
"--with-native-debug-symbols=internal"
"--with-freetype=system"
"--with-libjpeg=system"
"--with-giflib=system"
"--with-libpng=system"
"--with-zlib=system"
"--with-lcms=system"
"--with-stdc++lib=dynamic"
] ++ lib.optional stdenv.isx86_64 "--with-jvm-features=zgc"
++ 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"
]);
# -j flag is explicitly rejected by the build system:
# Error: 'make -jN' is not supported, use 'make JOBS=N'
# Note: it does not make build sequential. Build system
# still runs in parallel.
enableParallelBuilding = false;
buildFlags = [ "all" ];
postBuild = ''
cd build/linux*
make images
cd -
'';
installPhase = ''
mkdir -p $out/lib
mv build/*/images/jdk $out/lib/openjdk
# Remove some broken manpages.
rm -rf $out/lib/openjdk/man/ja*
# Mirror some stuff in top-level.
mkdir -p $out/share
ln -s $out/lib/openjdk/include $out/include
ln -s $out/lib/openjdk/man $out/share/man
ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
# Remove crap from the installation.
rm -rf $out/lib/openjdk/demo
${lib.optionalString headless ''
rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
''}
ln -s $out/lib/openjdk/bin $out/bin
'';
preFixup = ''
# Propagate the setJavaClassPath setup hook so that any package
# that depends on the JDK has $CLASSPATH set up properly.
mkdir -p $out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';
postFixup = ''
# Build the set of output library directories to rpath against
LIBDIRS=""
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
done
# Add the local library paths to remove dependencies on the bootstrap
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
OUTPUTDIR=$(eval echo \$$output)
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
echo "$BINLIBS" | while read i; do
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
patchelf --shrink-rpath "$i" || true
done
done
'';
disallowedReferences = [ openjdk-bootstrap ];
meta = (import ./meta.nix lib version) // { broken = true; };
passthru = {
architecture = "";
home = "${openjdk}/lib/openjdk";
inherit gtk3;
};
};
in openjdk

View File

@ -1,176 +0,0 @@
{ stdenv, lib, fetchurl, bash, 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, openjdk15-bootstrap
, setJavaClassPath
, headless ? false
, enableJavaFX ? false, openjfx
, enableGtk ? true, gtk3, glib
}:
let
version = {
major = "15";
update = ".0.1";
build = "-ga";
__toString = self: "${self.major}${self.update}${self.build}";
};
# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk15-bootstrap.override { gtkSupport = !headless; };
openjdk = stdenv.mkDerivation {
pname = "openjdk" + lib.optionalString headless "-headless";
inherit version;
src = fetchurl {
url = "https://hg.openjdk.java.net/jdk-updates/jdk${version.major}u/archive/jdk-${version}.tar.gz";
sha256 = "1h8n5figc9q0k9p8b0qggyhvqagvxanfih1lj5j492c74cd1mx1l";
};
nativeBuildInputs = [ pkg-config autoconf unzip zip file which ];
buildInputs = [
cpio 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-jdk10.patch
./read-truststore-from-env-jdk10.patch
./currency-date-range-jdk10.patch
./increase-javadoc-heap-jdk13.patch
# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
# so grab the work-around from
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
(fetchurl {
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
})
] ++ lib.optionals (!headless && enableGtk) [
./swing-use-gtk-jdk13.patch
];
prePatch = ''
chmod +x configure
patchShebangs --build configure
'';
# 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"];
configureFlags = [
"--with-boot-jdk=${openjdk-bootstrap.home}"
"--with-version-pre="
"--enable-unlimited-crypto"
"--with-native-debug-symbols=internal"
"--with-freetype=system"
"--with-libjpeg=system"
"--with-giflib=system"
"--with-libpng=system"
"--with-zlib=system"
"--with-lcms=system"
"--with-stdc++lib=dynamic"
] ++ 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"
]);
# -j flag is explicitly rejected by the build system:
# Error: 'make -jN' is not supported, use 'make JOBS=N'
# Note: it does not make build sequential. Build system
# still runs in parallel.
enableParallelBuilding = false;
buildFlags = [ "all" ];
postBuild = ''
cd build/linux*
make images
cd -
'';
installPhase = ''
mkdir -p $out/lib
mv build/*/images/jdk $out/lib/openjdk
# Remove some broken manpages.
rm -rf $out/lib/openjdk/man/ja*
# Mirror some stuff in top-level.
mkdir -p $out/share
ln -s $out/lib/openjdk/include $out/include
ln -s $out/lib/openjdk/man $out/share/man
ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
# Remove crap from the installation.
rm -rf $out/lib/openjdk/demo
${lib.optionalString headless ''
rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
''}
ln -s $out/lib/openjdk/bin $out/bin
'';
preFixup = ''
# Propagate the setJavaClassPath setup hook so that any package
# that depends on the JDK has $CLASSPATH set up properly.
mkdir -p $out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';
postFixup = ''
# Build the set of output library directories to rpath against
LIBDIRS=""
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
done
# Add the local library paths to remove dependencies on the bootstrap
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
OUTPUTDIR=$(eval echo \$$output)
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
echo "$BINLIBS" | while read i; do
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
patchelf --shrink-rpath "$i" || true
done
done
'';
disallowedReferences = [ openjdk-bootstrap ];
pos = builtins.unsafeGetAttrPos "major" version;
meta = import ./meta.nix lib version.major;
passthru = {
architecture = "";
home = "${openjdk}/lib/openjdk";
inherit gtk3;
};
};
in openjdk

View File

@ -1,181 +0,0 @@
{ stdenv, lib, fetchurl, fetchFromGitHub, bash, 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, openjdk16-bootstrap
, setJavaClassPath
, headless ? false
, enableJavaFX ? false, openjfx
, enableGtk ? true, gtk3, glib
}:
let
version = {
feature = "16";
interim = ".0.2-ga";
build = "1";
};
# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk16-bootstrap.override { gtkSupport = !headless; };
openjdk = stdenv.mkDerivation {
pname = "openjdk" + lib.optionalString headless "-headless";
version = "${version.feature}${version.interim}+${version.build}";
src = fetchFromGitHub {
owner = "openjdk";
repo = "jdk${version.feature}u";
rev = "jdk-${version.feature}${version.interim}";
# rev = "jdk-${version.feature}${version.interim}+${version.build}";
sha256 = "sha256-/8XHNrf9joCCXMCyPncT54JhqlF+KBL7eAf8hUW/BxU=";
};
nativeBuildInputs = [ pkg-config autoconf unzip ];
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-jdk10.patch
./read-truststore-from-env-jdk10.patch
./currency-date-range-jdk10.patch
./increase-javadoc-heap-jdk13.patch
# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
# so grab the work-around from
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
(fetchurl {
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
})
./fix-glibc-2.34.patch
] ++ lib.optionals (!headless && enableGtk) [
./swing-use-gtk-jdk13.patch
];
prePatch = ''
chmod +x configure
patchShebangs --build configure
'';
# 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"];
configureFlags = [
"--with-boot-jdk=${openjdk-bootstrap.home}"
"--with-version-build=${version.build}"
"--with-version-opt=nixos"
"--with-version-pre="
"--enable-unlimited-crypto"
"--with-native-debug-symbols=internal"
"--with-freetype=system"
"--with-libjpeg=system"
"--with-giflib=system"
"--with-libpng=system"
"--with-zlib=system"
"--with-lcms=system"
"--with-stdc++lib=dynamic"
] ++ 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"
]);
# -j flag is explicitly rejected by the build system:
# Error: 'make -jN' is not supported, use 'make JOBS=N'
# Note: it does not make build sequential. Build system
# still runs in parallel.
enableParallelBuilding = false;
buildFlags = [ "all" ];
postBuild = ''
cd build/linux*
make images
cd -
'';
installPhase = ''
mkdir -p $out/lib
mv build/*/images/jdk $out/lib/openjdk
# Remove some broken manpages.
rm -rf $out/lib/openjdk/man/ja*
# Mirror some stuff in top-level.
mkdir -p $out/share
ln -s $out/lib/openjdk/include $out/include
ln -s $out/lib/openjdk/man $out/share/man
ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip
# jni.h expects jni_md.h to be in the header search path.
ln -s $out/include/linux/*_md.h $out/include/
# Remove crap from the installation.
rm -rf $out/lib/openjdk/demo
${lib.optionalString headless ''
rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
''}
ln -s $out/lib/openjdk/bin $out/bin
'';
preFixup = ''
# Propagate the setJavaClassPath setup hook so that any package
# that depends on the JDK has $CLASSPATH set up properly.
mkdir -p $out/nix-support
#TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';
postFixup = ''
# Build the set of output library directories to rpath against
LIBDIRS=""
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
done
# Add the local library paths to remove dependencies on the bootstrap
for output in $(getAllOutputNames); do
if [ "$output" = debug ]; then continue; fi
OUTPUTDIR=$(eval echo \$$output)
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
echo "$BINLIBS" | while read i; do
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
patchelf --shrink-rpath "$i" || true
done
done
'';
disallowedReferences = [ openjdk-bootstrap ];
pos = builtins.unsafeGetAttrPos "feature" version;
meta = import ./meta.nix lib version.feature;
passthru = {
architecture = "";
home = "${openjdk}/lib/openjdk";
inherit gtk3;
};
};
in openjdk

View File

@ -1,129 +0,0 @@
{ stdenv, lib, fetchFromGitHub, writeText, openjdk11_headless, gradle_6
, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib
, ffmpeg_4-headless, python3, ruby
, withMedia ? true
, withWebKit ? false
}:
let
major = "15";
update = ".0.1";
build = "+1";
repover = "${major}${update}${build}";
gradle_ = (gradle_6.override {
java = openjdk11_headless;
});
makePackage = args: stdenv.mkDerivation ({
version = "${major}${update}${build}";
src = fetchFromGitHub {
owner = "openjdk";
repo = "jfx";
rev = repover;
sha256 = "019glq8rhn6amy3n5jc17vi2wpf1pxpmmywvyz1ga8n09w7xscq1";
};
buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4-headless ];
nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python3 ruby ];
dontUseCmakeConfigure = true;
config = writeText "gradle.properties" (''
CONF = Release
JDK_HOME = ${openjdk11_headless.home}
'' + args.gradleProperties or "");
env.NIX_CFLAGS_COMPILE = toString [
#avoids errors about deprecation of GTypeDebugFlags, GTimeVal, etc.
"-DGLIB_DISABLE_DEPRECATION_WARNINGS"
# gstreamer workaround for -fno-common toolchains:
# ld: gsttypefindelement.o:(.bss._gst_disable_registry_cache+0x0): multiple definition of
# `_gst_disable_registry_cache'; gst.o:(.bss._gst_disable_registry_cache+0x0): first defined here
"-fcommon"
];
buildPhase = ''
runHook preBuild
export NUMBER_OF_PROCESSORS=$NIX_BUILD_CORES
export GRADLE_USER_HOME=$(mktemp -d)
ln -s $config gradle.properties
export NIX_CFLAGS_COMPILE="$(pkg-config --cflags glib-2.0) $NIX_CFLAGS_COMPILE"
gradle --no-daemon $gradleFlags sdk
runHook postBuild
'';
} // args);
# Fake build to pre-download deps into fixed-output derivation.
# We run nearly full build because I see no other way to download everything that's needed.
# Anyone who knows a better way?
deps = makePackage {
pname = "openjfx-deps";
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
installPhase = ''
find $GRADLE_USER_HOME -type f -regex '.*/modules.*\.\(jar\|pom\)' \
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
| sh
rm -rf $out/tmp
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-fGLTMM9s/Vn7eMzn6OQR3tL0cGbAYc7c4J4/aW3JvkI=";
};
in makePackage {
pname = "openjfx-modular-sdk";
gradleProperties = ''
COMPILE_MEDIA = ${lib.boolToString withMedia}
COMPILE_WEBKIT = ${lib.boolToString withWebKit}
'';
preBuild = ''
swtJar="$(find ${deps} -name org.eclipse.swt\*.jar)"
substituteInPlace build.gradle \
--replace 'mavenCentral()' 'mavenLocal(); maven { url uri("${deps}") }' \
--replace 'name: SWT_FILE_NAME' "files('$swtJar')"
'';
installPhase = ''
cp -r build/modular-sdk $out
'';
# glib-2.62 deprecations
# -fcommon: gstreamer workaround for -fno-common toolchains:
# ld: gsttypefindelement.o:(.bss._gst_disable_registry_cache+0x0): multiple definition of
# `_gst_disable_registry_cache'; gst.o:(.bss._gst_disable_registry_cache+0x0): first defined here
env.NIX_CFLAGS_COMPILE = "-DGLIB_DISABLE_DEPRECATION_WARNINGS -fcommon";
stripDebugList = [ "." ];
postFixup = ''
# Remove references to bootstrap.
export openjdkOutPath='${openjdk11_headless.outPath}'
find "$out" -name \*.so | while read lib; do
new_refs="$(patchelf --print-rpath "$lib" | perl -pe 's,:?\Q$ENV{openjdkOutPath}\E[^:]*,,')"
patchelf --set-rpath "$new_refs" "$lib"
done
'';
disallowedReferences = [ openjdk11_headless ];
passthru.deps = deps;
meta = with lib; {
homepage = "http://openjdk.java.net/projects/openjfx/";
license = licenses.gpl2;
description = "Next-generation Java client toolkit";
maintainers = with maintainers; [ abbradar ];
knownVulnerabilities = [
"This OpenJFX version has reached its end of life."
];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -68,6 +68,26 @@ mapAliases ({
acousticbrainz-client = throw "acousticbrainz-client has been removed since the AcousticBrainz project has been shut down"; # Added 2024-06-04
adtool = throw "'adtool' has been removed, as it was broken and unmaintained";
adom = throw "'adom' has been removed, as it was broken and unmaintained"; # added 2024-05-09
adoptopenjdk-bin = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-bin`"; # Added 2024-05-09
adoptopenjdk-bin-17-packages-darwin = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-bin-17`."; # Added 2024-05-09
adoptopenjdk-bin-17-packages-linux = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-bin-17`."; # Added 2024-05-09
adoptopenjdk-hotspot-bin-11 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-bin-11`."; # Added 2024-05-09
adoptopenjdk-hotspot-bin-15 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 15 is also EOL. Consider using `temurin-bin-17`."; # Added 2024-05-09
adoptopenjdk-hotspot-bin-16 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 16 is also EOL. Consider using `temurin-bin-17` or `temurin-bin-16`."; # Added 2024-05-09
adoptopenjdk-hotspot-bin-8 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-bin-8`."; # Added 2024-05-09
adoptopenjdk-jre-bin = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-jre-bin`."; # Added 2024-05-09
adoptopenjdk-jre-hotspot-bin-11 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-jre-bin-11`."; # Added 2024-05-09
adoptopenjdk-jre-hotspot-bin-15 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 15 is also EOL. Consider using `temurin-jre-bin-17`."; # Added 2024-05-09
adoptopenjdk-jre-hotspot-bin-16 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 16 is also EOL. Consider using `temurin-jre-bin-17` or `temurin-jre-bin-16`."; # Added 2024-05-09
adoptopenjdk-jre-hotspot-bin-8 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `temurin-jre-bin-8`."; # Added 2024-05-09
adoptopenjdk-jre-openj9-bin-11 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `semeru-jre-bin-11`."; # Added 2024-05-09
adoptopenjdk-jre-openj9-bin-15 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 15 is also EOL. Consider using `semeru-jre-bin-17`."; # Added 2024-05-09
adoptopenjdk-jre-openj9-bin-16 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 16 is also EOL. Consider using `semeru-jre-bin-17` or `semeru-jre-bin-16`."; # Added 2024-05-09
adoptopenjdk-jre-openj9-bin-8 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `semeru-jre-bin-8`."; # Added 2024-05-09
adoptopenjdk-openj9-bin-11 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `semeru-bin-11`."; # Added 2024-05-09
adoptopenjdk-openj9-bin-15 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 15 is also EOL. Consider using `semeru-bin-17`."; # Added 2024-05-09
adoptopenjdk-openj9-bin-16 = throw "adoptopenjdk has been removed as the upstream project is deprecated. JDK 16 is also EOL. Consider using `semeru-bin-17` or `semeru-bin-16`"; # Added 2024-05-09
adoptopenjdk-openj9-bin-8 = throw "adoptopenjdk has been removed as the upstream project is deprecated. Consider using `semeru-bin-8`."; # Added 2024-05-09
advcpmv = throw "'advcpmv' has been removed, as it is not being actively maintained and break recent coreutils."; # Added 2024-03-29
# Post 24.11 branch-off, this should throw an error
addOpenGLRunpath = addDriverRunpath; # Added 2024-05-25

View File

@ -14947,32 +14947,6 @@ with pkgs;
semeru-bin = semeru-bin-21;
semeru-jre-bin = semeru-jre-bin-21;
adoptopenjdk-bin-17-packages-linux = import ../development/compilers/adoptopenjdk-bin/jdk17-linux.nix { inherit stdenv lib; };
adoptopenjdk-bin-17-packages-darwin = import ../development/compilers/adoptopenjdk-bin/jdk17-darwin.nix { inherit lib; };
adoptopenjdk-hotspot-bin-16 = javaPackages.compiler.adoptopenjdk-16.jdk-hotspot;
adoptopenjdk-jre-hotspot-bin-16 = javaPackages.compiler.adoptopenjdk-16.jre-hotspot;
adoptopenjdk-openj9-bin-16 = javaPackages.compiler.adoptopenjdk-16.jdk-openj9;
adoptopenjdk-jre-openj9-bin-16 = javaPackages.compiler.adoptopenjdk-16.jre-openj9;
adoptopenjdk-hotspot-bin-15 = javaPackages.compiler.adoptopenjdk-15.jdk-hotspot;
adoptopenjdk-jre-hotspot-bin-15 = javaPackages.compiler.adoptopenjdk-15.jre-hotspot;
adoptopenjdk-openj9-bin-15 = javaPackages.compiler.adoptopenjdk-15.jdk-openj9;
adoptopenjdk-jre-openj9-bin-15 = javaPackages.compiler.adoptopenjdk-15.jre-openj9;
adoptopenjdk-hotspot-bin-11 = javaPackages.compiler.adoptopenjdk-11.jdk-hotspot;
adoptopenjdk-jre-hotspot-bin-11 = javaPackages.compiler.adoptopenjdk-11.jre-hotspot;
adoptopenjdk-openj9-bin-11 = javaPackages.compiler.adoptopenjdk-11.jdk-openj9;
adoptopenjdk-jre-openj9-bin-11 = javaPackages.compiler.adoptopenjdk-11.jre-openj9;
adoptopenjdk-hotspot-bin-8 = javaPackages.compiler.adoptopenjdk-8.jdk-hotspot;
adoptopenjdk-jre-hotspot-bin-8 = javaPackages.compiler.adoptopenjdk-8.jre-hotspot;
adoptopenjdk-openj9-bin-8 = javaPackages.compiler.adoptopenjdk-8.jdk-openj9;
adoptopenjdk-jre-openj9-bin-8 = javaPackages.compiler.adoptopenjdk-8.jre-openj9;
adoptopenjdk-bin = adoptopenjdk-hotspot-bin-11;
adoptopenjdk-jre-bin = adoptopenjdk-jre-hotspot-bin-11;
adoptopenjdk-icedtea-web = callPackage ../development/compilers/adoptopenjdk-icedtea-web {
jdk = jdk8;
};
@ -15887,7 +15861,7 @@ with pkgs;
hugs = callPackage ../development/interpreters/hugs { };
inherit (javaPackages) openjfx11 openjfx15 openjfx17 openjfx19 openjfx20 openjfx21 openjfx22;
inherit (javaPackages) openjfx11 openjfx17 openjfx19 openjfx20 openjfx21 openjfx22;
openjfx = openjfx17;
openjdk8-bootstrap = javaPackages.compiler.openjdk8-bootstrap;

View File

@ -4,7 +4,6 @@ with pkgs;
let
openjfx11 = callPackage ../development/compilers/openjdk/openjfx/11.nix { };
openjfx15 = callPackage ../development/compilers/openjdk/openjfx/15.nix { };
openjfx17 = callPackage ../development/compilers/openjdk/openjfx/17.nix { };
openjfx19 = callPackage ../development/compilers/openjdk/openjfx/19.nix { };
openjfx20 = callPackage ../development/compilers/openjdk/openjfx/20.nix { };
@ -12,44 +11,9 @@ let
openjfx22 = callPackage ../development/compilers/openjdk/openjfx/22.nix { };
in {
inherit openjfx11 openjfx15 openjfx17 openjfx19 openjfx20 openjfx21 openjfx22;
inherit openjfx11 openjfx17 openjfx19 openjfx20 openjfx21 openjfx22;
compiler = let
bootstrapArgs = {
openjfx = openjfx11; /* need this despite next line :-( */
enableJavaFX = false;
headless = true;
};
mkAdoptopenjdk = path-linux: path-darwin: let
package-linux = import path-linux { inherit stdenv lib; };
package-darwin = import path-darwin { inherit lib; };
package = if stdenv.isLinux
then package-linux
else package-darwin;
in {
inherit package-linux package-darwin;
__attrsFailEvaluation = true;
jdk-hotspot = callPackage package.jdk-hotspot {};
jre-hotspot = callPackage package.jre-hotspot {};
} // lib.optionalAttrs (package?jdk-openj9) {
jdk-openj9 = callPackage package.jdk-openj9 {};
} // lib.optionalAttrs (package?jre-openj9) {
jre-openj9 = callPackage package.jre-openj9 {};
};
mkBootstrap = adoptopenjdk: path: args:
/* adoptopenjdk not available for i686, so fall back to our old builds for bootstrapping */
if !stdenv.hostPlatform.isi686
then
# only linux has the gtkSupport option
if stdenv.isLinux
then adoptopenjdk.jdk-hotspot.override { gtkSupport = false; }
else adoptopenjdk.jdk-hotspot
else callPackage path args;
mkOpenjdk = path-linux: path-darwin: args:
if stdenv.isLinux
then mkOpenjdkLinuxOnly path-linux args
@ -64,84 +28,16 @@ in {
};
in rec {
adoptopenjdk-8 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk8-linux.nix
../development/compilers/adoptopenjdk-bin/jdk8-darwin.nix;
adoptopenjdk-11 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk11-linux.nix
../development/compilers/adoptopenjdk-bin/jdk11-darwin.nix;
adoptopenjdk-13 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk13-linux.nix
../development/compilers/adoptopenjdk-bin/jdk13-darwin.nix;
adoptopenjdk-14 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk14-linux.nix
../development/compilers/adoptopenjdk-bin/jdk14-darwin.nix;
adoptopenjdk-15 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk15-linux.nix
../development/compilers/adoptopenjdk-bin/jdk15-darwin.nix;
adoptopenjdk-16 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk16-linux.nix
../development/compilers/adoptopenjdk-bin/jdk16-darwin.nix;
adoptopenjdk-17 = mkAdoptopenjdk
../development/compilers/adoptopenjdk-bin/jdk17-linux.nix
../development/compilers/adoptopenjdk-bin/jdk17-darwin.nix;
corretto11 = callPackage ../development/compilers/corretto/11.nix { };
corretto17 = callPackage ../development/compilers/corretto/17.nix { };
corretto19 = callPackage ../development/compilers/corretto/19.nix { };
corretto21 = callPackage ../development/compilers/corretto/21.nix { };
openjdk8-bootstrap = mkBootstrap adoptopenjdk-8
../development/compilers/openjdk/bootstrap.nix
{ version = "8"; };
openjdk8-bootstrap = temurin-bin.jdk-8;
openjdk11-bootstrap = mkBootstrap adoptopenjdk-11
../development/compilers/openjdk/bootstrap.nix
{ version = "10"; };
openjdk11-bootstrap = temurin-bin.jdk-11;
openjdk13-bootstrap = mkBootstrap adoptopenjdk-13
../development/compilers/openjdk/12.nix
(bootstrapArgs // {
inherit openjdk11-bootstrap;
/* build segfaults with gcc9 or newer, so use gcc8 like Debian does */
stdenv = gcc8Stdenv;
});
openjdk14-bootstrap = mkBootstrap adoptopenjdk-14
../development/compilers/openjdk/13.nix
(bootstrapArgs // {
inherit openjdk13-bootstrap;
});
openjdk15-bootstrap = mkBootstrap adoptopenjdk-15
../development/compilers/openjdk/14.nix
(bootstrapArgs // {
inherit openjdk14-bootstrap;
});
openjdk16-bootstrap = mkBootstrap adoptopenjdk-16
../development/compilers/openjdk/15.nix
(bootstrapArgs // {
inherit openjdk15-bootstrap;
});
openjdk17-bootstrap = mkBootstrap adoptopenjdk-17
../development/compilers/openjdk/16.nix
(bootstrapArgs // {
inherit openjdk16-bootstrap;
});
openjdk18-bootstrap = mkBootstrap adoptopenjdk-17
../development/compilers/openjdk/17.nix
(bootstrapArgs // {
inherit openjdk17-bootstrap;
});
openjdk17-bootstrap = temurin-bin.jdk-17;
openjdk8 = mkOpenjdk
../development/compilers/openjdk/8.nix
@ -153,32 +49,6 @@ in {
../development/compilers/zulu/11.nix
{ openjfx = openjfx11; };
openjdk12 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/12.nix {
/* build segfaults with gcc9 or newer, so use gcc8 like Debian does */
stdenv = gcc8Stdenv;
openjfx = openjfx11;
};
openjdk13 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/13.nix {
inherit openjdk13-bootstrap;
openjfx = openjfx11;
};
openjdk14 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/14.nix {
inherit openjdk14-bootstrap;
openjfx = openjfx11;
};
openjdk15 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/15.nix {
inherit openjdk15-bootstrap;
openjfx = openjfx15;
};
openjdk16 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/16.nix {
inherit openjdk16-bootstrap;
openjfx = openjfx15;
};
openjdk17 = mkOpenjdk
../development/compilers/openjdk/17.nix
../development/compilers/zulu/17.nix
@ -191,7 +61,7 @@ in {
../development/compilers/openjdk/18.nix
../development/compilers/zulu/18.nix
{
inherit openjdk18-bootstrap;
openjdk18-bootstrap = temurin-bin.jdk-18;
openjfx = openjfx17;
};