Patchwork Patch gpsd-2.95 for avr32

login
register
mail settings
Submitter Simon Dawson
Date April 11, 2012, 10:27 a.m.
Message ID <1334140031-29576-1-git-send-email-spdawson@gmail.com>
Download mbox | patch
Permalink /patch/151752/
State Superseded
Headers show

Comments

Simon Dawson - April 11, 2012, 10:27 a.m.
gpsd does not compile for avr32, due to use of finite() rather than
isfinite(). See, for example, random buildroot test
build b7c357dddd7c1f749813035ddbee731d233c59b8

Signed-off-by: Simon Dawson <spdawson@gmail.com>
---
 package/gpsd/gpsd-2.95-c99-math.patch.avr32 |   53 +++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 package/gpsd/gpsd-2.95-c99-math.patch.avr32
Thomas Petazzoni - April 11, 2012, 10:40 a.m.
Hello,

Le Wed, 11 Apr 2012 11:27:11 +0100,
spdawson@gmail.com a écrit :

> gpsd does not compile for avr32, due to use of finite() rather than
> isfinite(). See, for example, random buildroot test
> build b7c357dddd7c1f749813035ddbee731d233c59b8

Thanks Simon. I haven't investigated this particular problem. Do you
know why it would be avr32-specific?

Moreover, gpsd 2.95 is quite ancient, the latest version is 3.4, and it
has this problem fixed (see
http://git.savannah.gnu.org/cgit/gpsd.git/commit/pseudonmea.c?id=3b00bd2e71d277283062ed83078de9741a4a8b98).
However, it looks like gpsd is now using Scons as its builds system, so
bumping to 3.4 will require quite a bit of work on gpsd.mk.

Regards,

Thomas
Simon Dawson - April 11, 2012, 11:26 a.m.
> Thanks Simon. I haven't investigated this particular problem. Do you
> know why it would be avr32-specific?

No, I don't know why the problem should be avr32-specific. (The
package builds for arm without the patch, incidentally.)

> Moreover, gpsd 2.95 is quite ancient, the latest version is 3.4, and it
> has this problem fixed (see
> http://git.savannah.gnu.org/cgit/gpsd.git/commit/pseudonmea.c?id=3b00bd2e71d277283062ed83078de9741a4a8b98).
> However, it looks like gpsd is now using Scons as its builds system, so
> bumping to 3.4 will require quite a bit of work on gpsd.mk.

Yes, I realised that it would be non-trivial to just bump the gpsd
version in buildroot. Is the avr32 patch therefore an acceptable
short-term solution to the build problem?

Patch

diff --git a/package/gpsd/gpsd-2.95-c99-math.patch.avr32 b/package/gpsd/gpsd-2.95-c99-math.patch.avr32
new file mode 100644
index 0000000..54161d5
--- /dev/null
+++ b/package/gpsd/gpsd-2.95-c99-math.patch.avr32
@@ -0,0 +1,53 @@ 
+Replace calls to finite() with calls to isfinite(), so that gpsd-2.95 will
+compile for avr32.
+
+N.B. It will not be necessary to patch later releases of gpsd, where the
+finite() -> isfinite() replacement has already been made.
+
+Signed-off-by: Simon Dawson <spdawson at gmail.com>
+---
+
+diff -Nur a/libgpsd_core.c b/libgpsd_core.c
+--- a/libgpsd_core.c	2010-06-11 20:45:37.000000000 +0100
++++ b/libgpsd_core.c	2012-04-11 11:09:42.154508993 +0100
+@@ -545,18 +545,18 @@
+     gpsd_report(LOG_DATA, "modeling errors: mode=%d, masks=%s\n",
+ 		fix->mode, gpsd_maskdump(session->gpsdata.set));
+     if (fix->mode >= MODE_2D) {
+-	if (isnan(fix->epx) != 0 && finite(session->gpsdata.dop.hdop) != 0)
++	if (isnan(fix->epx) != 0 && isfinite(session->gpsdata.dop.hdop) != 0)
+ 	    fix->epx = session->gpsdata.dop.xdop * h_uere;
+ 
+-	if (isnan(fix->epy) != 0 && finite(session->gpsdata.dop.hdop) != 0)
++	if (isnan(fix->epy) != 0 && isfinite(session->gpsdata.dop.hdop) != 0)
+ 	    fix->epy = session->gpsdata.dop.ydop * h_uere;
+ 
+ 	if ((fix->mode >= MODE_3D)
+-	    && isnan(fix->epv) != 0 && finite(session->gpsdata.dop.vdop) != 0)
++	    && isnan(fix->epv) != 0 && isfinite(session->gpsdata.dop.vdop) != 0)
+ 	    fix->epv = session->gpsdata.dop.vdop * v_uere;
+ 
+ 	if (isnan(session->gpsdata.epe) != 0
+-	    && finite(session->gpsdata.dop.pdop) != 0)
++	    && isfinite(session->gpsdata.dop.pdop) != 0)
+ 	    session->gpsdata.epe = session->gpsdata.dop.pdop * p_uere;
+ 	else
+ 	    session->gpsdata.epe = NAN;
+diff -Nur a/pseudonmea.c b/pseudonmea.c
+--- a/pseudonmea.c	2010-06-02 22:03:02.000000000 +0100
++++ b/pseudonmea.c	2012-04-11 11:09:58.686508257 +0100
+@@ -215,10 +215,10 @@
+ 	nmea_add_checksum(bufp2);
+ 	bufp += strlen(bufp);
+     }
+-    if (finite(session->gpsdata.fix.epx)
+-	&& finite(session->gpsdata.fix.epy)
+-	&& finite(session->gpsdata.fix.epv)
+-	&& finite(session->gpsdata.epe)) {
++    if (isfinite(session->gpsdata.fix.epx)
++	&& isfinite(session->gpsdata.fix.epy)
++	&& isfinite(session->gpsdata.fix.epv)
++	&& isfinite(session->gpsdata.epe)) {
+ 	struct tm tm;
+ 	time_t intfixtime;
+