nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 178 lines 4.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchurl, 6 pkg-config, 7 which, 8 qmake, 9 qttools, 10 wrapQtAppsHook, 11 libusb1, 12 shapelib, 13 zlib, 14 withGUI ? false, 15 qtserialport, 16 withMapPreview ? (!stdenv.hostPlatform.isDarwin), 17 qtwebengine, 18 withDoc ? false, 19 docbook_xml_dtd_45, 20 docbook_xsl, 21 expat, 22 fop, 23 libxml2, 24 libxslt, 25 perl, 26}: 27 28stdenv.mkDerivation rec { 29 pname = "gpsbabel"; 30 version = "1.8.0"; 31 32 src = fetchFromGitHub { 33 owner = "gpsbabel"; 34 repo = "gpsbabel"; 35 rev = "gpsbabel_${lib.replaceStrings [ "." ] [ "_" ] version}"; 36 sha256 = "sha256-0w8LsO+HwqZF8SQmwd8bCKma9PCM0hAzXhzWR4DgAHs="; 37 }; 38 39 patches = map fetchurl (import ./debian-patches.nix); 40 41 postPatch = '' 42 patchShebangs testo 43 '' 44 + lib.optionalString withDoc '' 45 substituteInPlace gbversion.h.qmake.in \ 46 --replace /usr/share/doc $doc/share/doc 47 48 substituteInPlace testo.d/serialization.test \ 49 --replace /usr/share/doc $doc/share/doc 50 51 substituteInPlace xmldoc/gpsbabel_man.xml \ 52 --replace /usr/share/doc $doc/share/doc 53 ''; 54 55 outputs = [ "out" ] ++ lib.optional withDoc "doc"; 56 57 nativeBuildInputs = [ 58 pkg-config 59 qmake 60 ] 61 ++ lib.optionals withGUI [ 62 qttools 63 wrapQtAppsHook 64 ] 65 ++ lib.optionals withDoc [ 66 docbook_xml_dtd_45 67 docbook_xsl 68 expat 69 fop 70 libxml2 71 libxslt 72 perl 73 ]; 74 75 buildInputs = [ 76 libusb1 77 shapelib 78 zlib 79 ] 80 ++ lib.optional withGUI qtserialport 81 ++ lib.optional (withGUI && withMapPreview) qtwebengine; 82 83 nativeCheckInputs = [ 84 libxml2 85 which 86 ]; 87 88 preConfigure = lib.optionalString withGUI '' 89 lrelease gui/*.ts gui/coretool/*.ts 90 ''; 91 92 qmakeFlags = [ 93 "WITH_LIBUSB=pkgconfig" 94 "WITH_SHAPELIB=pkgconfig" 95 "WITH_ZLIB=pkgconfig" 96 ] 97 ++ lib.optionals (withGUI && !withMapPreview) [ 98 "CONFIG+=disable-mappreview" 99 ]; 100 101 makeFlags = 102 lib.optional withGUI "gui" 103 ++ lib.optionals withDoc [ 104 "gpsbabel.pdf" 105 "gpsbabel.html" 106 "gpsbabel.org" 107 ]; 108 109 # Floating point behavior on i686 causes nmea.test failures. Preventing 110 # extended precision fixes this problem. 111 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isi686 "-ffloat-store"; 112 113 doCheck = true; 114 115 dontWrapQtApps = true; 116 117 installPhase = '' 118 install -Dm755 gpsbabel -t $out/bin 119 '' 120 + lib.optionalString withGUI ( 121 if stdenv.hostPlatform.isDarwin then 122 '' 123 mkdir -p $out/Applications 124 mv gui/GPSBabelFE.app $out/Applications 125 install -Dm644 gui/*.qm gui/coretool/*.qm -t $out/Applications/GPSBabelFE.app/Contents/Resources/translations 126 ln -s $out/bin/gpsbabel $out/Applications/GPSBabelFE.app/Contents/MacOS 127 '' 128 else 129 '' 130 install -Dm755 gui/objects/gpsbabelfe -t $out/bin 131 install -Dm644 gui/gpsbabel.desktop -t $out/share/application 132 install -Dm644 gui/images/appicon.png $out/share/icons/hicolor/512x512/apps/gpsbabel.png 133 install -Dm644 gui/*.qm gui/coretool/*.qm -t $out/share/gpsbabel/translations 134 '' 135 ) 136 + lib.optionalString withDoc '' 137 install -Dm655 gpsbabel.{html,pdf} -t $doc/share/doc/gpsbabel 138 cp -r html $doc/share/doc/gpsbabel 139 ''; 140 141 postFixup = lib.optionalString withGUI ( 142 if stdenv.hostPlatform.isDarwin then 143 '' 144 wrapQtApp "$out/Applications/GPSBabelFE.app/Contents/MacOS/GPSBabelFE" 145 '' 146 else 147 '' 148 wrapQtApp "$out/bin/gpsbabelfe" 149 '' 150 ); 151 152 meta = with lib; { 153 description = "Convert, upload and download data from GPS and Map programs"; 154 longDescription = '' 155 GPSBabel converts waypoints, tracks, and routes between popular 156 GPS receivers and mapping programs. It also has powerful 157 manipulation tools for such data. 158 159 By flattening the Tower of Babel that the authors of various 160 programs for manipulating GPS data have imposed upon us, it 161 returns to us the ability to freely move our own waypoint data 162 between the programs and hardware we choose to use. 163 164 It contains extensive data manipulation abilities making it a 165 convenient for server-side processing or as the backend for 166 other tools. 167 168 It does not convert, transfer, send, or manipulate maps. We 169 process data that may (or may not be) placed on a map, such as 170 waypoints, tracks, and routes. 171 ''; 172 homepage = "https://www.gpsbabel.org/"; 173 license = licenses.gpl2Plus; 174 platforms = platforms.unix; 175 maintainers = with maintainers; [ sikmir ]; 176 mainProgram = "gpsbabel"; 177 }; 178}