summary refs log tree commit diff
path: root/pkgs/applications/misc/freemind/default.nix
blob: 5774320220a162e32d52c582f164040404e97764 (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
{ stdenv, fetchurl, jdk, jre, ant }:

stdenv.mkDerivation rec {
  pname = "freemind";
  version = "1.0.1";

  src = fetchurl {
    url = "mirror://sourceforge/freemind/freemind-src-${version}.tar.gz";
    sha256 = "06c6pm7hpwh9hbmyah3lj2wp1g957x8znfwc5cwygsi7dc98b0h1";
  };

  buildInputs = [ jdk ant ];

  preConfigure = ''
    chmod +x check_for_duplicate_resources.sh
    sed 's,/bin/bash,${stdenv.shell},' -i check_for_duplicate_resources.sh

    ## work around javac encoding errors
    export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
  '';

  buildPhase = "ant dist";

  installPhase = ''
    mkdir -p $out/{bin,nix-support}
    cp -r ../bin/dist $out/nix-support
    sed -i 's/which/type -p/' $out/nix-support/dist/freemind.sh

    cat >$out/bin/freemind <<EOF
    #! ${stdenv.shell}
    JAVA_HOME=${jre} $out/nix-support/dist/freemind.sh
    EOF
    chmod +x $out/{bin/freemind,nix-support/dist/freemind.sh}
  '';

  meta = with stdenv.lib; {
    description = "Mind-mapping software";
    homepage = "http://freemind.sourceforge.net/wiki/index.php/Main_Page";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}