From cb25c93663ce2b1ef7cf43ae5024ef1e564a2637 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 25 Mar 2011 20:30:55 +0000 Subject: - Chase astro/gpsd shlib version bump - Add patches required for compatibility with new version of libgps Submitted by: glebius Tested by: glebius --- astro/foxtrotgps/Makefile | 4 +- astro/foxtrotgps/files/patch-src-gps_functions.c | 94 ++++++++++++++++++++++ astro/marble/Makefile | 3 +- ...lugins-positionprovider-gpsd-GpsdConnection.cpp | 64 +++++++++++++++ astro/viking/Makefile | 3 +- astro/viking/files/patch-configure | 50 ++++++++++++ astro/viking/files/patch-src-vikgpslayer.c | 81 +++++++++++++++++++ 7 files changed, 295 insertions(+), 4 deletions(-) create mode 100644 astro/foxtrotgps/files/patch-src-gps_functions.c create mode 100644 astro/marble/files/patch-marble-src-plugins-positionprovider-gpsd-GpsdConnection.cpp create mode 100644 astro/viking/files/patch-configure create mode 100644 astro/viking/files/patch-src-vikgpslayer.c (limited to 'astro') diff --git a/astro/foxtrotgps/Makefile b/astro/foxtrotgps/Makefile index 9f61a39c8806..db8a9eebfdbb 100644 --- a/astro/foxtrotgps/Makefile +++ b/astro/foxtrotgps/Makefile @@ -7,7 +7,7 @@ PORTNAME= foxtrotgps PORTVERSION= 1.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= astro geography MASTER_SITES= http://www.foxtrotgps.org/releases/ @@ -17,7 +17,7 @@ COMMENT= A lightweight opensource gps moving map application LIB_DEPENDS= curl.6:${PORTSDIR}/ftp/curl \ exif.12:${PORTSDIR}/graphics/libexif \ soup-2.4.1:${PORTSDIR}/devel/libsoup \ - gps.19:${PORTSDIR}/astro/gpsd + gps.20:${PORTSDIR}/astro/gpsd USE_AUTOTOOLS= automake aclocal libtool autoconf ACLOCAL_ARGS= --force diff --git a/astro/foxtrotgps/files/patch-src-gps_functions.c b/astro/foxtrotgps/files/patch-src-gps_functions.c new file mode 100644 index 000000000000..8af3e957381c --- /dev/null +++ b/astro/foxtrotgps/files/patch-src-gps_functions.c @@ -0,0 +1,94 @@ +--- src/gps_functions.c.orig 2011-03-22 21:11:33.000000000 +0300 ++++ src/gps_functions.c 2011-03-22 21:58:20.000000000 +0300 +@@ -31,7 +31,8 @@ + + + static GIOChannel *gpsd_io_channel =NULL; +-static struct gps_data_t *libgps_gpsdata = NULL; ++static struct gps_data_t libgps_gpsdata; ++static int libgps_initialized = 0; + + static guint sid1, sid3; + guint watchdog; +@@ -699,9 +700,7 @@ + gpsdata = NULL; + g_source_remove(sid1); + g_source_remove(sid3); +- gps_close(libgps_gpsdata); +- libgps_gpsdata = NULL; +- ++ gps_close(&libgps_gpsdata); + + return FALSE; + } +@@ -713,28 +712,28 @@ + { + int ret; + +- if (libgps_gpsdata == NULL) ++ if (libgps_initialized == 0) + return FALSE; + +- ret = gps_poll(libgps_gpsdata); +- if (ret == 0) ++ ret = gps_read(&libgps_gpsdata); ++ if (ret > 0) + { +- gpsdata->satellites_used = libgps_gpsdata->satellites_used; +- gpsdata->hdop = libgps_gpsdata->dop.hdop; +- gpsdata->fix.time = libgps_gpsdata->fix.time; ++ gpsdata->satellites_used = libgps_gpsdata.satellites_used; ++ gpsdata->hdop = libgps_gpsdata.dop.hdop; ++ gpsdata->fix.time = libgps_gpsdata.fix.time; + if (isnan(gpsdata->fix.time)) + { + gpsdata->fix.time = (time_t) 0; + } +- gpsdata->valid = (libgps_gpsdata->status != STATUS_NO_FIX); ++ gpsdata->valid = (libgps_gpsdata.status != STATUS_NO_FIX); + if (gpsdata->valid) + { + gpsdata->seen_vaild = TRUE; +- gpsdata->fix.latitude = libgps_gpsdata->fix.latitude; +- gpsdata->fix.longitude = libgps_gpsdata->fix.longitude; +- gpsdata->fix.speed = libgps_gpsdata->fix.speed; +- gpsdata->fix.heading = libgps_gpsdata->fix.track; +- gpsdata->fix.altitude = libgps_gpsdata->fix.altitude; ++ gpsdata->fix.latitude = libgps_gpsdata.fix.latitude; ++ gpsdata->fix.longitude = libgps_gpsdata.fix.longitude; ++ gpsdata->fix.speed = libgps_gpsdata.fix.speed; ++ gpsdata->fix.heading = libgps_gpsdata.fix.track; ++ gpsdata->fix.altitude = libgps_gpsdata.fix.altitude; + } + + g_source_remove(watchdog); +@@ -758,11 +757,11 @@ + void * + get_gps_thread(void *ptr) + { +- libgps_gpsdata = gps_open(global_server, global_port); +- if (libgps_gpsdata) ++ if (gps_open(global_server, global_port, &libgps_gpsdata) == 0) + { + fprintf(stderr, "connection to gpsd SUCCEEDED \n"); +- ++ ++ libgps_initialized = 1; + global_reconnect_gpsd = FALSE; + + if(!gpsdata) +@@ -771,12 +770,12 @@ + } + + +- gps_stream(libgps_gpsdata, WATCH_ENABLE | POLL_NONBLOCK, NULL); ++ gps_stream(&libgps_gpsdata, WATCH_ENABLE, NULL); + + watchdog = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT_IDLE,60,reset_gpsd_io,NULL,NULL); + + +- gpsd_io_channel = g_io_channel_unix_new(libgps_gpsdata->gps_fd); ++ gpsd_io_channel = g_io_channel_unix_new(libgps_gpsdata.gps_fd); + g_io_channel_set_flags(gpsd_io_channel, G_IO_FLAG_NONBLOCK, NULL); + + diff --git a/astro/marble/Makefile b/astro/marble/Makefile index bad76caccdce..99159668483f 100644 --- a/astro/marble/Makefile +++ b/astro/marble/Makefile @@ -7,6 +7,7 @@ PORTNAME= marble PORTVERSION= ${KDE4_VERSION} +PORTREVISION= 1 CATEGORIES= astro kde MASTER_SITES= ${MASTER_SITE_KDE} MASTER_SITE_SUBDIR= ${KDE4_BRANCH}/${PORTVERSION}/src @@ -16,7 +17,7 @@ DIST_SUBDIR= KDE MAINTAINER= kde@FreeBSD.org COMMENT= Virtual globe and world atlas for KDE -LIB_DEPENDS= gps.19:${PORTSDIR}/astro/gpsd +LIB_DEPENDS= gps.20:${PORTSDIR}/astro/gpsd CONFLICTS= kdeedu-4.5.[0-5] diff --git a/astro/marble/files/patch-marble-src-plugins-positionprovider-gpsd-GpsdConnection.cpp b/astro/marble/files/patch-marble-src-plugins-positionprovider-gpsd-GpsdConnection.cpp new file mode 100644 index 000000000000..68a5b9dea204 --- /dev/null +++ b/astro/marble/files/patch-marble-src-plugins-positionprovider-gpsd-GpsdConnection.cpp @@ -0,0 +1,64 @@ +--- ./marble/src/plugins/positionprovider/gpsd/GpsdConnection.cpp.orig 2011-03-22 18:32:49.000000000 +0300 ++++ ./marble/src/plugins/positionprovider/gpsd/GpsdConnection.cpp 2011-03-22 19:24:18.000000000 +0300 +@@ -18,7 +18,8 @@ + + GpsdConnection::GpsdConnection( QObject* parent ) + : QObject( parent ), +- m_timer( 0 ) ++ m_timer( 0 ), ++ m_gpsd("localhost", DEFAULT_GPSD_PORT) + { + connect( &m_timer, SIGNAL( timeout() ), this, SLOT( update() ) ); + } +@@ -26,15 +27,15 @@ + void GpsdConnection::initialize() + { + m_timer.stop(); +- gps_data_t* data = m_gpsd.open(); +- if ( data ) { ++#if 0 /* I don't see error handling in the new libgpsmm API */ ++ if ( m_gpsd.to_user != NULL ) { ++#endif + m_status = PositionProviderStatusAcquiring; + emit statusChanged( m_status ); + +-#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 3 ) && defined( WATCH_ENABLE ) + m_gpsd.stream( WATCH_ENABLE ); +-#endif + m_timer.start( 1000 ); ++#if 0 + } + else { + // There is also gps_errstr() for libgps version >= 2.90, +@@ -68,28 +69,17 @@ + + mDebug() << "Connection to gpsd failed, no position info available: " << m_error; + } ++#endif + } + + void GpsdConnection::update() + { +-#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 3 ) && defined( PACKET_SET ) +- if ( m_gpsd.waiting() ) { +- gps_data_t* data = m_gpsd.poll(); ++ if ( m_gpsd.waiting(5000000) ) { ++ gps_data_t* data = m_gpsd.read(); + if ( data && data->set & PACKET_SET ) { + emit gpsdInfo( *data ); + } + } +-#else +- gps_data_t* data = m_gpsd.query( "o" ); +- +- if ( data ) { +- emit gpsdInfo( *data ); +- } +- else if ( m_status != PositionProviderStatusAcquiring ) { +- mDebug() << "Lost connection to gpsd, trying to re-open."; +- initialize(); +- } +-#endif + } + + QString GpsdConnection::error() const diff --git a/astro/viking/Makefile b/astro/viking/Makefile index e0ea82f0e928..f945535f0311 100644 --- a/astro/viking/Makefile +++ b/astro/viking/Makefile @@ -7,6 +7,7 @@ PORTNAME= viking PORTVERSION= 1.1 +PORTREVISION= 1 CATEGORIES= astro MASTER_SITES= SF @@ -31,7 +32,7 @@ OPTIONS= GPSD "Enable realtime GPS tracking" off .include .if defined(WITH_GPSD) -LIB_DEPENDS+= gps.19:${PORTSDIR}/astro/gpsd +LIB_DEPENDS+= gps.20:${PORTSDIR}/astro/gpsd .else CONFIGURE_ARGS+= --disable-realtime-gps-tracking .endif diff --git a/astro/viking/files/patch-configure b/astro/viking/files/patch-configure new file mode 100644 index 000000000000..e94e6601666d --- /dev/null +++ b/astro/viking/files/patch-configure @@ -0,0 +1,50 @@ +--- configure.orig 2011-03-22 22:22:02.000000000 +0300 ++++ configure 2011-03-22 22:22:13.000000000 +0300 +@@ -8239,9 +8239,9 @@ + $as_echo "$ac_cv_enable_realtimegpstracking" >&6; } + case $ac_cv_enable_realtimegpstracking in + yes) +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gps_poll in -lgps" >&5 +-$as_echo_n "checking for gps_poll in -lgps... " >&6; } +-if test "${ac_cv_lib_gps_gps_poll+set}" = set; then : ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gps_read in -lgps" >&5 ++$as_echo_n "checking for gps_read in -lgps... " >&6; } ++if test "${ac_cv_lib_gps_gps_read+set}" = set; then : + $as_echo_n "(cached) " >&6 + else + ac_check_lib_save_LIBS=$LIBS +@@ -8255,27 +8255,27 @@ + #ifdef __cplusplus + extern "C" + #endif +-char gps_poll (); ++char gps_read (); + int + main () + { +-return gps_poll (); ++return gps_read (); + ; + return 0; + } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_gps_gps_poll=yes ++ ac_cv_lib_gps_gps_read=yes + else +- ac_cv_lib_gps_gps_poll=no ++ ac_cv_lib_gps_gps_read=no + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gps_gps_poll" >&5 +-$as_echo "$ac_cv_lib_gps_gps_poll" >&6; } +-if test "x$ac_cv_lib_gps_gps_poll" = x""yes; then : ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gps_gps_read" >&5 ++$as_echo "$ac_cv_lib_gps_gps_read" >&6; } ++if test "x$ac_cv_lib_gps_gps_read" = x""yes; then : + cat >>confdefs.h <<_ACEOF + #define HAVE_LIBGPS 1 + _ACEOF diff --git a/astro/viking/files/patch-src-vikgpslayer.c b/astro/viking/files/patch-src-vikgpslayer.c new file mode 100644 index 000000000000..8aafc3f98126 --- /dev/null +++ b/astro/viking/files/patch-src-vikgpslayer.c @@ -0,0 +1,81 @@ +--- src/vikgpslayer.c.orig 2011-03-22 22:23:24.000000000 +0300 ++++ src/vikgpslayer.c 2011-03-22 22:45:18.000000000 +0300 +@@ -1308,7 +1308,7 @@ + + } + +-static void gpsd_raw_hook(VglGpsd *vgpsd, gchar *data) ++static void gpsd_raw_hook(VglGpsd *vgpsd) + { + gboolean update_all = FALSE; + VikGpsLayer *vgl = vgpsd->vgl; +@@ -1376,10 +1376,14 @@ + static gboolean gpsd_data_available(GIOChannel *source, GIOCondition condition, gpointer data) + { + VikGpsLayer *vgl = data; ++ int nread; ++ + if (condition == G_IO_IN) { +- if (!gps_poll(&vgl->vgpsd->gpsd)) ++ if ((nread = gps_read(&vgl->vgpsd->gpsd)) >= 0) { ++ if (nread) ++ gpsd_raw_hook(vgl->vgpsd); + return TRUE; +- else { ++ } else { + g_warning("Disconnected from gpsd. Trying to reconnect"); + rt_gpsd_disconnect(vgl); + rt_gpsd_connect(vgl, FALSE); +@@ -1407,23 +1411,15 @@ + static gboolean rt_gpsd_try_connect(gpointer *data) + { + VikGpsLayer *vgl = (VikGpsLayer *)data; +-#ifndef HAVE_GPS_OPEN_R +- struct gps_data_t *gpsd = gps_open(vgl->gpsd_host, vgl->gpsd_port); + +- if (gpsd == NULL) { +-#else + vgl->vgpsd = g_malloc(sizeof(VglGpsd)); + +- if (gps_open_r(vgl->gpsd_host, vgl->gpsd_port, /*(struct gps_data_t *)*/vgl->vgpsd) != 0) { +-#endif ++ if (gps_open(vgl->gpsd_host, vgl->gpsd_port, (struct gps_data_t *)vgl->vgpsd) != 0) { + g_warning("Failed to connect to gpsd at %s (port %s). Will retry in %d seconds", + vgl->gpsd_host, vgl->gpsd_port, vgl->gpsd_retry_interval); + return TRUE; /* keep timer running */ + } + +-#ifndef HAVE_GPS_OPEN_R +- vgl->vgpsd = realloc(gpsd, sizeof(VglGpsd)); +-#endif + vgl->vgpsd->vgl = vgl; + + vgl->realtime_fix.dirty = vgl->last_fix.dirty = FALSE; +@@ -1439,15 +1435,10 @@ + vik_trw_layer_add_track(vtl, vgl->realtime_track_name, vgl->realtime_track); + } + +- gps_set_raw_hook(&vgl->vgpsd->gpsd, gpsd_raw_hook); + vgl->realtime_io_channel = g_io_channel_unix_new(vgl->vgpsd->gpsd.gps_fd); + vgl->realtime_io_watch_id = g_io_add_watch( vgl->realtime_io_channel, + G_IO_IN | G_IO_ERR | G_IO_HUP, gpsd_data_available, vgl); +-#if HAVE_GPS_STREAM + gps_stream(&vgl->vgpsd->gpsd, WATCH_ENABLE, NULL); +-#else +- gps_query(&vgl->vgpsd->gpsd, "w+x"); +-#endif + return FALSE; /* no longer called by timeout */ + } + +@@ -1501,11 +1492,7 @@ + } + if (vgl->vgpsd) { + gps_close(&vgl->vgpsd->gpsd); +-#ifdef HAVE_GPS_OPEN_R + g_free(vgl->vgpsd); +-#else +- free(vgl->vgpsd); +-#endif + vgl->vgpsd = NULL; + } + -- cgit v1.2.3