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