2024-10-17 22:38:39 -06:00
|
|
|
{
|
2024-10-17 22:38:58 -06:00
|
|
|
featureVersion ? "17",
|
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
lib,
|
2024-10-17 22:38:58 -06:00
|
|
|
stdenv,
|
2024-10-17 22:38:39 -06:00
|
|
|
pkgs,
|
2024-10-17 22:38:58 -06:00
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
fetchpatch2,
|
2024-10-17 22:38:58 -06:00
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
gradle,
|
2024-10-17 22:38:58 -06:00
|
|
|
gradle_7,
|
2024-10-17 22:38:39 -06:00
|
|
|
perl,
|
2024-10-17 22:38:58 -06:00
|
|
|
pkg-config,
|
2024-10-17 22:38:39 -06:00
|
|
|
cmake,
|
|
|
|
gperf,
|
2024-10-17 22:38:58 -06:00
|
|
|
python3,
|
|
|
|
ruby,
|
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
gtk2,
|
|
|
|
gtk3,
|
|
|
|
libXtst,
|
|
|
|
libXxf86vm,
|
|
|
|
glib,
|
|
|
|
alsa-lib,
|
|
|
|
ffmpeg,
|
2024-10-17 22:38:58 -06:00
|
|
|
ffmpeg-headless,
|
|
|
|
|
|
|
|
writeText,
|
|
|
|
|
2024-10-17 22:52:44 -06:00
|
|
|
_experimental-update-script-combinators,
|
|
|
|
nixpkgs-openjdk-updater,
|
|
|
|
writeShellScript,
|
|
|
|
path,
|
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
withMedia ? true,
|
|
|
|
withWebKit ? false,
|
2024-10-17 22:38:58 -06:00
|
|
|
|
|
|
|
jdk17_headless,
|
|
|
|
jdk21_headless,
|
|
|
|
jdk23_headless,
|
|
|
|
jdk-bootstrap ?
|
|
|
|
{
|
|
|
|
"17" = jdk17_headless;
|
|
|
|
"21" = jdk21_headless;
|
|
|
|
"23" = jdk23_headless;
|
|
|
|
}
|
|
|
|
.${featureVersion},
|
2024-10-17 22:38:24 -06:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-10-17 22:38:58 -06:00
|
|
|
sourceFile = ./. + "/${featureVersion}/source.json";
|
2024-10-17 22:52:44 -06:00
|
|
|
source = nixpkgs-openjdk-updater.openjdkSource {
|
|
|
|
inherit sourceFile;
|
|
|
|
featureVersionPrefix = featureVersion;
|
|
|
|
};
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
atLeast21 = lib.versionAtLeast featureVersion "21";
|
|
|
|
atLeast23 = lib.versionAtLeast featureVersion "23";
|
|
|
|
|
|
|
|
gradle_openjfx = if atLeast23 then gradle else gradle_7;
|
2024-10-17 22:38:39 -06:00
|
|
|
in
|
2024-10-17 22:38:58 -06:00
|
|
|
|
|
|
|
assert lib.assertMsg (lib.pathExists sourceFile)
|
|
|
|
"OpenJFX ${featureVersion} is not a supported version";
|
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
stdenv.mkDerivation {
|
2024-10-17 22:38:58 -06:00
|
|
|
pname = "openjfx-modular-sdk";
|
2024-10-17 22:52:44 -06:00
|
|
|
version = lib.removePrefix "refs/tags/" source.src.rev;
|
2024-10-17 22:38:58 -06:00
|
|
|
|
2024-10-17 22:52:44 -06:00
|
|
|
inherit (source) src;
|
2024-10-17 22:38:58 -06:00
|
|
|
|
2024-10-24 13:43:24 -06:00
|
|
|
patches = lib.optionals (!atLeast23) (
|
|
|
|
if atLeast21 then
|
2024-10-17 22:38:58 -06:00
|
|
|
[
|
|
|
|
./21/patches/backport-ffmpeg-7-support-jfx21.patch
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[
|
|
|
|
./17/patches/backport-ffmpeg-6-support-jfx11.patch
|
|
|
|
./17/patches/backport-ffmpeg-7-support-jfx11.patch
|
2024-10-24 13:43:24 -06:00
|
|
|
]
|
|
|
|
);
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
nativeBuildInputs = [
|
|
|
|
gradle_openjfx
|
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
cmake
|
|
|
|
gperf
|
|
|
|
python3
|
|
|
|
ruby
|
2024-10-17 22:38:24 -06:00
|
|
|
];
|
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
buildInputs = [
|
|
|
|
gtk2
|
|
|
|
gtk3
|
|
|
|
libXtst
|
|
|
|
libXxf86vm
|
|
|
|
glib
|
|
|
|
alsa-lib
|
2024-10-17 22:38:58 -06:00
|
|
|
(if atLeast21 then ffmpeg else ffmpeg-headless)
|
2024-10-17 22:38:39 -06:00
|
|
|
];
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
mitmCache = gradle_openjfx.fetchDeps {
|
|
|
|
attrPath = "openjfx${featureVersion}";
|
|
|
|
pkg = pkgs."openjfx${featureVersion}".override { withWebKit = true; };
|
|
|
|
data = ./. + "/${featureVersion}/deps.json";
|
|
|
|
};
|
|
|
|
|
|
|
|
gradleBuildTask = "sdk";
|
|
|
|
|
|
|
|
stripDebugList = [ "." ];
|
|
|
|
|
|
|
|
enableParallelBuilding = false;
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
env.config = writeText "gradle.properties" ''
|
2024-10-17 22:38:24 -06:00
|
|
|
CONF = Release
|
2024-10-17 22:38:58 -06:00
|
|
|
JDK_HOME = ${jdk-bootstrap.home}
|
2024-10-17 22:38:24 -06:00
|
|
|
COMPILE_MEDIA = ${lib.boolToString withMedia}
|
|
|
|
COMPILE_WEBKIT = ${lib.boolToString withWebKit}
|
|
|
|
'';
|
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
dontUseCmakeConfigure = true;
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
postPatch =
|
|
|
|
lib.optionalString (!atLeast23) ''
|
|
|
|
# Add missing includes for gcc-13 for webkit build:
|
|
|
|
sed -e '1i #include <cstdio>' \
|
|
|
|
-i modules/javafx.web/src/main/native/Source/bmalloc/bmalloc/Heap.cpp \
|
|
|
|
modules/javafx.web/src/main/native/Source/bmalloc/bmalloc/IsoSharedPageInlines.h
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
''
|
|
|
|
+ ''
|
|
|
|
ln -s $config gradle.properties
|
|
|
|
'';
|
2024-10-17 22:38:24 -06:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export NUMBER_OF_PROCESSORS=$NIX_BUILD_CORES
|
|
|
|
export NIX_CFLAGS_COMPILE="$(pkg-config --cflags glib-2.0) $NIX_CFLAGS_COMPILE"
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cp -r build/modular-sdk $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Remove references to bootstrap.
|
2024-10-17 22:38:58 -06:00
|
|
|
export openjdkOutPath='${jdk-bootstrap.outPath}'
|
2024-10-17 22:38:24 -06:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2024-10-17 22:38:39 -06:00
|
|
|
disallowedReferences = [
|
2024-10-17 22:38:58 -06:00
|
|
|
jdk-bootstrap
|
|
|
|
gradle_openjfx.jdk
|
2024-10-17 22:38:39 -06:00
|
|
|
];
|
2024-10-17 22:38:24 -06:00
|
|
|
|
2024-10-17 22:52:44 -06:00
|
|
|
passthru.updateScript = _experimental-update-script-combinators.sequence [
|
|
|
|
source.updateScript
|
|
|
|
|
|
|
|
{
|
|
|
|
command = [
|
|
|
|
# We need to do this separate script rather than simply using
|
|
|
|
# `finalAttrs.mitmCache.updateScript` because the Gradle update
|
|
|
|
# script captures the source at the time of evaluation, making
|
|
|
|
# it miss the update.
|
|
|
|
(writeShellScript "update-openjfx-deps.sh" ''
|
|
|
|
eval "$(
|
|
|
|
nix-build "$1" \
|
|
|
|
-A openjfx${featureVersion}.mitmCache.updateScript
|
|
|
|
)"
|
|
|
|
'')
|
|
|
|
|
|
|
|
# This has to be a separate argument so that
|
|
|
|
# `maintainers/scripts/update.py` can rewrite it to the
|
|
|
|
# appropriate Git work tree.
|
|
|
|
path
|
|
|
|
];
|
|
|
|
|
|
|
|
supportedFeatures = [ "silent" ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2024-10-17 22:38:58 -06:00
|
|
|
meta = {
|
2024-10-17 22:38:24 -06:00
|
|
|
description = "Next-generation Java client toolkit";
|
2024-10-17 22:38:58 -06:00
|
|
|
homepage = "https://openjdk.org/projects/openjfx/";
|
|
|
|
license = lib.licenses.gpl2Classpath;
|
|
|
|
maintainers = with lib.maintainers; [ abbradar ];
|
|
|
|
platforms = lib.platforms.unix;
|
2024-10-17 22:38:24 -06:00
|
|
|
};
|
|
|
|
}
|