2022-02-20 05:27:41 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, writeText, openjdk17_headless, gradle_7
|
|
|
|
, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib
|
2023-07-15 17:15:38 +00:00
|
|
|
, ffmpeg_4-headless, python3, ruby, icu71, fetchurl, runCommand
|
2023-03-04 12:14:45 +00:00
|
|
|
, withMedia ? true
|
|
|
|
, withWebKit ? false
|
|
|
|
}:
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
major = "17";
|
2023-03-04 12:14:45 +00:00
|
|
|
update = ".0.6";
|
|
|
|
build = "+3";
|
2022-02-20 05:27:41 +00:00
|
|
|
repover = "${major}${update}${build}";
|
|
|
|
gradle_ = (gradle_7.override {
|
|
|
|
java = openjdk17_headless;
|
|
|
|
});
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
dashed-icu-version = lib.concatStringsSep "-" (lib.splitString "." (lib.getVersion icu71));
|
|
|
|
underscored-icu-version = lib.concatStringsSep "_" (lib.splitString "." (lib.getVersion icu71));
|
|
|
|
icu-data = fetchurl {
|
|
|
|
url = "https://github.com/unicode-org/icu/releases/download/release-${dashed-icu-version}/icu4c-${underscored-icu-version}-data-bin-l.zip";
|
|
|
|
hash = "sha256-pVWIy0BkICsthA5mxhR9SJQHleMNnaEcGl/AaLi5qZM=";
|
|
|
|
};
|
|
|
|
|
|
|
|
fakeRepository = runCommand "icu-data-repository" {} ''
|
|
|
|
mkdir -p $out/download/release-${dashed-icu-version}
|
|
|
|
cp ${icu-data} $out/download/release-${dashed-icu-version}/icu4c-${underscored-icu-version}-data-bin-l.zip
|
|
|
|
'';
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
makePackage = args: stdenv.mkDerivation ({
|
|
|
|
version = "${major}${update}${build}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openjdk";
|
2023-01-20 10:41:00 +00:00
|
|
|
repo = "jfx${major}u";
|
2022-02-20 05:27:41 +00:00
|
|
|
rev = repover;
|
2023-03-04 12:14:45 +00:00
|
|
|
sha256 = "sha256-9VfXk2EfMebMyVKPohPRP2QXRFf8XemUtfY0JtBCHyw=";
|
2022-02-20 05:27:41 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4-headless icu71 ];
|
2022-02-20 05:27:41 +00:00
|
|
|
nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python3 ruby ];
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
|
|
|
config = writeText "gradle.properties" (''
|
|
|
|
CONF = Release
|
|
|
|
JDK_HOME = ${openjdk17_headless.home}
|
|
|
|
'' + args.gradleProperties or "");
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
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-dV7/U5GpFxhI13smZ587C6cVE4FRNPY0zexZkYK4Yqo=";
|
|
|
|
};
|
|
|
|
|
|
|
|
in makePackage {
|
|
|
|
pname = "openjfx-modular-sdk";
|
|
|
|
|
|
|
|
gradleProperties = ''
|
2023-03-04 12:14:45 +00:00
|
|
|
COMPILE_MEDIA = ${lib.boolToString withMedia}
|
|
|
|
COMPILE_WEBKIT = ${lib.boolToString withWebKit}
|
2023-07-15 17:15:38 +00:00
|
|
|
${lib.optionalString withWebKit "icuRepositoryURL = file://${fakeRepository}"}
|
2022-02-20 05:27:41 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
stripDebugList = [ "." ];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Remove references to bootstrap.
|
|
|
|
export openjdkOutPath='${openjdk17_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 = [ openjdk17_headless ];
|
|
|
|
|
|
|
|
passthru.deps = deps;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "http://openjdk.java.net/projects/openjfx/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
description = "The next-generation Java client toolkit";
|
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|