2021-11-16 08:07:35 +00:00
|
|
|
{ stdenv, lib, fetchurl, writeText, gradle_4, pkg-config, perl, cmake
|
2022-02-06 18:41:06 +00:00
|
|
|
, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib, ffmpeg_4, python2, ruby
|
2019-07-21 19:41:44 +00:00
|
|
|
, openjdk11-bootstrap }:
|
2019-06-20 15:09:58 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
major = "11";
|
|
|
|
update = ".0.3";
|
|
|
|
build = "1";
|
|
|
|
repover = "${major}${update}+${build}";
|
2021-11-16 08:07:35 +00:00
|
|
|
gradle_ = (gradle_4.override {
|
2019-07-21 19:41:44 +00:00
|
|
|
java = openjdk11-bootstrap;
|
2021-11-16 08:07:35 +00:00
|
|
|
});
|
2019-06-20 15:09:58 +00:00
|
|
|
|
|
|
|
makePackage = args: stdenv.mkDerivation ({
|
2019-07-21 22:19:06 +00:00
|
|
|
version = "${major}${update}-${build}";
|
2019-06-20 15:09:58 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-07-21 22:19:06 +00:00
|
|
|
url = "https://hg.openjdk.java.net/openjfx/${major}/rt/archive/${repover}.tar.gz";
|
2019-06-20 15:09:58 +00:00
|
|
|
sha256 = "1h7qsylr7rnwnbimqjyn3whszp9kv4h3gpicsrb3mradxc9yv194";
|
|
|
|
};
|
|
|
|
|
2022-02-06 18:41:06 +00:00
|
|
|
buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4 ];
|
2021-07-27 16:37:28 +00:00
|
|
|
nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python2 ruby ];
|
2019-06-20 15:09:58 +00:00
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2021-09-10 01:17:33 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace buildSrc/linux.gradle \
|
|
|
|
--replace ', "-Werror=implicit-function-declaration"' ""
|
|
|
|
'';
|
|
|
|
|
2019-06-20 15:09:58 +00:00
|
|
|
config = writeText "gradle.properties" (''
|
|
|
|
CONF = Release
|
2019-07-21 19:41:44 +00:00
|
|
|
JDK_HOME = ${openjdk11-bootstrap.home}
|
2019-06-20 15:09:58 +00:00
|
|
|
'' + args.gradleProperties or "");
|
|
|
|
|
2019-10-09 12:02:18 +00:00
|
|
|
#avoids errors about deprecation of GTypeDebugFlags, GTimeVal, etc.
|
|
|
|
NIX_CFLAGS_COMPILE = [ "-DGLIB_DISABLE_DEPRECATION_WARNINGS" ];
|
|
|
|
|
2019-06-20 15:09:58 +00:00
|
|
|
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 = ''
|
2019-07-24 17:10:05 +00:00
|
|
|
find $GRADLE_USER_HOME -type f -regex '.*/modules.*\.\(jar\|pom\)' \
|
2019-06-20 15:09:58 +00:00
|
|
|
| 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";
|
2019-07-21 19:41:44 +00:00
|
|
|
# Downloaded AWT jars differ by platform.
|
|
|
|
outputHash = {
|
2019-08-13 21:52:01 +00:00
|
|
|
i686-linux = "0mjlyf6jvbis7nrm5d394sjv4hjw6k3753hr1nwdxk8skwc3ry08";
|
|
|
|
x86_64-linux = "0d4msxswdav1xsfkpr0qd3xgqkcbxzf47v1zdy5jmg5w4bs6a78a";
|
2019-07-21 19:41:44 +00:00
|
|
|
}.${stdenv.system} or (throw "Unsupported platform");
|
2019-06-20 15:09:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in makePackage {
|
|
|
|
pname = "openjfx-modular-sdk";
|
|
|
|
|
|
|
|
gradleProperties = ''
|
|
|
|
COMPILE_MEDIA = true
|
|
|
|
COMPILE_WEBKIT = true
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2019-09-14 21:22:01 +00:00
|
|
|
# glib-2.62 deprecations
|
2019-10-30 01:29:30 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-DGLIB_DISABLE_DEPRECATION_WARNINGS";
|
2019-09-14 21:22:01 +00:00
|
|
|
|
2019-06-20 15:09:58 +00:00
|
|
|
stripDebugList = [ "." ];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Remove references to bootstrap.
|
|
|
|
find "$out" -name \*.so | while read lib; do
|
2019-07-21 19:41:44 +00:00
|
|
|
new_refs="$(patchelf --print-rpath "$lib" | sed -E 's,:?${openjdk11-bootstrap}[^:]*,,')"
|
2019-06-20 15:09:58 +00:00
|
|
|
patchelf --set-rpath "$new_refs" "$lib"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2019-07-21 19:41:44 +00:00
|
|
|
disallowedReferences = [ openjdk11-bootstrap ];
|
|
|
|
|
2019-06-20 15:09:58 +00:00
|
|
|
passthru.deps = deps;
|
|
|
|
|
2021-11-19 18:14:04 +00:00
|
|
|
# Uses a lot of RAM, OOMs otherwise
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://openjdk.java.net/projects/openjfx/";
|
2019-08-31 16:09:56 +00:00
|
|
|
license = licenses.gpl2;
|
2020-10-11 05:55:05 +00:00
|
|
|
description = "The next-generation Java client toolkit";
|
2019-06-20 15:09:58 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
2019-07-21 19:41:44 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
2019-06-20 15:09:58 +00:00
|
|
|
};
|
|
|
|
}
|