summary refs log tree commit diff
path: root/pkgs/applications/editors/emacs-modes/jdee/default.nix
blob: b25d178d1648678254a42e8b80fb0b9eb9d66c8b (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{ fetchsvn, stdenv, emacs, cedet, ant }:

let
  revision = "137";
in
  stdenv.mkDerivation rec {
    name = "jdee-svn${revision}";

    # Last release is too old, so use SVN.
    # See http://www.emacswiki.org/emacs/JavaDevelopmentEnvironment .
    src = fetchsvn {
      url = "https://jdee.svn.sourceforge.net/svnroot/jdee/trunk/jdee";
      rev = revision;
      sha256 = "1z1y957glbqm7z3dhah9h4jysw3173pq1gpx5agfwcw614n516xz";
    };

    patchFlags = "-p1 --ignore-whitespace";

    patches = [
      ./build-properties.patch
      ./cedet-paths.patch ./elib-avltree.patch
      ./java-directory.patch
    ];

    configurePhase = ''
      mkdir -p "dist"
      cat > build.properties <<EOF
        dist.lisp.dir = dist/share/emacs/site-lisp
        dist.java.lib.dir = dist/lib/java
        dist.jar.jde.file = dist/lib/java/jde.jar
        dist.java.src.dir = dist/src/${name}/java
        dist.doc.dir  dist/doc/${name}
        prefix.dir = $out
        cedet.dir = ${cedet}/share/emacs/site-lisp
        elib.dir = /nowhere
        build.bin.emacs = ${emacs}/bin/emacs
      EOF

      # Substitute variables, à la Autoconf.
      for i in "lisp/"*.el
      do
        sed -i "$i" -e "s|@out@|$out|g ;
                        s|@javadir@|$out/lib/java|g ;
                        s|@datadir@|$out/share/${name}|g"
      done
    '';

    buildPhase = "ant dist";

    installPhase = ''
      ant install

      mkdir -p "$out/share/${name}"
      cp -rv java/bsh-commands "$out/share/${name}"

      # Move everything that's not a JAR to $datadir.  This includes
      # `sun_checks.xml', license files, etc.
      cd "$out/lib/java"
      for i in *
      do
        if echo $i | grep -qv '\.jar''$'
        then
            mv -v "$i" "$out/share/${name}"
        fi
      done
    '';

    buildInputs = [ emacs ant ];
    propagatedBuildInputs = [ cedet ];
    propagatedUserEnvPkgs = propagatedBuildInputs; # FIXME: Not honored

    meta = {
      description = "JDEE, a Java development environment for Emacs";

      longDescription = ''
        The JDEE is a software package that interfaces Emacs to
        command-line Java development tools (for example, JavaSoft's
        JDK).  JDEE features include:

        * JDEE menu with compile, run, debug, build, browse, project,
          and help commands
        * syntax coloring
        * auto indentation
        * compile error to source links
        * source-level debugging
        * source code browsing
        * make file support
        * automatic code generation
        * Java source interpreter (Pat Neimeyer's BeanShell)
      '';

      license = "GPLv2+";

      maintainers = [ ];
      platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
    };
  }