1{
2 lib,
3 stdenv,
4 fetchurl,
5 ant,
6 # executable fails to start for jdk > 17
7 jdk17,
8 swt,
9 makeWrapper,
10 strip-nondeterminism,
11 udevCheckHook,
12}:
13let
14 swt-jdk17 = swt.override { jdk = jdk17; };
15in
16stdenv.mkDerivation (finalAttrs: {
17 pname = "dataexplorer";
18 version = "3.9.3";
19
20 src = fetchurl {
21 url = "mirror://savannah/dataexplorer/dataexplorer-${finalAttrs.version}-src.tar.gz";
22 hash = "sha256-NfbhamhRx78MW5H4BpKMDfrV2d082UkaIBFfbemOSOY=";
23 };
24
25 nativeBuildInputs = [
26 ant
27 jdk17
28 makeWrapper
29 strip-nondeterminism
30 udevCheckHook
31 ];
32
33 buildPhase = ''
34 runHook preBuild
35 ant -f build/build.xml dist
36 runHook postBuild
37 '';
38
39 doCheck = false;
40 # Missing dependencies (e.g. junit). Does not work.
41 #checkPhase = ''
42 # ant -f build/build.xml check
43 #'';
44
45 doInstallCheck = true;
46
47 installPhase = ''
48 runHook preInstall
49
50 ant -Dprefix=$out/share/ -f build/build.xml install
51 # Use SWT from nixpkgs
52 ln -sf '${swt-jdk17}/jars/swt.jar' "$out/share/DataExplorer/java/ext/swt.jar"
53
54 # The sources contain a wrapper script in $out/share/DataExplorer/DataExplorer
55 # but it hardcodes bash shebang and does not pin the java path.
56 # So we create our own wrapper, using similar cmdline args as upstream.
57 mkdir -p $out/bin
58 makeWrapper ${jdk17}/bin/java $out/bin/DataExplorer \
59 --prefix LD_LIBRARY_PATH : '${swt-jdk17}/lib' \
60 --add-flags "-Xms64m -Xmx3092m -jar $out/share/DataExplorer/DataExplorer.jar" \
61 --set SWT_GTK3 0
62
63 makeWrapper ${jdk17}/bin/java $out/bin/DevicePropertiesEditor \
64 --add-flags "-Xms32m -Xmx512m -classpath $out/share/DataExplorer/DataExplorer.jar gde.ui.dialog.edit.DevicePropertiesEditor" \
65 --set SWT_GTK3 0 \
66 --set LIBOVERLAY_SCROLLBAR 0
67
68 install -Dvm644 build/misc/GNU_LINUX_JUNSI_ICHARER_USB_UDEV_RULE/50-Junsi-iCharger-USB.rules \
69 $out/etc/udev/rules.d/50-Junsi-iCharger-USB.rules
70 install -Dvm644 build/misc/GNU_LINUX_SKYRC_UDEV_RULE/50-SkyRC-Charger.rules \
71 $out/etc/udev/rules.d/50-SkyRC-Charger.rules
72
73 runHook postInstall
74 '';
75
76 # manually call strip-nondeterminism because using stripJavaArchivesHook takes
77 # too long to strip bundled jars
78 postFixup = ''
79 strip-nondeterminism --type jar $out/share/DataExplorer/{DataExplorer.jar,devices/*.jar}
80 '';
81
82 meta = with lib; {
83 description = "Graphical tool to analyze data, gathered from various hardware devices";
84 homepage = "https://www.nongnu.org/dataexplorer/index.html";
85 license = licenses.gpl3Plus;
86 maintainers = with maintainers; [ panicgh ];
87 platforms = [ "x86_64-linux" ];
88 sourceProvenance = with sourceTypes; [
89 fromSource
90 binaryNativeCode # contains RXTXcomm (JNI library with *.so files)
91 binaryBytecode # contains thirdparty jar files, e.g. javax.json, org.glassfish.json
92 ];
93 };
94})