summary refs log tree commit diff
path: root/pkgs/applications/editors/eclipse/default.nix
blob: 7085d703b5c829d294575f073b1929843a35d4ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ stdenv, fetchurl, patchelf, makeDesktopItem, makeWrapper
, freetype, fontconfig, libX11, libXext, libXrender, zlib
, glib, gtk, libXtst, jre
}:

assert stdenv ? glibc;

stdenv.mkDerivation rec {
  name = "eclipse-3.5.2";
  
  src =
    if stdenv.system == "x86_64-linux" then
      fetchurl {
        url = http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/eclipse/downloads/drops/R-3.5.2-201002111343/eclipse-SDK-3.5.2-linux-gtk-x86_64.tar.gz;
        md5 = "54e2ce0660b2b1b0eb4267acf70ea66d";
      }
    else
      fetchurl {
        url = http://mirror.selfnet.de/eclipse/eclipse/downloads/drops/R-3.5.2-201002111343/eclipse-SDK-3.5.2-linux-gtk.tar.gz;
        md5 = "bde55a2354dc224cf5f26e5320e72dac";
      };

  desktopItem = makeDesktopItem {
    name = "Eclipse";
    exec = "eclipse";
    icon = "eclipse";
    comment = "Integrated Development Environment";
    desktopName = "Eclipse IDE";
    genericName = "Integrated Development Environment";
    categories = "Application;Development;";
  };

  buildInputs = [ makeWrapper patchelf ];
  
  buildCommand = ''
    # Unpack tarball
    ensureDir $out
    tar xfvz $src -C $out
    
    # Patch binaries
    interpreter=$(echo ${stdenv.glibc}/lib/ld-linux*.so.2)
    patchelf --set-interpreter $interpreter $out/eclipse/eclipse
    patchelf --set-rpath ${freetype}/lib:${fontconfig}/lib:${libX11}/lib:${libXrender}/lib:${zlib}/lib $out/eclipse/libcairo-swt.so

    # Create wrapper script
    makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
      --prefix PATH : ${jre}/bin \
      --prefix LD_LIBRARY_PATH : ${glib}/lib:${gtk}/lib:${libXtst}/lib
    
    # Create desktop item
    ensureDir $out/share/applications
    cp ${desktopItem}/share/applications/* $out/share/applications
  '';

  meta = {
    homepage = http://www.eclipse.org/;
    description = "A extensible multi-language software development environment";
  };
}