2022-06-16 17:23:12 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchurl, pkg-config, which
|
2023-10-09 19:29:22 +00:00
|
|
|
, qmake, qttools, wrapQtAppsHook
|
2022-06-16 17:23:12 +00:00
|
|
|
, libusb1, shapelib, zlib
|
|
|
|
, withGUI ? false, qtserialport
|
2024-09-26 11:04:55 +00:00
|
|
|
, withMapPreview ? (!stdenv.hostPlatform.isDarwin), qtwebengine
|
2022-06-16 17:23:12 +00:00
|
|
|
, withDoc ? false, docbook_xml_dtd_45, docbook_xsl, expat, fop, libxml2, libxslt, perl
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gpsbabel";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "1.8.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gpsbabel";
|
|
|
|
repo = "gpsbabel";
|
|
|
|
rev = "gpsbabel_${lib.replaceStrings ["."] ["_"] version}";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-0w8LsO+HwqZF8SQmwd8bCKma9PCM0hAzXhzWR4DgAHs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
patches = map fetchurl (import ./debian-patches.nix);
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs testo
|
|
|
|
'' + 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;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ libxml2 which ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
makeFlags = lib.optional withGUI "gui"
|
|
|
|
++ lib.optionals withDoc [ "gpsbabel.pdf" "gpsbabel.html" "gpsbabel.org" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# Floating point behavior on i686 causes nmea.test failures. Preventing
|
|
|
|
# extended precision fixes this problem.
|
2024-09-26 11:04:55 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isi686 "-ffloat-store";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
doCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 gpsbabel -t $out/bin
|
2024-09-26 11:04:55 +00:00
|
|
|
'' + lib.optionalString withGUI (if stdenv.hostPlatform.isDarwin then ''
|
2022-06-16 17:23:12 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
postFixup = lib.optionalString withGUI (if stdenv.hostPlatform.isDarwin then ''
|
2022-06-16 17:23:12 +00:00
|
|
|
wrapQtApp "$out/Applications/GPSBabelFE.app/Contents/MacOS/GPSBabelFE"
|
|
|
|
'' else ''
|
|
|
|
wrapQtApp "$out/bin/gpsbabelfe"
|
|
|
|
'');
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Convert, upload and download data from GPS and Map programs";
|
|
|
|
longDescription = ''
|
|
|
|
GPSBabel converts waypoints, tracks, and routes between popular
|
|
|
|
GPS receivers and mapping programs. It also has powerful
|
|
|
|
manipulation tools for such data.
|
|
|
|
|
|
|
|
By flattening the Tower of Babel that the authors of various
|
|
|
|
programs for manipulating GPS data have imposed upon us, it
|
|
|
|
returns to us the ability to freely move our own waypoint data
|
|
|
|
between the programs and hardware we choose to use.
|
|
|
|
|
|
|
|
It contains extensive data manipulation abilities making it a
|
|
|
|
convenient for server-side processing or as the backend for
|
|
|
|
other tools.
|
|
|
|
|
|
|
|
It does not convert, transfer, send, or manipulate maps. We
|
|
|
|
process data that may (or may not be) placed on a map, such as
|
|
|
|
waypoints, tracks, and routes.
|
|
|
|
'';
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://www.gpsbabel.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2022-06-16 17:23:12 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ sikmir ];
|
2024-02-29 20:09:43 +00:00
|
|
|
mainProgram = "gpsbabel";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|