summary refs log tree commit diff
path: root/pkgs/applications/misc/gpsbabel/gui.nix
blob: 3de63203f24c98c375dc29e99f498d6cdef752ce (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
{ lib, stdenv, mkDerivation, qmake, qttools, qtwebkit, qttranslations, gpsbabel }:

mkDerivation {
  pname = "gpsbabel-gui";

  inherit (gpsbabel) src version;

  sourceRoot = "source/gui";

  nativeBuildInputs = [ qmake qttools ];
  buildInputs = [ qtwebkit ];

  postPatch = ''
    substituteInPlace mainwindow.cc \
      --replace "QApplication::applicationDirPath() + \"/" "\"" \
      --replace "QApplication::applicationDirPath() + '/' + " "" \
      --replace "translator.load(full_filename)" "translator.load(filename)" \
      --replace "gpsbabelfe_%1.qm" "$out/share/gpsbabel/translations/gpsbabelfe_%1.qm" \
      --replace "gpsbabel_%1.qm" "$out/share/gpsbabel/translations/gpsbabel_%1.qm" \
      --replace "qt_%1.qm" "${qttranslations}/translations/qt_%1.qm"
    substituteInPlace formatload.cc \
      --replace "QApplication::applicationDirPath() + \"/" "\""
    substituteInPlace gpsbabel.desktop \
      --replace "gpsbabelfe-bin" "gpsbabelfe"
  '';

  preConfigure = ''
    lrelease *.ts coretool/*.ts
  '';

  qtWrapperArgs = [
    "--prefix PATH : ${lib.makeBinPath [ gpsbabel ]}"
  ];

  postInstall = ''
    install -Dm755 objects/gpsbabelfe -t $out/bin
    install -Dm644 gpsbabel.desktop -t $out/share/applications
    install -Dm644 images/appicon.png $out/share/icons/hicolor/512x512/apps/gpsbabel.png
    install -Dm644 *.qm coretool/*.qm -t $out/share/gpsbabel/translations
  '';

  meta = with lib; {
    description = "Qt-based GUI for gpsbabel";
    homepage = "http://www.gpsbabel.org/";
    license = licenses.gpl2;
    maintainers = with maintainers; [ sikmir ];
    platforms = with platforms; linux;
  };
}