at 23.05-pre 3.0 kB view raw
1{ stdenv 2, lib 3, fetchurl 4, makeWrapper 5, makeDesktopItem 6, copyDesktopItems 7, undmg 8, jdk 9}: 10 11let 12 inherit (stdenv.hostPlatform) system; 13 pname = "jprofiler"; 14 15 # 11.1.4 is the last version which can be unpacked by undmg 16 # See: https://github.com/matthewbauer/undmg/issues/9 17 version = if stdenv.isLinux then "13.0.2" else "11.1.4"; 18 nameApp = "JProfiler"; 19 20 meta = with lib; { 21 description = "JProfiler's intuitive UI helps you resolve performance bottlenecks"; 22 longDescription = '' 23 JProfiler's intuitive UI helps you resolve performance bottlenecks, 24 pin down memory leaks and understand threading issues. 25 ''; 26 homepage = "https://www.ej-technologies.com/products/jprofiler/overview.html"; 27 license = licenses.unfree; 28 maintainers = with maintainers; [ catap ]; 29 }; 30 31 src = if stdenv.isLinux then fetchurl { 32 url = "https://download-gcdn.ej-technologies.com/jprofiler/jprofiler_linux_${lib.replaceStrings ["."] ["_"] version}.tar.gz"; 33 sha256 = "sha256-x9I7l2ctquCqUymtlQpFXE6+u0Yg773qE6MvAxvCaEE="; 34 } else fetchurl { 35 url = "https://download-gcdn.ej-technologies.com/jprofiler/jprofiler_macos_${lib.replaceStrings ["."] ["_"] version}.dmg"; 36 sha256 = "sha256-WDMGrDsMdY1//WMHgr+/YKSxHWt6A1dD1Pd/MuDOaz8="; 37 }; 38 39 srcIcon = fetchurl { 40 url = "https://www.ej-technologies.com/assets/content/header-product-jprofiler@2x-24bc4d84bd2a4eb641a5c8531758ff7c.png"; 41 sha256 = "sha256-XUmuqhnNv7mZ3Gb4A0HLSlfiJd5xbCExVsw3hmXHeVE="; 42 }; 43 44 desktopItems = makeDesktopItem { 45 name = pname; 46 exec = pname; 47 icon = pname; 48 comment = meta.description; 49 desktopName = nameApp; 50 genericName = "Java Profiler Tool"; 51 categories = [ "Development" ]; 52 }; 53 54 linux = stdenv.mkDerivation { 55 inherit pname version src desktopItems; 56 57 nativeBuildInputs = [ makeWrapper copyDesktopItems ]; 58 59 installPhase = '' 60 runHook preInstall 61 cp -r . $out 62 63 rm -f $out/bin/updater 64 rm -rf $out/bin/linux-ppc* 65 rm -rf $out/bin/linux-armhf 66 rm -rf $out/bin/linux-musl* 67 68 for f in $(find $out/bin -type f -executable); do 69 wrapProgram $f --set JAVA_HOME "${jdk.home}" 70 done 71 72 install -Dm644 "${srcIcon}" \ 73 "$out/share/icons/hicolor/scalable/apps/jprofiler.png" 74 runHook postInstall 75 ''; 76 77 meta = meta // { platforms = lib.platforms.linux; }; 78 }; 79 80 darwin = stdenv.mkDerivation { 81 inherit pname version src; 82 83 # Archive extraction via undmg fails for this particular version. 84 nativeBuildInputs = [ makeWrapper undmg ]; 85 86 sourceRoot = "${nameApp}.app"; 87 88 installPhase = '' 89 runHook preInstall 90 mkdir -p $out/{Applications/${nameApp}.app,bin} 91 cp -R . $out/Applications/${nameApp}.app 92 makeWrapper $out/Applications/${nameApp}.app/Contents/MacOS/JavaApplicationStub $out/bin/${pname} 93 runHook postInstall 94 ''; 95 96 meta = meta // { platforms = lib.platforms.darwin; }; 97 }; 98in 99if stdenv.isDarwin then darwin else linux