2023-01-20 10:41:00 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, writeText, gradle_7, pkg-config, perl, cmake
|
|
|
|
, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib, ffmpeg_4-headless, python3, ruby, icu68
|
2023-03-04 12:14:45 +00:00
|
|
|
, openjdk11-bootstrap
|
|
|
|
, withMedia ? true
|
|
|
|
, withWebKit ? false
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
major = "11";
|
2023-03-04 12:14:45 +00:00
|
|
|
update = ".0.18";
|
2020-04-24 23:36:52 +00:00
|
|
|
build = "1";
|
|
|
|
repover = "${major}${update}+${build}";
|
2023-01-20 10:41:00 +00:00
|
|
|
gradle_ = (gradle_7.override {
|
2020-04-24 23:36:52 +00:00
|
|
|
java = openjdk11-bootstrap;
|
2021-12-06 16:07:01 +00:00
|
|
|
});
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makePackage = args: stdenv.mkDerivation ({
|
|
|
|
version = "${major}${update}-${build}";
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openjdk";
|
|
|
|
repo = "jfx${major}u";
|
|
|
|
rev = repover;
|
2023-03-04 12:14:45 +00:00
|
|
|
sha256 = "sha256-46DjIzcBHkmp5vnhYnLu78CG72bIBRM4A6mgk2OLOko=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4-headless icu68 ];
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python3 ruby ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace buildSrc/linux.gradle \
|
|
|
|
--replace ', "-Werror=implicit-function-declaration"' ""
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
config = writeText "gradle.properties" (''
|
|
|
|
CONF = Release
|
|
|
|
JDK_HOME = ${openjdk11-bootstrap.home}
|
|
|
|
'' + args.gradleProperties or "");
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
export NUMBER_OF_PROCESSORS=$NIX_BUILD_CORES
|
2020-04-24 23:36:52 +00:00
|
|
|
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";
|
2023-01-20 10:41:00 +00:00
|
|
|
outputHash = "sha256-syceJMUEknBDCHK8eGs6rUU3IQn+HnQfURfCrDxYPa9=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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}
|
2020-04-24 23:36:52 +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.
|
|
|
|
find "$out" -name \*.so | while read lib; do
|
|
|
|
new_refs="$(patchelf --print-rpath "$lib" | sed -E 's,:?${openjdk11-bootstrap}[^:]*,,')"
|
|
|
|
patchelf --set-rpath "$new_refs" "$lib"
|
|
|
|
done
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
# Remove licenses, otherwise they may conflict with the ones included in the openjdk
|
|
|
|
rm -rf $out/modules_legal/*
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
disallowedReferences = [ openjdk11-bootstrap ];
|
|
|
|
|
|
|
|
passthru.deps = deps;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Uses a lot of RAM, OOMs otherwise
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://openjdk.java.net/projects/openjfx/";
|
|
|
|
license = licenses.gpl2;
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "The next-generation Java client toolkit";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
2022-12-17 10:02:37 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|