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

let
  fastutil = fetchurl {
    url = "http://ivy.mkgmap.org.uk/repo/it.unimi.dsi/fastutil/6.5.15-mkg.1b/jars/fastutil.jar";
    sha256 = "0d88m0rpi69wgxhnj5zh924q4zsvxq8m4ybk7m9mr3gz1hx0yx8c";
  };
  osmpbf = fetchurl {
    url = "http://ivy.mkgmap.org.uk/repo/crosby/osmpbf/1.3.3/jars/osmpbf.jar";
    sha256 = "0zb4pqkwly5z30ww66qhhasdhdrzwmrw00347yrbgyk2ii4wjad3";
  };
  protobuf = fetchurl {
    url = "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar";
    sha256 = "0x6c4pbsizvk3lm6nxcgi1g2iqgrxcna1ip74lbn01f0fm2wdhg0";
  };
in

stdenv.mkDerivation rec {
  pname = "mkgmap";
  version = "4289";

  src = fetchsvn {
    url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
    rev = version;
    sha256 = "1sm1pw71q7z0jrxm8bcgm6xjl2mcidyibcf0a3m8fv2andidxrb4";
  };

  # This patch removes from the build process
  # the automatic download of dependencies (see configurePhase)
  patches = [ ./build.xml.patch ];

  nativeBuildInputs = [ jdk ant makeWrapper ];

  configurePhase = ''
    mkdir -p lib/compile
    cp ${fastutil} ${osmpbf} ${protobuf} lib/compile/
  '';

  buildPhase = "ant";

  installPhase = ''
    cd dist
    install -Dm644 mkgmap.jar $out/share/java/mkgmap/mkgmap.jar
    install -Dm644 doc/mkgmap.1 $out/share/man/man1/mkgmap.1
    cp -r lib/ $out/share/java/mkgmap/
    makeWrapper ${jre}/bin/java $out/bin/mkgmap \
      --add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
  '';

  meta = with stdenv.lib; {
    description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
    homepage = "http://www.mkgmap.org.uk";
    license = licenses.gpl2;
    maintainers = with maintainers; [ sikmir ];
    platforms = platforms.all;
  };
}