2021-08-09 03:10:51 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
|
|
|
|
# nativeBuildInputs
|
|
|
|
, scons
|
|
|
|
, pkg-config
|
|
|
|
|
|
|
|
# buildInputs
|
|
|
|
, dbus
|
|
|
|
, libusb1
|
|
|
|
, ncurses
|
|
|
|
, pps-tools
|
|
|
|
, python3Packages
|
2020-12-03 22:10:40 +00:00
|
|
|
|
|
|
|
# optional deps for GUI packages
|
|
|
|
, guiSupport ? true
|
2021-08-10 12:46:40 +00:00
|
|
|
, dbus-glib
|
|
|
|
, libX11
|
|
|
|
, libXt
|
|
|
|
, libXpm
|
|
|
|
, libXaw
|
|
|
|
, libXext
|
|
|
|
, gobject-introspection
|
|
|
|
, pango
|
|
|
|
, gdk-pixbuf
|
|
|
|
, atk
|
|
|
|
, wrapGAppsHook
|
2021-08-09 03:10:51 +00:00
|
|
|
|
|
|
|
, gpsdUser ? "gpsd", gpsdGroup ? "dialout"
|
2013-11-23 23:02:03 +00:00
|
|
|
}:
|
|
|
|
|
2009-05-31 11:29:42 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-12-03 22:10:40 +00:00
|
|
|
pname = "gpsd";
|
2023-01-16 08:15:28 +00:00
|
|
|
version = "3.25";
|
2009-05-31 11:29:42 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-02-25 19:16:42 +00:00
|
|
|
url = "mirror://savannah/${pname}/${pname}-${version}.tar.gz";
|
2023-01-16 08:15:28 +00:00
|
|
|
sha256 = "sha256-s2i2owXj96Y4LSOgy/wdeJIwYLa39Uz3mHpzx7Spr8I=";
|
2009-05-31 11:29:42 +00:00
|
|
|
};
|
|
|
|
|
2021-08-09 03:10:51 +00:00
|
|
|
# TODO: render & install HTML documentation using asciidoctor
|
2013-11-23 23:02:03 +00:00
|
|
|
nativeBuildInputs = [
|
2021-08-09 03:10:51 +00:00
|
|
|
pkg-config
|
2020-12-03 22:10:40 +00:00
|
|
|
python3Packages.wrapPython
|
2021-08-09 03:10:51 +00:00
|
|
|
scons
|
|
|
|
] ++ lib.optionals guiSupport [
|
|
|
|
gobject-introspection
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
2009-05-31 11:29:42 +00:00
|
|
|
|
2013-11-23 23:02:03 +00:00
|
|
|
buildInputs = [
|
2021-08-09 03:10:51 +00:00
|
|
|
dbus
|
|
|
|
libusb1
|
|
|
|
ncurses
|
|
|
|
pps-tools
|
|
|
|
python3Packages.python
|
|
|
|
] ++ lib.optionals guiSupport [
|
|
|
|
atk
|
|
|
|
dbus-glib
|
|
|
|
gdk-pixbuf
|
|
|
|
libX11
|
|
|
|
libXaw
|
|
|
|
libXext
|
|
|
|
libXpm
|
|
|
|
libXt
|
|
|
|
pango
|
2013-11-23 23:02:03 +00:00
|
|
|
];
|
2009-06-01 00:03:08 +00:00
|
|
|
|
2020-12-03 22:10:40 +00:00
|
|
|
pythonPath = lib.optionals guiSupport [
|
|
|
|
python3Packages.pygobject3
|
|
|
|
python3Packages.pycairo
|
2016-07-09 16:50:13 +00:00
|
|
|
];
|
|
|
|
|
2013-11-23 23:02:03 +00:00
|
|
|
patches = [
|
2020-12-03 22:10:40 +00:00
|
|
|
./sconstruct-env-fixes.patch
|
2013-11-23 23:02:03 +00:00
|
|
|
];
|
2011-06-07 21:51:13 +00:00
|
|
|
|
2018-11-12 02:52:07 +00:00
|
|
|
preBuild = ''
|
2015-01-08 09:26:49 +00:00
|
|
|
patchShebangs .
|
2021-02-25 19:16:42 +00:00
|
|
|
sed -e "s|systemd_dir = .*|systemd_dir = '$out/lib/systemd/system'|" -i SConscript
|
|
|
|
export TAR=noop
|
gpsd: fix cross-compilation
Prior to this commit, builds of `pkgsCross.*.gpsd` were failing.
`gpsd` expects `CCVERSION` to be set, and fails if it is not set.
Scons does not guarantee that `CCVERSION` will be set, nor does it
specify under what circumstances it will or will not be set: "This may
or may not be set, depending on the specific C compiler being used."
https://scons.org/doc/production/HTML/scons-man.html#cv-CCVERSION
Apparently cross-compilation triggers one of those unspecified
circumstances. There are several bug reports to scons relating to
this:
https://github.com/SCons/scons/issues/1723
https://github.com/SCons/scons/issues?q=is%3Aissue+ccversion+is%3Aclosed
`gpsd` does not use `CCVERSION` for any purpose other than printing a
log message at the start of the build:
https://gitlab.com/gpsd/gpsd/-/commit/d0558636038e18d90eb886f668ff5004538f7839
This commit modifies the log message, replacing `env['CCVERSION']`
with `env['CC']`, since `CC` is always set when using nixpkgs'
standard builder.
With this commit, `pkgsCross.mips64el-linux-gnuabi64.gpsd` and
`pkgsCross.powernv.gpsd` build correctly on x86_64. Prior to this
commit, they would fail with:
```
scons: Reading SConscript files ...
scons version: 4.1.0
scons is running under Python version: 3.10.5.final.0
gpsd version: 3.23.1
This system is: linux
KeyError: 'CCVERSION':
File "/build/gpsd-3.23.1/SConstruct", line 69:
SConscript('SConscript',
File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Script/SConscript.py", line 654:
return method(*args, **kw)
File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Script/SConscript.py", line 591:
return _SConscript(self.fs, *files, **subst_kw)
File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Script/SConscript.py", line 280:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/build/gpsd-3.23.1/gpsd-3.23.1/SConscript", line 883:
announce("cc is %s, version %s" % (env['CC'], env['CCVERSION']))
File "/nix/store/0vmqv6f2s8bj2a50gk8g05jcb5scnifb-scons-4.1.0/lib/python3.10/site-packages/SCons/Environment.py", line 388:
return self._dict[key]
```
2022-07-20 05:54:59 +00:00
|
|
|
substituteInPlace SConscript --replace "env['CCVERSION']" "env['CC']"
|
2018-11-12 02:52:07 +00:00
|
|
|
|
|
|
|
sconsFlags+=" udevdir=$out/lib/udev"
|
2020-12-03 22:10:40 +00:00
|
|
|
sconsFlags+=" python_libdir=$out/lib/${python3Packages.python.libPrefix}/site-packages"
|
2013-11-23 23:02:03 +00:00
|
|
|
'';
|
2009-05-31 11:29:42 +00:00
|
|
|
|
2021-08-09 03:10:51 +00:00
|
|
|
# - leapfetch=no disables going online at build time to fetch leap-seconds
|
|
|
|
# info. See <gpsd-src>/build.txt for more info.
|
2018-11-12 02:52:07 +00:00
|
|
|
sconsFlags = [
|
|
|
|
"leapfetch=no"
|
|
|
|
"gpsd_user=${gpsdUser}"
|
|
|
|
"gpsd_group=${gpsdGroup}"
|
|
|
|
"systemd=yes"
|
2020-12-03 22:10:40 +00:00
|
|
|
"xgps=${if guiSupport then "True" else "False"}"
|
2018-11-12 02:52:07 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
2013-11-23 23:02:03 +00:00
|
|
|
export LD_LIBRARY_PATH="$PWD"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# TODO: the udev rules file and the hotplug script need fixes to work on NixOS
|
2018-11-12 02:52:07 +00:00
|
|
|
preInstall = ''
|
2013-11-23 23:02:03 +00:00
|
|
|
mkdir -p "$out/lib/udev/rules.d"
|
|
|
|
'';
|
2021-08-09 03:10:51 +00:00
|
|
|
|
2019-11-04 11:23:53 +00:00
|
|
|
installTargets = [ "install" "udev-install" ];
|
2013-11-23 23:02:03 +00:00
|
|
|
|
2020-12-03 22:10:40 +00:00
|
|
|
# remove binaries for x-less install because xgps sconsflag is partially broken
|
2016-07-09 16:50:13 +00:00
|
|
|
postFixup = ''
|
|
|
|
wrapPythonProgramsIn $out/bin "$out $pythonPath"
|
|
|
|
'';
|
2009-06-01 00:03:08 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2014-03-15 14:22:32 +00:00
|
|
|
description = "GPS service daemon";
|
2009-05-31 11:29:42 +00:00
|
|
|
longDescription = ''
|
2014-03-15 14:22:32 +00:00
|
|
|
gpsd is a service daemon that monitors one or more GPSes or AIS
|
|
|
|
receivers attached to a host computer through serial or USB ports,
|
|
|
|
making all data on the location/course/velocity of the sensors
|
|
|
|
available to be queried on TCP port 2947 of the host computer. With
|
|
|
|
gpsd, multiple location-aware client applications (such as navigational
|
|
|
|
and wardriving software) can share access to receivers without
|
|
|
|
contention or loss of data. Also, gpsd responds to queries with a
|
|
|
|
format that is substantially easier to parse than the NMEA 0183 emitted
|
|
|
|
by most GPSes. The gpsd distribution includes a linkable C service
|
|
|
|
library, a C++ wrapper class, and a Python module that developers of
|
|
|
|
gpsd-aware applications can use to encapsulate all communication with
|
|
|
|
gpsd. Third-party client bindings for Java and Perl also exist.
|
2009-05-31 11:29:42 +00:00
|
|
|
|
|
|
|
Besides gpsd itself, the project provides auxiliary tools for
|
2014-03-15 14:22:32 +00:00
|
|
|
diagnostic monitoring and profiling of receivers and feeding
|
|
|
|
location-aware applications GPS/AIS logs for diagnostic purposes.
|
2009-05-31 11:29:42 +00:00
|
|
|
'';
|
2021-02-25 19:16:42 +00:00
|
|
|
homepage = "https://gpsd.gitlab.io/gpsd/index.html";
|
|
|
|
changelog = "https://gitlab.com/gpsd/gpsd/-/blob/release-${version}/NEWS";
|
2021-08-09 03:10:51 +00:00
|
|
|
license = licenses.bsd2;
|
2014-03-15 14:22:32 +00:00
|
|
|
platforms = platforms.linux;
|
2016-07-09 16:50:13 +00:00
|
|
|
maintainers = with maintainers; [ bjornfor rasendubi ];
|
2009-05-31 11:29:42 +00:00
|
|
|
};
|
|
|
|
}
|