about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/gpsd
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/gpsd')
-rw-r--r--nixpkgs/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch25
-rw-r--r--nixpkgs/pkgs/servers/gpsd/0001-Use-pkgconfig-for-dbus-library.patch31
-rw-r--r--nixpkgs/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch28
-rw-r--r--nixpkgs/pkgs/servers/gpsd/0002-scons-envs-patch.patch11
-rw-r--r--nixpkgs/pkgs/servers/gpsd/default.nix101
5 files changed, 196 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch b/nixpkgs/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
new file mode 100644
index 000000000000..a8721a3e7029
--- /dev/null
+++ b/nixpkgs/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
@@ -0,0 +1,25 @@
+From e08583ddb8445241c38c88d828271be908d52f9f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
+Date: Mon, 17 Feb 2014 20:52:50 +0000
+Subject: [PATCH 1/2] Import LD_LIBRARY_PATH to allow running 'scons check'
+ without 'chrpath'
+
+---
+ SConstruct | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/SConstruct b/SConstruct
+index fe444a2..f73c87e 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -220,6 +220,7 @@ import_env = (
+     'STAGING_DIR',     # Required by the OpenWRT and CeroWrt builds.
+     'STAGING_PREFIX',  # Required by the OpenWRT and CeroWrt builds.
+     'WRITE_PAD',       # So we can test WRITE_PAD values on the fly.
++    'LD_LIBRARY_PATH', # Allows running 'scons check' without 'chrpath'
+     )
+ envs = {}
+ for var in import_env:
+-- 
+2.9.0
+
diff --git a/nixpkgs/pkgs/servers/gpsd/0001-Use-pkgconfig-for-dbus-library.patch b/nixpkgs/pkgs/servers/gpsd/0001-Use-pkgconfig-for-dbus-library.patch
new file mode 100644
index 000000000000..58ae754ecfb5
--- /dev/null
+++ b/nixpkgs/pkgs/servers/gpsd/0001-Use-pkgconfig-for-dbus-library.patch
@@ -0,0 +1,31 @@
+From b4ed6e9e89e3b7d57e5de9f2c1987a489bb5628c Mon Sep 17 00:00:00 2001
+From: Alexey Shmalko <rasen.dubi@gmail.com>
+Date: Sat, 9 Jul 2016 20:54:05 +0300
+Subject: [PATCH] Use pkgconfig for dbus library
+
+Without this, gcc can't find library path for the dbus.
+
+This is already fixed upstream, so the patch shouldn't be necessary with
+the next version of gpsd.
+---
+ SConstruct | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 0d4b29d..d8624b0 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -586,8 +586,8 @@ else:
+ 
+     if env['dbus_export'] and config.CheckPKG('dbus-1'):
+         confdefs.append("#define HAVE_DBUS 1\n")
+-        dbusflags = ["-ldbus-1"]
+-        env.MergeFlags(pkg_config("dbus-1"))
++        dbusflags = pkg_config("dbus-1")
++        env.MergeFlags(dbusflags)
+     else:
+         confdefs.append("/* #undef HAVE_DBUS */\n")
+         dbusflags = []
+-- 
+2.9.0
+
diff --git a/nixpkgs/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch b/nixpkgs/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
new file mode 100644
index 000000000000..3e387167d6fb
--- /dev/null
+++ b/nixpkgs/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
@@ -0,0 +1,28 @@
+From 21e5295a633c8c450629106c4603b78b2de7d786 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
+Date: Sat, 15 Mar 2014 15:08:01 +0100
+Subject: [PATCH 2/2] Import XML_CATALOG_FILES to be able to validate the
+ manual
+
+In nixos/nixpkgs, 'xmlto' depends on $XML_CATALOG_FILES to be able to
+validate XML documents. Because without it, it'll try to go online to
+download DTD's and builders don't have network access...
+---
+ SConstruct | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/SConstruct b/SConstruct
+index f73c87e..0d4b29d 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -221,6 +221,7 @@ import_env = (
+     'STAGING_PREFIX',  # Required by the OpenWRT and CeroWrt builds.
+     'WRITE_PAD',       # So we can test WRITE_PAD values on the fly.
+     'LD_LIBRARY_PATH', # Allows running 'scons check' without 'chrpath'
++    'XML_CATALOG_FILES', # Enables validating the manual with 'xmlto' using nix build system
+     )
+ envs = {}
+ for var in import_env:
+-- 
+2.9.0
+
diff --git a/nixpkgs/pkgs/servers/gpsd/0002-scons-envs-patch.patch b/nixpkgs/pkgs/servers/gpsd/0002-scons-envs-patch.patch
new file mode 100644
index 000000000000..fbb06db6aa39
--- /dev/null
+++ b/nixpkgs/pkgs/servers/gpsd/0002-scons-envs-patch.patch
@@ -0,0 +1,11 @@
+--- b/SConstruct	2018-07-03 23:13:51.986746857 +0200
++++ a/SConstruct	2018-07-03 23:14:50.495252914 +0200
+@@ -221,7 +221,7 @@
+     'STAGING_PREFIX',  # Required by the OpenWRT and CeroWrt builds.
+     'WRITE_PAD',       # So we can test WRITE_PAD values on the fly.
+     )
+-envs = {}
++envs = os.environ
+ for var in import_env:
+     if var in os.environ:
+         envs[var] = os.environ[var]
diff --git a/nixpkgs/pkgs/servers/gpsd/default.nix b/nixpkgs/pkgs/servers/gpsd/default.nix
new file mode 100644
index 000000000000..f205b600dd95
--- /dev/null
+++ b/nixpkgs/pkgs/servers/gpsd/default.nix
@@ -0,0 +1,101 @@
+{ fetchurl, stdenv, scons, pkgconfig, dbus, dbus-glib
+, ncurses, libX11, libXt, libXpm, libXaw, libXext
+, libusb1, docbook_xml_dtd_412, docbook_xsl, bc
+, libxslt, xmlto, gpsdUser ? "gpsd", gpsdGroup ? "dialout"
+, pps-tools
+, python2Packages
+}:
+
+# TODO: put the X11 deps behind a guiSupport parameter for headless support
+
+stdenv.mkDerivation rec {
+  name = "gpsd-3.16";
+
+  src = fetchurl {
+    url = "https://download-mirror.savannah.gnu.org/releases/gpsd/${name}.tar.gz";
+    sha256 = "0a90ph4qrlz5kkcz2mwkfk3cmwy9fmglp94znz2y0gsd7bqrlmq3";
+  };
+
+  nativeBuildInputs = [
+    scons pkgconfig docbook_xml_dtd_412 docbook_xsl xmlto bc
+    python2Packages.python
+    python2Packages.wrapPython
+  ];
+
+  buildInputs = [
+    python2Packages.python dbus dbus-glib ncurses libX11 libXt libXpm libXaw libXext
+    libxslt libusb1 pps-tools
+  ];
+
+  pythonPath = [
+    python2Packages.pygobject2
+    python2Packages.pygtk
+  ];
+
+  patches = [
+    ./0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
+    ./0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
+
+    # TODO: remove the patch with the next release
+    ./0001-Use-pkgconfig-for-dbus-library.patch
+    # to be able to find pps-tools
+    ./0002-scons-envs-patch.patch
+  ];
+
+  # - leapfetch=no disables going online at build time to fetch leap-seconds
+  #   info. See <gpsd-src>/build.txt for more info.
+  preBuild = ''
+    patchShebangs .
+    sed -e "s|systemd_dir = .*|systemd_dir = '$out/lib/systemd/system'|" -i SConstruct
+
+    sconsFlags+=" udevdir=$out/lib/udev"
+    sconsFlags+=" python_libdir=$out/lib/${python2Packages.python.libPrefix}/site-packages"
+  '';
+
+  sconsFlags = [
+    "leapfetch=no"
+    "gpsd_user=${gpsdUser}"
+    "gpsd_group=${gpsdGroup}"
+    "systemd=yes"
+  ];
+
+  preCheck = ''
+    export LD_LIBRARY_PATH="$PWD"
+  '';
+
+  # TODO: the udev rules file and the hotplug script need fixes to work on NixOS
+  preInstall = ''
+    mkdir -p "$out/lib/udev/rules.d"
+  '';
+  installTargets = "install udev-install";
+
+  postFixup = ''
+    wrapPythonProgramsIn $out/bin "$out $pythonPath"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "GPS service daemon";
+    longDescription = ''
+      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.
+
+      Besides gpsd itself, the project provides auxiliary tools for
+      diagnostic monitoring and profiling of receivers and feeding
+      location-aware applications GPS/AIS logs for diagnostic purposes.
+    '';
+    homepage = http://catb.org/gpsd/;
+    license = "BSD-style";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor rasendubi ];
+  };
+}