Browse Source

olsrd: update to 0.9.8

Waldemar Brodkorb 3 months ago
parent
commit
7f5bc912ea

+ 7 - 6
package/olsrd/Makefile

@@ -4,16 +4,17 @@
 include ${ADK_TOPDIR}/rules.mk
 
 PKG_NAME:=		olsrd
-PKG_VERSION:=		0.9.0.3
+PKG_VERSION:=		0.9.8
 PKG_RELEASE:=		1
-PKG_HASH:=		59d37570c58ec25636a71d5a7cf4460448be693f01d768ae369a7f66e58077fb
+PKG_HASH:=		ee9e524224e5d5304dcf61f1dc5485c569da09d382934ff85b233be3e24821a3
 PKG_DESCR:=		optimized link state routing protocol daemon
 PKG_SECTION:=		net/wifi
-PKG_URL:=		http://www.olsr.org/
-PKG_SITES:=		http://www.olsr.org/releases/0.9/
+PKG_BUILDDEP:=		gpsd
+PKG_DEPENDS:=		gpsd
+PKG_SITES:=		https://github.com/OLSR/olsrd/archive/refs/tags/
 PKG_NOPARALLEL:=	1
 
-DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.gz
+DISTFILES:=		v${PKG_VERSION}.tar.gz
 
 PKG_SUBPKGS:=		OLSRD OLSRD_MOD_DYN_GW OLSRD_MOD_HTTPINFO
 PKG_SUBPKGS+=		OLSRD_MOD_NAMESERVICE OLSRD_MOD_TAS
@@ -53,7 +54,7 @@ CONFIG_STYLE:=          manual
 TARGET_CFLAGS+=		-fPIC -D_GNU_SOURCE
 ALL_TARGET+=		libs
 INSTALL_TARGET+=	install_libs
-MAKE_ENV+=		OS="linux" DEBUG=0 STRIP="true" OFLAGS="${TARGET_CFLAGS}" prefix="/usr"
+MAKE_ENV+=		OS="linux" DEBUG=0 STRIP="true" VERBOSE=1 OFLAGS="${TARGET_CFLAGS}" prefix="/usr"
 
 post-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m}
 	${INSTALL_DIR} ${IDIR_OLSRD}/usr/sbin ${IDIR_OLSRD}/etc/olsrd

+ 11 - 0
package/olsrd/patches/patch-lib_pud_Makefile

@@ -0,0 +1,11 @@
+--- olsrd-0.9.8.orig/lib/pud/Makefile	2019-08-11 10:09:47.000000000 +0200
++++ olsrd-0.9.8/lib/pud/Makefile	2024-02-29 11:26:30.299243074 +0100
+@@ -108,7 +108,7 @@ endif
+ 
+ default_target: nmealib library $(PLUGIN_FULLNAME)
+ 
+-$(PLUGIN_FULLNAME): $(OBJS) version-script.txt
++$(PLUGIN_FULLNAME): $(OBJS) version-script.txt nmealib
+ ifeq ($(PUD_NMEALIB_STATICALLY_LINKED),)
+ ifeq ($(VERBOSE),0)
+ 	@echo "[LD] $@ (nmealib dynamically linked)"

+ 98 - 0
package/olsrd/patches/patch-lib_pud_src_gpsdclient_c

