1{ stdenv, fetchurl, fetchFromGitHub, autoreconfHook, cmake, makeWrapper, pkgconfig, qmake
2, curl, grantlee, libgit2, libusb, libssh2, libxml2, libxslt, libzip, zlib
3, qtbase, qtconnectivity, qtlocation, qtsvg, qttools, qtwebkit, libXcomposite
4}:
5
6let
7 version = "4.7.5";
8
9 libdc = stdenv.mkDerivation rec {
10 name = "libdivecomputer-ssrf-${version}";
11
12 src = fetchurl {
13 url = "https://subsurface-divelog.org/downloads/libdivecomputer-subsurface-branch-${version}.tgz";
14 sha256 = "1xsgnmgc7yb46lflx8ynkbdxg2f6sny6xg6caqgx7rf0x1jmjj4x";
15 };
16
17 nativeBuildInputs = [ autoreconfHook ];
18
19 buildInputs = [ zlib ];
20
21 enableParallelBuilding = true;
22
23 meta = with stdenv.lib; {
24 homepage = http://www.libdivecomputer.org;
25 description = "A cross-platform and open source library for communication with dive computers from various manufacturers";
26 maintainers = with maintainers; [ mguentner ];
27 license = licenses.lgpl21;
28 platforms = platforms.all;
29 };
30 };
31
32 googlemaps = stdenv.mkDerivation rec {
33 name = "googlemaps-${version}";
34
35 version = "2017-12-18";
36
37 src = fetchFromGitHub {
38 owner = "vladest";
39 repo = "googlemaps";
40 rev = "79f3511d60dc9640de02a5f24656094c8982b26d";
41 sha256 = "11334w0bnfb97sv23vvj2b5hcwvr0171hxldn91jms9y12l5j15d";
42 };
43
44 nativeBuildInputs = [ qmake ];
45
46 buildInputs = [ qtbase qtlocation libXcomposite ];
47
48 pluginsSubdir = "lib/qt-${qtbase.qtCompatVersion}/plugins";
49
50 installPhase = ''
51 mkdir -p $out $(dirname ${pluginsSubdir}/geoservices)
52 mkdir -p ${pluginsSubdir}/geoservices
53 mv *.so ${pluginsSubdir}/geoservices
54 mv lib $out/
55 '';
56
57 enableParallelBuilding = true;
58
59 meta = with stdenv.lib; {
60 inherit (src.meta) homepage;
61 description = "QtLocation plugin for Google maps tile API";
62 maintainers = with maintainers; [ orivej ];
63 license = licenses.mit;
64 platforms = platforms.all;
65 };
66 };
67
68in stdenv.mkDerivation rec {
69 name = "subsurface-${version}";
70
71 src = fetchurl {
72 url = "https://subsurface-divelog.org/downloads/Subsurface-${version}.tgz";
73 sha256 = "0qqmnrmj2alr4rc2nqkv8sbdp92xb6j4j468wn6yqvgb23n77b82";
74 };
75
76 buildInputs = [
77 libdc googlemaps
78 curl grantlee libgit2 libssh2 libusb libxml2 libxslt libzip
79 qtbase qtconnectivity qtsvg qttools qtwebkit
80 ];
81
82 nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
83
84 cmakeFlags = [
85 "-DLIBDC_FROM_PKGCONFIG=ON"
86 "-DNO_PRINTING=OFF"
87 ];
88
89 postInstall = ''
90 wrapProgram $out/bin/subsurface \
91 --prefix QT_PLUGIN_PATH : "${googlemaps}/${googlemaps.pluginsSubdir}"
92 '';
93
94 enableParallelBuilding = true;
95
96 passthru = { inherit version libdc googlemaps; };
97
98 meta = with stdenv.lib; {
99 description = "A divelog program";
100 longDescription = ''
101 Subsurface can track single- and multi-tank dives using air, Nitrox or TriMix.
102 It allows tracking of dive locations including GPS coordinates (which can also
103 conveniently be entered using a map interface), logging of equipment used and
104 names of other divers, and lets users rate dives and provide additional notes.
105 '';
106 homepage = https://subsurface-divelog.org;
107 license = licenses.gpl2;
108 maintainers = with maintainers; [ mguentner ];
109 platforms = platforms.all;
110 };
111}