[vifir] fix compile against gpsd 2.96
Tom Callaway
spot at fedoraproject.org
Tue Aug 23 17:46:22 UTC 2011
commit 8008b3954d232ba7812492c76521f3696d0af7d6
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date: Tue Aug 23 13:46:09 2011 -0400
fix compile against gpsd 2.96
vifir-0.9-gpsd-2.96.patch | 77 +++++++++++++++++++++++++++++++++++++++++++++
vifir.spec | 27 ++++++----------
2 files changed, 87 insertions(+), 17 deletions(-)
---
diff --git a/vifir-0.9-gpsd-2.96.patch b/vifir-0.9-gpsd-2.96.patch
new file mode 100644
index 0000000..c0ae675
--- /dev/null
+++ b/vifir-0.9-gpsd-2.96.patch
@@ -0,0 +1,77 @@
+diff -up vifir-0.9/src/GPS.cpp.gpsd296 vifir-0.9/src/GPS.cpp
+--- vifir-0.9/src/GPS.cpp.gpsd296 2010-10-12 08:36:14.000000000 -0400
++++ vifir-0.9/src/GPS.cpp 2011-08-23 13:38:54.465863249 -0400
+@@ -54,14 +54,22 @@ bool GPS::Activate() {
+ {
+ case Config::gpsd:
+ /* gpsd.mainframe.cx:2947 and gpsd.rellim.com:2947 have gpsd data sources we can connect to for testing */
++#if GPSD_API_MAJOR_VERSION >= 5
++ if (!gps_open (Cfg->GetgpsdHost().c_str(),Cfg->GetgpsdPort().c_str(), &gpsdata_buf)) {
++ gpsddata = &gpsdata_buf;
++ } else {
++ gpsddata = NULL;
++ }
++#else
+ gpsddata=gps_open(Cfg->GetgpsdHost().c_str(),Cfg->GetgpsdPort().c_str());
++#endif
+ if (!gpsddata) {
+ fprintf(stderr,"Failure in gps_open(%s,%s)\n",Cfg->GetgpsdHost().c_str(),Cfg->GetgpsdPort().c_str());
+ return false;
+ }
+ #if GPSD_API_MAJOR_VERSION==3
+ gps_query(gpsddata,"w+x\n");
+-#elif GPSD_API_MAJOR_VERSION==4
++#elif GPSD_API_MAJOR_VERSION>=4
+ gps_stream(gpsddata, WATCH_ENABLE, NULL);
+ #else
+ # error Unsupported GPSd library version
+@@ -91,7 +99,11 @@ void GPS::Deactivate() {
+ #ifdef HAVE_LIBGPS
+ if (gpsddata) {
+ gps_close(gpsddata);
++#if GPSD_API_MAJOR_VERSION >= 5
++ delete gpsddata;
++#else
+ gpsddata=NULL;
++#endif
+ }
+ ActiveFlag=false;
+ #endif
+@@ -129,14 +141,24 @@ bool GPS::GetFix(double *Lon, double *La
+ if ((pfd.revents|POLLIN)==POLLIN) {
+ int result;
+ errno=0;
++#if GPSD_API_MAJOR_VERSION >= 5
++ result=gps_read(gpsddata);
++ if (result > 0)
++ result=0;
++#else
+ result=gps_poll(gpsddata);
++#endif
+ if (result!=0) {
+ if (errno==0) {
+ /* Connection to gpsd closed */
+ fprintf(stderr,"Connection to gpsd lost.\n");
+ } else {
+ /* Read error */
++#if GPSD_API_MAJOR_VERSION >= 5
++ perror("gps_read()");
++#else
+ perror("gps_poll()");
++#endif
+ }
+ Deactivate();
+ return false;
+diff -up vifir-0.9/src/GPS.h.gpsd296 vifir-0.9/src/GPS.h
+--- vifir-0.9/src/GPS.h.gpsd296 2010-05-23 00:10:44.000000000 -0400
++++ vifir-0.9/src/GPS.h 2011-08-23 13:37:18.403202488 -0400
+@@ -47,6 +47,9 @@ public:
+ private:
+ #ifdef HAVE_LIBGPS
+ gps_data_t *gpsddata;
++#if GPSD_API_MAJOR_VERSION >= 5
++ gps_data_t gpsdata_buf;
++#endif
+ pthread_t handler;
+ #endif
+ bool ActiveFlag;
diff --git a/vifir.spec b/vifir.spec
index 31ddcd4..fa96e53 100644
--- a/vifir.spec
+++ b/vifir.spec
@@ -1,19 +1,12 @@
-%global name vifir
-%global version 0.9
-%global release 1%{?dist}
-%global _prefix /usr
-
-Name: %{name}
-Version: %{version}
-Release: %{release}
+Name: vifir
+Version: 0.9
+Release: 2%{?dist}
Summary: A viewer for electronic aviation charts
-
Group: Applications/Communications
License: GPLv3
URL: http://vifir.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
+Patch0: vifir-0.9-gpsd-2.96.patch
BuildRequires: gtkmm24-devel
BuildRequires: gpsd-devel
BuildRequires: libgeotiff-devel
@@ -42,6 +35,7 @@ Bag.
%prep
%setup -q
+%patch0 -p1 -b .gpsd296
%build
@@ -51,7 +45,6 @@ make %{?_smp_mflags}
%install
-rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALL="install -p"
desktop-file-install \
--delete-original \
@@ -59,12 +52,7 @@ desktop-file-install \
%{buildroot}%{_datadir}/applications/%{name}.desktop
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING DEVELOPERS README THANKS TODO
%{_bindir}/%{name}
%{_bindir}/llepdftopng
@@ -74,6 +62,11 @@ rm -rf %{buildroot}
%changelog
+* Tue Aug 23 2011 Tom Callaway <spot at fedoraproject.org> - 0.9-2
+- cleanup spec file (I have no idea how it got past review with those
+ redundant globals)
+- enable gpsd 2.96+ support
+
* Sun Jul 31 2011 Dave Ludlow <dave at adsllc.com> - 0.9-1
- Fix off-by-one error causing a crash upon loading a chart
More information about the scm-commits
mailing list