summary refs log tree commit diff
path: root/pkgs/servers/gpsd
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2013-11-24 00:02:03 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2014-03-15 17:35:55 +0100
commitc54b9b7b6024eaf29a2e022990fbcfae45336572 (patch)
treeb6963be5f59c0f0b8b95dadd5591f0ac819532c8 /pkgs/servers/gpsd
parentf7006116b383fa865c8a24af874f3b4b7997dcbe (diff)
downloadnixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.tar
nixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.tar.gz
nixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.tar.bz2
nixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.tar.lz
nixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.tar.xz
nixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.tar.zst
nixpkgs-c54b9b7b6024eaf29a2e022990fbcfae45336572.zip
gpsd: update 2.95 -> 3.10
Build system is changed, gpsd uses scons now.

The expressions needs some more work, TODO comments added. (xgps didn't
work before this change either.)

I added an option for the gpsd group, which is set to upstream default:
"dialout". Note that our default gpsd user is "gpsd", while upstream
uses "nobody" by default.
Diffstat (limited to 'pkgs/servers/gpsd')
-rw-r--r--pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch25
-rw-r--r--pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch28
-rw-r--r--pkgs/servers/gpsd/default.nix55
3 files changed, 97 insertions, 11 deletions
diff --git a/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch b/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
new file mode 100644
index 00000000000..3a38340f43a
--- /dev/null
+++ b/pkgs/servers/gpsd/0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
@@ -0,0 +1,25 @@
+From d7e56abcae8bcb85dc935e94418a2f0e9956941b 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 14e2f59..86b94bc 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -215,6 +215,7 @@ import_env = (
+     'PKG_CONFIG_LIBDIR',      # Pass more environment variables to pkg-config (required for crossbuilds)
+     'STAGING_DIR',     # Required by the OpenWRT and CeroWrt builds.
+     'STAGING_PREFIX',  # Required by the OpenWRT and CeroWrt builds.
++    'LD_LIBRARY_PATH', # Allows running 'scons check' without 'chrpath'
+     )
+ envs = {}
+ for var in import_env:
+-- 
+1.9.0
+
diff --git a/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch b/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
new file mode 100644
index 00000000000..f12d7a52ba0
--- /dev/null
+++ b/pkgs/servers/gpsd/0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
@@ -0,0 +1,28 @@
+From aed93b6ada5b9b76b85d11d9bad732ca005295af 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 86b94bc..a0b3d25 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -216,6 +216,7 @@ import_env = (
+     'STAGING_DIR',     # Required by the OpenWRT and CeroWrt builds.
+     'STAGING_PREFIX',  # Required by the OpenWRT and CeroWrt builds.
+     '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:
+-- 
+1.9.0
+
diff --git a/pkgs/servers/gpsd/default.nix b/pkgs/servers/gpsd/default.nix
index 25051167ca5..ae0656cb644 100644
--- a/pkgs/servers/gpsd/default.nix
+++ b/pkgs/servers/gpsd/default.nix
@@ -1,28 +1,61 @@
-{ fetchurl, stdenv, pythonPackages, pkgconfig, dbus, dbus_glib
+{ fetchurl, stdenv, scons, pythonFull, pkgconfig, dbus, dbus_glib
 , ncurses, libX11, libXt, libXpm, libXaw, libXext, makeWrapper
 , libusb1, docbook_xml_dtd_412, docbook_xsl, bc
-, libxslt, xmlto, gpsdUser ? "gpsd" }:
+, libxslt, xmlto, gpsdUser ? "gpsd", gpsdGroup ? "dialout"
+}:
+
+# TODO: the 'xgps' program doesn't work: "ImportError: No module named gobject"
+# TODO: put the X11 deps behind a guiSupport parameter for headless support
 
 stdenv.mkDerivation rec {
-  name = "gpsd-2.95";
+  name = "gpsd-3.10";
 
   src = fetchurl {
-    url = "http://download.berlios.de/gpsd/${name}.tar.gz";
-    sha256 = "1bjhyjg561kwp6zc2wg58njdvpnsj5yaa2slz8g3ga1176jl68w3";
+    url = "http://download-mirror.savannah.gnu.org/releases/gpsd/${name}.tar.gz";
+    sha256 = "0823hl5zgwnbgm0fq3i4z34lv76cpj0k6m0zjiygiyrxrz0w4vvh";
   };
 
-  nativeBuildInputs = [ makeWrapper pkgconfig docbook_xml_dtd_412 docbook_xsl
-    xmlto bc pythonPackages.wrapPython ];
+  nativeBuildInputs = [
+    scons makeWrapper pkgconfig docbook_xml_dtd_412 docbook_xsl xmlto bc
+    pythonFull
+  ];
 
-  pythonPath = [ pythonPackages.curses ];
+  buildInputs = [
+    pythonFull dbus dbus_glib ncurses libX11 libXt libXpm libXaw libXext
+    libxslt libusb1
+  ];
 
-  buildInputs = [ pythonPackages.python dbus dbus_glib ncurses libX11 libXt
-    libXpm libXaw libXext libxslt libusb1 ];
+  patches = [
+    ./0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
+    ./0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
+  ];
 
-  configureFlags = "--enable-static --enable-dbus --enable-gpsd-user=${gpsdUser}";
+  # - leapfetch=no disables going online at build time to fetch leap-seconds
+  #   info. See <gpsd-src>/build.txt for more info.
+  # - chrpath=no stops the build from using 'chrpath' (which we don't have).
+  #   'chrpath' is used to be able to run the tests from the source tree, but
+  #   we use $LD_LIBRARY_PATH instead.
+  buildPhase = ''
+    mkdir -p "$out"
+    sed -e "s|python_lib_dir = .*|python_lib_dir = \"$out/lib/${pythonFull.python.libPrefix}/site-packages\"|" -i SConstruct
+    scons prefix="$out" leapfetch=no gpsd_user=${gpsdUser} gpsd_group=${gpsdGroup} \
+        systemd=yes udevdir="$out/lib/udev" chrpath=no
+  '';
 
   doCheck = true;
 
+  checkPhase = ''
+    export LD_LIBRARY_PATH="$PWD"
+    scons check
+  '';
+
+  # TODO: the udev rules file and the hotplug script need fixes to work on NixOS
+  installPhase = ''
+    scons install
+    mkdir -p "$out/lib/udev/rules.d"
+    scons udev-install
+  '';
+
   postInstall = "wrapPythonPrograms";
 
   meta = {