Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09 119 lines 3.3 kB view raw
1{ buildEnv 2, fetchurl 3, fontconfig 4, freetype 5, glib 6, gsettings-desktop-schemas 7, gtk3 8, jdk11 9, lib 10, libX11 11, libXrender 12, libXtst 13, makeDesktopItem 14, makeWrapper 15, shared-mime-info 16, stdenv 17, unzip 18, webkitgtk 19, zlib 20}: 21 22with lib; 23let 24 pVersion = "1.10.0.20200225"; 25 pVersionTriple = splitVersion pVersion; 26 majorVersion = elemAt pVersionTriple 0; 27 minorVersion = elemAt pVersionTriple 1; 28 patchVersion = elemAt pVersionTriple 2; 29 baseVersion = "${majorVersion}.${minorVersion}.${patchVersion}"; 30 jdk = jdk11; 31in 32stdenv.mkDerivation rec { 33 pname = "eclipse-mat"; 34 version = "${pVersion}"; 35 36 src = fetchurl { 37 url = "http://ftp.halifax.rwth-aachen.de/eclipse//mat/${baseVersion}/rcp/MemoryAnalyzer-${version}-linux.gtk.x86_64.zip"; 38 sha256 = "11cg01gjjvlm6lr6z6rwqs1r31xx5pxddnz55ca0s33lrnywf9fx"; 39 }; 40 41 desktopItem = makeDesktopItem { 42 name = "eclipse-mat"; 43 exec = "eclipse-mat"; 44 icon = "eclipse"; 45 comment = "Eclipse Memory Analyzer"; 46 desktopName = "Eclipse MAT"; 47 genericName = "Java Memory Analyzer"; 48 categories = "Development;"; 49 }; 50 51 unpackPhase = '' 52 unzip $src 53 ''; 54 55 buildCommand = '' 56 mkdir -p $out 57 unzip $src 58 mv mat $out 59 60 # Patch binaries. 61 interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2) 62 libCairo=$out/eclipse/libcairo-swt.so 63 patchelf --set-interpreter $interpreter $out/mat/MemoryAnalyzer 64 [ -f $libCairo ] && patchelf --set-rpath ${ 65 stdenv.lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ] 66 } $libCairo 67 68 # Create wrapper script. Pass -configuration to store settings in ~/.eclipse-mat/<version> 69 makeWrapper $out/mat/MemoryAnalyzer $out/bin/eclipse-mat \ 70 --prefix PATH : ${jdk}/bin \ 71 --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath ([ glib gtk3 libXtst webkitgtk ])} \ 72 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \ 73 --add-flags "-configuration \$HOME/.eclipse-mat/''${version}/configuration" 74 75 # Create desktop item. 76 mkdir -p $out/share/applications 77 cp ${desktopItem}/share/applications/* $out/share/applications 78 mkdir -p $out/share/pixmaps 79 find $out/mat/plugins -name 'eclipse*.png' -type f -exec cp {} $out/share/pixmaps \; 80 mv $out/share/pixmaps/eclipse64.png $out/share/pixmaps/eclipse.png 81 ''; 82 83 buildInputs = [ 84 fontconfig 85 freetype 86 glib 87 gsettings-desktop-schemas 88 gtk3 89 jdk 90 libX11 91 libXrender 92 libXtst 93 makeWrapper 94 zlib 95 unzip 96 shared-mime-info 97 webkitgtk 98 ]; 99 100 dontBuild = true; 101 dontConfigure = true; 102 103 meta = with stdenv.lib; { 104 description = "Fast and feature-rich Java heap analyzer"; 105 longDescription = '' 106 The Eclipse Memory Analyzer is a tool that helps you find memory 107 leaks and reduce memory consumption. Use the Memory Analyzer to 108 analyze productive heap dumps with hundreds of millions of 109 objects, quickly calculate the retained sizes of objects, see 110 who is preventing the Garbage Collector from collecting objects, 111 run a report to automatically extract leak suspects. 112 ''; 113 homepage = "https://www.eclipse.org/mat"; 114 license = licenses.epl20; 115 maintainers = [ maintainers.ktor ]; 116 platforms = [ "x86_64-linux" ]; 117 }; 118 119}