@@ -0,0 +1,98 @@
+--- olsrd-0.9.8.orig/lib/pud/src/gpsdclient.c	2019-08-11 10:09:47.000000000 +0200
++++ olsrd-0.9.8/lib/pud/src/gpsdclient.c	2024-02-29 11:26:48.195242832 +0100
+@@ -79,6 +79,23 @@ static void gpsdError(const char *s) {
+   syslog(LOG_ERR, "gpsd error: %s", s);
+ }
+ 
++#if GPSD_API_MAJOR_VERSION >= 9
++static double time_as_double(struct timespec *ts) {
++ return (ts->tv_sec + ts->tv_nsec * 1e-9);
++}
++
++static bool is_online(struct gps_data_t *gpsdata) {
++  return !!gpsdata->online.tv_sec;
++}
++#else
++
++#define time_as_double(x) *(x)
++
++static bool is_online(struct gps_data_t *gpsdata) {
++  return !!gpsdata->online;
++}
++#endif
++
+ /* standard parsing of a GPS data source spec */
+ void gpsdParseSourceSpec(char *arg, GpsDaemon *gpsDaemon) {
+   if (!arg //
+@@ -298,8 +315,8 @@ void nmeaInfoFromGpsd(struct gps_data_t
+             8, //
+             dev->parity, //
+             dev->stopbits, //
+-            dev->cycle, //
+-            dev->mincycle);
++            time_as_double(&dev->cycle), //
++            time_as_double(&dev->mincycle));
+ 
+         connectionTracking->devSeen[i] = true;
+         connectionTracking->dev[i] = *dev;
+@@ -353,11 +370,6 @@ void nmeaInfoFromGpsd(struct gps_data_t
+           );
+ 
+   gpsdata->set &= ~STATUS_SET; /* always valid */
+-  if (gpsdata->status == STATUS_NO_FIX) {
+-    nmeaInfoClear(info);
+-    nmeaTimeSet(&info->utc, &info->present, NULL);
+-    return;
+-  }
+ 
+   if (!gpsdata->set) {
+     return;
+@@ -367,11 +379,18 @@ void nmeaInfoFromGpsd(struct gps_data_t
+   nmeaInfoSetPresent(&info->present, NMEALIB_PRESENT_SMASK);
+ 
+   /* date & time */
++#if GPSD_API_MAJOR_VERSION >= 9
++  if (gpsdata->fix.time.tv_sec > 0) {
++    struct tm *time = gmtime(&gpsdata->fix.time.tv_sec);
++    unsigned int hsec = (unsigned int) (gpsdata->fix.time.tv_nsec / 10000000);
++#else
+   if (!isNaN(gpsdata->fix.time)) {
+     double seconds;
+     double fraction = modf(fabs(gpsdata->fix.time), &seconds);
+     long sec = lrint(seconds);
+     struct tm *time = gmtime(&sec);
++    unsigned int hsec = (unsigned int) lrint(fraction * 100);
++#endif
+     if (time) {
+       info->utc.year = (unsigned int) time->tm_year + 1900;
+       info->utc.mon = (unsigned int) time->tm_mon + 1;
+@@ -379,7 +398,7 @@ void nmeaInfoFromGpsd(struct gps_data_t
+       info->utc.hour = (unsigned int) time->tm_hour;
+       info->utc.min = (unsigned int) time->tm_min;
+       info->utc.sec = (unsigned int) time->tm_sec;
+-      info->utc.hsec = (unsigned int) lrint(fraction * 100);
++      info->utc.hsec = hsec;
+ 
+       nmeaInfoSetPresent(&info->present, NMEALIB_PRESENT_UTCDATE | NMEALIB_PRESENT_UTCTIME);
+     }
+@@ -387,7 +406,7 @@ void nmeaInfoFromGpsd(struct gps_data_t
+   gpsdata->set &= ~TIME_SET;
+ 
+   /* sig & fix */
+-  if (!gpsdata->online) {
++  if (!is_online(gpsdata)) {
+     gpsdata->fix.mode = MODE_NO_FIX;
+   }
+ 
+@@ -454,7 +473,11 @@ void nmeaInfoFromGpsd(struct gps_data_t
+   if ((gpsdata->fix.mode >= MODE_3D) //
+       && !isNaN(gpsdata->fix.altitude)) {
+     info->elevation = gpsdata->fix.altitude;
++#if GPSD_API_MAJOR_VERSION >= 9
++    info->height = gpsdata->fix.geoid_sep;
++#else
+     info->height = gpsdata->separation;
++#endif
+     nmeaInfoSetPresent(&info->present, NMEALIB_PRESENT_ELV | NMEALIB_PRESENT_HEIGHT);
+   }
+   gpsdata->set &= ~ALTITUDE_SET;

+ 16 - 0
package/olsrd/patches/patch-lib_pud_src_gpsdclient_h

@@ -0,0 +1,16 @@
+--- olsrd-0.9.8.orig/lib/pud/src/gpsdclient.h	2019-08-11 10:09:47.000000000 +0200
++++ olsrd-0.9.8/lib/pud/src/gpsdclient.h	2024-02-29 11:24:18.019244869 +0100
+@@ -60,13 +60,6 @@ struct GpsdConnectionState {
+     struct devconfig_t dev[MAXUSERDEVS];
+ };
+ 
+-/* describe a data source */
+-struct fixsource_t {
+-    char spec[PATH_MAX]; /* working space, will be modified */
+-    char *server; /* pointer into spec field */
+-    char *port; /* pointer into spec field */
+-    char *device; /* pointer into spec field */
+-};
+ 
+ /**
+  * The gpsd daemon spec

+ 17 - 0
package/olsrd/patches/patch-src_cfgparser_local_mk

@@ -0,0 +1,17 @@
+--- olsrd-0.9.8.orig/src/cfgparser/local.mk	2019-08-11 10:09:47.000000000 +0200
++++ olsrd-0.9.8/src/cfgparser/local.mk	2024-02-29 09:47:24.131323729 +0100
+@@ -74,12 +74,8 @@ $(C)oparse.c: $(C)oparse.y $(C)olsrd_con
+ ifeq ($(VERBOSE),0)
+ 	@echo "[BISON] $@"
+ endif
+-	$(MAKECMDPREFIX)$(BISON) -d -o "$@-tmp" "$<"
+-	$(MAKECMDPREFIX)sed	-e 's/register //' \
+-		-e '/^#line/s/$(call quote,$@-tmp)/$(call quote,$@)/' \
+-		< "$@-tmp" >"$@"
+-	$(MAKECMDPREFIX)mv "$(subst .c,.h,$@-tmp)" "$(subst .c,.h,$@)"
+-	$(MAKECMDPREFIX)$(RM) "$@-tmp" "$(subst .c,.h,$@-tmp)"
++	$(MAKECMDPREFIX)$(BISON) -d -o "$@" "$<"
++	$(MAKECMDPREFIX)sed -e 's/register //' "$@" > "$@.o" && mv "$@.o" "$@"
+ 
+ $(C)oparse.o: CFLAGS := $(filter-out -Wunreachable-code,$(CFLAGS))
+