summary refs log tree commit diff
path: root/pkgs/applications/misc/viking/default.nix
blob: 61ebfb0fcc6ab0a43291dd5fa910252aa6d0164f (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
{ fetchurl, fetchpatch, lib, stdenv, makeWrapper
, pkg-config, intltool, gettext, gtk2, expat, curl
, gpsd, bc, file, gnome-doc-utils, libexif, libxml2, libxslt, scrollkeeper
, docbook_xml_dtd_412, gexiv2, gpsbabel, expect
, withMapnik ? false, mapnik
, withMBTiles ? true, sqlite
, withOAuth ? true, liboauth
, withMd5Hash ? true, nettle
, withGeoClue ? true, geoclue2 }:

stdenv.mkDerivation rec {
  pname = "viking";
  version = "1.8";

  src = fetchurl {
    url = "mirror://sourceforge/viking/viking/viking-${version}.tar.bz2";
    sha256 = "1a0g0fbj4q5s9p8fv0mqvxws10q3naj81l72sz30vvqpbz6vqp45";
  };

  patches = [
    # Fix build without mapnik and sqlite https://github.com/viking-gps/viking/pull/79
    (fetchpatch {
      url = "https://github.com/viking-gps/viking/commit/995feefcb97bdb1590ed018224cf47ce197fe0c1.patch";
      sha256 = "1xb0b76kg690fag9mw3yfj5k766jmqp1sm8q4f29n1h3nz5g8izd";
    })
  ];

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ makeWrapper intltool gettext gtk2 expat curl gpsd bc file gnome-doc-utils
    libexif libxml2 libxslt scrollkeeper docbook_xml_dtd_412 gexiv2
  ] ++ lib.optional withMapnik mapnik
    ++ lib.optional withGeoClue geoclue2
    ++ lib.optional withMd5Hash nettle
    ++ lib.optional withOAuth liboauth
    ++ lib.optional withMBTiles sqlite;

  configureFlags = [
    "--disable-scrollkeeper"
    (lib.enableFeature withMapnik "mapnik")
    (lib.enableFeature withGeoClue "geoclue")
    (lib.enableFeature withMd5Hash "nettle")
    (lib.enableFeature withOAuth "oauth")
    (lib.enableFeature withMBTiles "mbtiles")
  ];

  preBuild = ''
    sed -i help/Makefile \
        -e 's|--noout|--noout --nonet --path "${scrollkeeper}/share/xml/scrollkeeper/dtds"|g'
    sed -i help/Makefile -e 's|--postvalid||g'
  '';

  doCheck = true;

  postInstall = ''
    wrapProgram $out/bin/viking \
      --prefix PATH : "${gpsbabel}/bin" \
      --prefix PATH : "${expect}/bin"
  '';

  meta = with lib; {
    description = "GPS data editor and analyzer";
    longDescription = ''
      Viking is a free/open source program to manage GPS data.  You
      can import and plot tracks and waypoints, show Openstreetmaps
      and/or Terraserver maps under it, download geocaches for an area
      on the map, make new tracks and waypoints, see real-time GPS
      position, etc.
    '';
    homepage = "https://sourceforge.net/projects/viking/";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ pSub sikmir ];
    platforms = with platforms; linux;
  };
}