1{
2 stdenv,
3 lib,
4 fetchurl,
5 makeWrapper,
6 makeDesktopItem,
7 copyDesktopItems,
8 _7zz,
9 jdk,
10}:
11
12let
13 pname = "jprofiler";
14 version = "14.0.5";
15 nameApp = "JProfiler";
16
17 meta = {
18 description = "JProfiler's intuitive UI helps you resolve performance bottlenecks";
19 longDescription = ''
20 JProfiler's intuitive UI helps you resolve performance bottlenecks,
21 pin down memory leaks and understand threading issues.
22 '';
23 homepage = "https://www.ej-technologies.com/products/jprofiler/overview.html";
24 license = lib.licenses.unfree;
25 maintainers = [ ];
26 };
27
28 src =
29 if stdenv.hostPlatform.isLinux then
30 fetchurl {
31 url = "https://download.ej-technologies.com/jprofiler/jprofiler_linux_${
32 lib.replaceStrings [ "." ] [ "_" ] version
33 }.tar.gz";
34 hash = "sha256-S7e2WurDJ0ePzpMg0YK94Mn0eHfb8/jNmf0kYts2Y0M=";
35 }
36 else
37 fetchurl {
38 url = "https://download-gcdn.ej-technologies.com/jprofiler/jprofiler_macos_${
39 lib.replaceStrings [ "." ] [ "_" ] version
40 }.dmg";
41 hash = "sha256-HPGh+dRfLuQprpgnu8oFboHUB1xvFqPblJcowqgZ5KA=";
42 };
43
44 desktopItems = [
45 (makeDesktopItem {
46 name = pname;
47 exec = pname;
48 icon = pname;
49 comment = meta.description;
50 desktopName = nameApp;
51 genericName = "Java Profiler Tool";
52 categories = [ "Development" ];
53 })
54 ];
55
56 linux = stdenv.mkDerivation {
57 inherit
58 pname
59 version
60 src
61 desktopItems
62 ;
63
64 nativeBuildInputs = [
65 makeWrapper
66 copyDesktopItems
67 ];
68
69 installPhase = ''
70 runHook preInstall
71
72 cp -r . $out
73
74 rm -f $out/bin/updater
75 rm -rf $out/bin/linux-ppc*
76 rm -rf $out/bin/linux-armhf
77 rm -rf $out/bin/linux-musl*
78
79 for f in $(find $out/bin -type f -executable); do
80 wrapProgram $f --set JAVA_HOME "${jdk.home}"
81 done
82
83 install -Dm644 "./.install4j/i4j_extf_7_1u09tly_16qtnph.png" \
84 "$out/share/icons/hicolor/scalable/apps/jprofiler.png"
85
86 runHook postInstall
87 '';
88
89 meta = meta // {
90 platforms = lib.platforms.linux;
91 };
92 };
93
94 darwin = stdenv.mkDerivation {
95 inherit pname version src;
96
97 nativeBuildInputs = [
98 makeWrapper
99 _7zz
100 ];
101
102 unpackPhase = ''
103 runHook preUnpack
104
105 7zz x $src -x!JProfiler/\[\]
106
107 runHook postUnpack
108 '';
109
110 sourceRoot = nameApp;
111
112 installPhase = ''
113 runHook preInstall
114
115 mkdir -p $out/{Applications,bin}
116 cp -R ${nameApp}.app $out/Applications/
117 makeWrapper $out/Applications/${nameApp}.app/Contents/MacOS/JavaApplicationStub $out/bin/${pname}
118
119 runHook postInstall
120 '';
121
122 meta = meta // {
123 platforms = lib.platforms.darwin;
124 };
125 };
126in
127if stdenv.hostPlatform.isDarwin then darwin else linux