summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-06-11 02:50:41 +0200
committerGitHub <noreply@github.com>2022-06-11 02:50:41 +0200
commit52f1fd127eb88912c8ec830ce2c14371abb2eedc (patch)
treed7b2940b951705d5690c00c233e63df7c35788d7
parentb60f922d95cff55ad79877117b355490e6c178a0 (diff)
parentb39bd462400c7846fa53f840eb41fcbe4d4f3925 (diff)
downloadnixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.tar
nixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.tar.gz
nixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.tar.bz2
nixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.tar.lz
nixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.tar.xz
nixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.tar.zst
nixpkgs-52f1fd127eb88912c8ec830ce2c14371abb2eedc.zip
Merge pull request #174284 from sikmir/gpsbabel
-rw-r--r--pkgs/applications/misc/gpsbabel/debian-patches.nix26
-rw-r--r--pkgs/applications/misc/gpsbabel/debian-patches.txt6
-rw-r--r--pkgs/applications/misc/gpsbabel/default.nix123
-rw-r--r--pkgs/applications/misc/gpsbabel/gui.nix51
-rw-r--r--pkgs/top-level/all-packages.nix9
5 files changed, 119 insertions, 96 deletions
diff --git a/pkgs/applications/misc/gpsbabel/debian-patches.nix b/pkgs/applications/misc/gpsbabel/debian-patches.nix
new file mode 100644
index 00000000000..34dd2db31c5
--- /dev/null
+++ b/pkgs/applications/misc/gpsbabel/debian-patches.nix
@@ -0,0 +1,26 @@
+# Generated by debian-patches.sh from debian-patches.txt
+let
+  prefix = "https://sources.debian.org/data/main/g/gpsbabel/1.8.0+ds-4/debian/patches";
+in
+[
+  {
+    url = "${prefix}/gpsbabelfe_disable_version_check";
+    sha256 = "1kk1iq4mbmldl1jjvd4bphr0165rgn2gpqdyyd1vq8v8wjx942sb";
+  }
+  {
+    url = "${prefix}/gpsbabelfe_opt-in-for-usage-data-reporting";
+    sha256 = "0dr3jyn8sxx9vw3w11gir6jvshlda0ldmhlq4aq313xn6d1j8qv2";
+  }
+  {
+    url = "${prefix}/gpsbabelfe_do-not-check-for-newer-version";
+    sha256 = "0kmmxcq1k9p84v9cjagda1cqcc9p7p48i104l3z6clc17zixwgai";
+  }
+  {
+    url = "${prefix}/htmldoc-location";
+    sha256 = "0nk3gz3l0q68d7blzfkbkvr630xy8y7vlxalnzlbdigqcx7lk54f";
+  }
+  {
+    url = "${prefix}/Disable-donation-nagging";
+    sha256 = "11j2ffa0hn5cy8xw98jndkf735ar39sf6rl28bn91pxd38xyaz5b";
+  }
+]
diff --git a/pkgs/applications/misc/gpsbabel/debian-patches.txt b/pkgs/applications/misc/gpsbabel/debian-patches.txt
new file mode 100644
index 00000000000..012c28a37df
--- /dev/null
+++ b/pkgs/applications/misc/gpsbabel/debian-patches.txt
@@ -0,0 +1,6 @@
+gpsbabel/1.8.0+ds-4
+gpsbabelfe_disable_version_check
+gpsbabelfe_opt-in-for-usage-data-reporting
+gpsbabelfe_do-not-check-for-newer-version
+htmldoc-location
+Disable-donation-nagging
diff --git a/pkgs/applications/misc/gpsbabel/default.nix b/pkgs/applications/misc/gpsbabel/default.nix
index 054c3d1af84..b09e7ef725e 100644
--- a/pkgs/applications/misc/gpsbabel/default.nix
+++ b/pkgs/applications/misc/gpsbabel/default.nix
@@ -1,59 +1,99 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, libusb1, qtbase, zlib, IOKit, which, expat }:
+{ lib, stdenv, fetchFromGitHub, fetchurl, pkg-config, which
+, qtbase, qmake, qttools, qttranslations, wrapQtAppsHook
+, libusb1, shapelib, zlib
+, withGUI ? false, qtserialport
+, withMapPreview ? (!stdenv.isDarwin), qtwebengine
+, withDoc ? false, docbook_xml_dtd_45, docbook_xsl, expat, fop, libxml2, libxslt, perl
+}:
 
 stdenv.mkDerivation rec {
   pname = "gpsbabel";
-  version = "1.7.0";
+  version = "1.8.0";
 
   src = fetchFromGitHub {
     owner = "gpsbabel";
     repo = "gpsbabel";
     rev = "gpsbabel_${lib.replaceStrings ["."] ["_"] version}";
-    sha256 = "010g0vd2f5knpq5p7qfnl31kv3r8m5sjdsafcinbj5gh02j2nzpy";
+    sha256 = "sha256-0w8LsO+HwqZF8SQmwd8bCKma9PCM0hAzXhzWR4DgAHs=";
   };
 
-  patches = [
-    (fetchpatch {
-      url = "https://sources.debian.net/data/main/g/gpsbabel/1.5.3-2/debian/patches/use_minizip";
-      sha256 = "03fpsmlx1wc48d1j405zkzp8j64hcp0z72islf4mk1immql3ibcr";
-    })
-  ];
-
-  buildInputs = [ libusb1 qtbase zlib ]
-    ++ lib.optionals stdenv.isDarwin [ IOKit ];
-
-  checkInputs = [ expat.dev which ]; # Avoid ./testo.d/kml.test: line 74: which: command not found. Skipping KML validation phase.
+  patches = map fetchurl (import ./debian-patches.nix);
 
-  /* FIXME: Building the documentation, with "make doc", requires this:
-
-      [ libxml2 libxslt perl docbook_xml_dtd_412 docbook_xsl fop ]
+  postPatch = ''
+    patchShebangs testo
+  '' + lib.optionalString withGUI ''
+    # See https://github.com/NixOS/nixpkgs/issues/86054
+    substituteInPlace gui/mainwindow.cc \
+      --replace 'QLibraryInfo::location(QLibraryInfo::TranslationsPath)' \
+                'QLatin1String("${qttranslations}/translations")'
+  '' + lib.optionalString withDoc ''
+    substituteInPlace gbversion.h.qmake.in \
+      --replace /usr/share/doc $doc/share/doc
+
+    substituteInPlace testo.d/serialization.test \
+      --replace /usr/share/doc $doc/share/doc
+
+    substituteInPlace xmldoc/gpsbabel_man.xml \
+      --replace /usr/share/doc $doc/share/doc
+  '';
+
+  outputs = [ "out" ] ++ lib.optional withDoc "doc";
+
+  nativeBuildInputs = [ pkg-config qmake ]
+    ++ lib.optionals withGUI [ qttools wrapQtAppsHook ]
+    ++ lib.optionals withDoc [ docbook_xml_dtd_45 docbook_xsl expat fop libxml2 libxslt perl ];
+
+  buildInputs = [ libusb1 shapelib zlib ]
+    ++ lib.optional withGUI qtserialport
+    ++ lib.optional (withGUI && withMapPreview) qtwebengine;
+
+  checkInputs = [ libxml2 which ];
+
+  preConfigure = lib.optionalString withGUI ''
+    lrelease gui/*.ts gui/coretool/*.ts
+  '';
+
+  qmakeFlags = [
+    "WITH_LIBUSB=pkgconfig"
+    "WITH_SHAPELIB=pkgconfig"
+    "WITH_ZLIB=pkgconfig"
+  ] ++ lib.optionals (withGUI && !withMapPreview) [
+    "CONFIG+=disable-mappreview"
+  ];
 
-    But FOP isn't packaged yet.  */
+  makeFlags = lib.optional withGUI "gui"
+    ++ lib.optionals withDoc [ "gpsbabel.pdf" "gpsbabel.html" "gpsbabel.org" ];
 
-  configureFlags = [ "--with-zlib=system" ]
-    # Floating point behavior on i686 causes test failures. Preventing
-    # extended precision fixes this problem.
-    ++ lib.optionals stdenv.isi686 [
-      "CFLAGS=-ffloat-store" "CXXFLAGS=-ffloat-store"
-    ];
+  # Floating point behavior on i686 causes nmea.test failures. Preventing
+  # extended precision fixes this problem.
+  NIX_CFLAGS_COMPILE = lib.optional stdenv.isi686 "-ffloat-store";
 
-  enableParallelBuilding = true;
+  doCheck = true;
 
   dontWrapQtApps = true;
 
-  doCheck = true;
-  preCheck = ''
-    patchShebangs testo
-    substituteInPlace testo \
-      --replace "-x /usr/bin/hexdump" ""
-
-    rm -v testo.d/alantrl.test
-  ''
-    # The raymarine and gtm tests fail on i686 despite -ffloat-store.
-  + lib.optionalString stdenv.isi686 "rm -v testo.d/raymarine.test testo.d/gtm.test;"
-    # The gtm, kml and tomtom asc tests fail on darwin, see PR #23572.
-  + lib.optionalString stdenv.isDarwin "rm -v testo.d/gtm.test testo.d/kml.test testo.d/tomtom_asc.test testo.d/classic-2.test"
-    # The arc-project test fails on aarch64.
-  + lib.optionalString stdenv.isAarch64 "rm -v testo.d/arc-project.test";
+  installPhase = ''
+    install -Dm755 gpsbabel -t $out/bin
+  '' + lib.optionalString withGUI (if stdenv.isDarwin then ''
+    mkdir -p $out/Applications
+    mv gui/GPSBabelFE.app $out/Applications
+    install -Dm644 gui/*.qm gui/coretool/*.qm -t $out/Applications/GPSBabelFE.app/Contents/Resources/translations
+    ln -s $out/bin/gpsbabel $out/Applications/GPSBabelFE.app/Contents/MacOS
+  '' else ''
+    install -Dm755 gui/objects/gpsbabelfe -t $out/bin
+    install -Dm644 gui/gpsbabel.desktop -t $out/share/application
+    install -Dm644 gui/images/appicon.png $out/share/icons/hicolor/512x512/apps/gpsbabel.png
+    install -Dm644 gui/*.qm gui/coretool/*.qm -t $out/share/gpsbabel/translations
+  '') + lib.optionalString withDoc ''
+    install -Dm655 gpsbabel.{html,pdf} -t $doc/share/doc/gpsbabel
+    cp -r html $doc/share/doc/gpsbabel
+  '';
+
+  postFixup = lib.optionalString withGUI (if stdenv.isDarwin then ''
+    wrapQtApp "$out/Applications/GPSBabelFE.app/Contents/MacOS/GPSBabelFE"
+  '' else ''
+    wrapQtApp "$out/bin/gpsbabelfe"
+  '');
 
   meta = with lib; {
     broken = stdenv.isDarwin;
@@ -76,8 +116,9 @@ stdenv.mkDerivation rec {
       process data that may (or may not be) placed on a map, such as
       waypoints, tracks, and routes.
     '';
-    homepage = "http://www.gpsbabel.org/";
+    homepage = "https://www.gpsbabel.org/";
     license = licenses.gpl2Plus;
-    platforms = platforms.all;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ sikmir ];
   };
 }
diff --git a/pkgs/applications/misc/gpsbabel/gui.nix b/pkgs/applications/misc/gpsbabel/gui.nix
deleted file mode 100644
index 8501b7c0875..00000000000
--- a/pkgs/applications/misc/gpsbabel/gui.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{ lib, mkDerivation, qmake, qttools, qtwebkit, qttranslations, gpsbabel }:
-
-mkDerivation {
-  pname = "gpsbabel-gui";
-
-  inherit (gpsbabel) src version;
-
-  sourceRoot = "source/gui";
-
-  nativeBuildInputs = [ qmake qttools ];
-  buildInputs = [ qtwebkit ];
-
-  dontWrapQtApps = true;
-
-  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;
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 899a1823ed8..922d66cca1c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -26914,11 +26914,12 @@ with pkgs;
 
   gosmore = callPackage ../applications/misc/gosmore { stdenv = gcc10StdenvCompat; };
 
-  gpsbabel = libsForQt5.callPackage ../applications/misc/gpsbabel {
-    inherit (darwin) IOKit;
-  };
+  gpsbabel = libsForQt5.callPackage ../applications/misc/gpsbabel { };
 
-  gpsbabel-gui = libsForQt5.callPackage ../applications/misc/gpsbabel/gui.nix { };
+  gpsbabel-gui = gpsbabel.override {
+    withGUI = true;
+    withDoc = true;
+  };
 
   gpscorrelate = callPackage ../applications/misc/gpscorrelate { };