gpsd: Use official backport recipe from meta-oe/master

BugzID: 67798
This commit is contained in:
Alexandre Bard 2021-01-05 12:36:44 +01:00
parent 17b7f134d8
commit ddec09b25f
8 changed files with 302 additions and 145 deletions

View File

@ -1,47 +0,0 @@
From 9b84789c22bec237835cbee24a26e028730c4c0e Mon Sep 17 00:00:00 2001
From: Lucien Mueller <lucien.mueller@netmodule.com>
Date: Fri, 21 Feb 2020 17:48:24 +0100
Subject: [PATCH] Revert "Fix the handling of defaults from the environment."
This reverts commit d0e0864c2802860ff561fe0b39939b63d38b8c70.
---
SConstruct | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/SConstruct b/SConstruct
index 5169d8f64..46c78a959 100644
--- a/SConstruct
+++ b/SConstruct
@@ -383,21 +383,21 @@ env['SC_PYTHON'] = sys.executable # Path to SCons Python
# with multi-word CPPFLAGS/LDFLAGS/SHLINKFLAGS values; you'll have to
# explicitly quote them or (better yet) use the "=" form of GNU option
# settings.
-# Scons also uses different internal names than most other build-systems.
-# So we rely on MergeFlags/ParseFlags to do the right thing for us.
env['STRIP'] = "strip"
env['PKG_CONFIG'] = "pkg-config"
-for i in ["AR", "CC", "CXX", "LD",
- "PKG_CONFIG", "STRIP", "TAR"]:
+for i in ["AR", "ARFLAGS", "CC", "CCFLAGS", "CFLAGS", "CXX", "CXXFLAGS", "LD",
+ "LINKFLAGS", "PKG_CONFIG", "STRIP", "TAR"]:
if i in os.environ:
j = i
if i == "LD":
i = "SHLINK"
- env[i] = os.getenv(j)
-for i in ["ARFLAGS", "CFLAGS", "CXXFLAGS", "LDFLAGS", "SHLINKFLAGS",
- "CPPFLAGS", "CCFLAGS", "LINKFLAGS"]:
+ if i in ("CFLAGS", "CCFLAGS", "LINKFLAGS"):
+ env.Replace(**{j: Split(os.getenv(i))})
+ else:
+ env.Replace(**{j: os.getenv(i)})
+for flag in ["LDFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
if i in os.environ:
- env.MergeFlags(Split(os.getenv(i)))
+ env.MergeFlags({flag: Split(os.getenv(flag))})
# Keep scan-build options in the environment
--
2.24.0.rc1

View File

@ -1 +0,0 @@
KERNEL=="ttyACM?", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", SYMLINK+="gps0"

View File

@ -0,0 +1,108 @@
Subject: [PATCH] Revert "SConstruct: Add test for sizeof(time_t), result in
SIZEOF_TIME_T."
This reverts commit b32ff1a86c44fa738dabaf63de1b5462e0071ad3.
Upstream-Status: Inappropriate [cross-compile specific]
---
SConstruct | 54 ++++--------------------------------------
android/gpsd_config.in | 1 -
2 files changed, 5 insertions(+), 50 deletions(-)
diff --git a/SConstruct b/SConstruct
index 33e0ff326..e3c62fa3c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -597,42 +597,6 @@ def CheckHeaderDefines(context, file, define):
return ret
-def CheckSizeOf(context, type):
- """Check sizeof 'type'"""
- context.Message('Checking size of ' + type + '... ')
-
- program = """
-#include <stdlib.h>
-#include <stdio.h>
-
-/*
- * The CheckSizeOf function does not have a way for the caller to
- * specify header files to be included to provide the type being
- * checked. As a workaround until that is remedied, include the
- * header required for time_t, which is the sole current use of this
- * function.
- */
-#include <time.h>
-
-int main() {
- printf("%d", (int)sizeof(""" + type + """));
- return 0;
-}
-"""
-
- # compile it
- ret = context.TryCompile(program, '.c')
- if 0 == ret:
- announce('ERROR: TryCompile failed\n')
- # fall back to sizeof(time_t) is 8
- return '8'
-
- # run it
- ret = context.TryRun(program, '.c')
- context.Result(ret[0])
- return ret[1]
-
-
def CheckCompilerDefines(context, define):
context.Message('Checking if compiler supplies %s... ' % (define,))
ret = context.TryLink("""
@@ -703,15 +667,13 @@ env.Prepend(LIBPATH=[os.path.realpath(os.curdir)])
# CheckXsltproc works, but result is incorrectly saved as "no"
config = Configure(env, custom_tests={
- 'CheckC11': CheckC11,
- 'CheckCompilerDefines': CheckCompilerDefines,
- 'CheckCompilerOption': CheckCompilerOption,
- 'CheckHeaderDefines': CheckHeaderDefines,
'CheckPKG': CheckPKG,
- 'CheckSizeOf': CheckSizeOf,
'CheckXsltproc': CheckXsltproc,
- 'GetPythonValue': GetPythonValue,
- })
+ 'CheckCompilerOption': CheckCompilerOption,
+ 'CheckCompilerDefines': CheckCompilerDefines,
+ 'CheckC11': CheckC11,
+ 'CheckHeaderDefines': CheckHeaderDefines,
+ 'GetPythonValue': GetPythonValue})
# Use print, rather than announce, so we see it in -s mode.
print("This system is: %s" % sys.platform)
@@ -1043,12 +1005,6 @@ else:
confdefs.append("/* #undef HAVE_%s_H */\n"
% hdr.replace("/", "_").upper())
- sizeof_time_t = config.CheckSizeOf("time_t")
- confdefs.append("#define SIZEOF_TIME_T %s\n" % sizeof_time_t)
- announce("sizeof(time_t) is %s" % sizeof_time_t)
- if 4 >= int(sizeof_time_t):
- announce("WARNING: time_t is too small. It will fail in 2038")
-
# check function after libraries, because some function require libraries
# for example clock_gettime() require librt on Linux glibc < 2.17
for f in ("cfmakeraw", "clock_gettime", "daemon", "fcntl", "fork",
diff --git a/android/gpsd_config.in b/android/gpsd_config.in
index 758251986..d240f6d34 100644
--- a/android/gpsd_config.in
+++ b/android/gpsd_config.in
@@ -19,7 +19,6 @@
#define HAVE_ARPA_INET_H 1
#define HAVE_SYSLOG_H 1
#define HAVE_DAEMON 1
-#define SIZEOF_TIME_T 8
#define HAVE_CLOCK_GETTIME 1
#define HAVE_STRPTIME 1
#define HAVE_GMTIME_R 1
--
2.26.2

View File

@ -1,8 +1,8 @@
From ff5af0adedb788f3a7be581e203516ae3f4a2ae9 Mon Sep 17 00:00:00 2001
From 5464d9e1bfd1a1c54338ec7c4148cad1b222ef93 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Tue, 24 Apr 2012 18:45:14 +0200
Subject: [PATCH 2/6] SConstruct: prefix includepy with sysroot and drop
sysroot from python_lib_dir
Subject: [PATCH] SConstruct: prefix includepy with sysroot and drop sysroot
from python_lib_dir
* without PYTHONPATH, distutil's sysconfig returns INCLUDEPY without sysroot prefix
and with PYTHONPATH from OE it's pointing to native python dir
@ -34,15 +34,16 @@ Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
---
SConstruct | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/SConstruct b/SConstruct
index 6c0b9b998..cd2a10c86 100644
index b8f3fb1..883e06d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1127,7 +1127,7 @@ else:
@@ -980,7 +980,7 @@ else:
# Set up configuration for target Python
@ -51,7 +52,7 @@ index 6c0b9b998..cd2a10c86 100644
PYTHON_CONFIG_NAMES = ['CC', 'CXX', 'OPT', 'BASECFLAGS',
'CCSHARED', 'LDSHARED', 'SO', 'INCLUDEPY', 'LDFLAGS']
@@ -1674,7 +1674,7 @@ else:
@@ -1506,7 +1506,7 @@ else:
LINK=ldshared,
SHLIBPREFIX="",
SHLIBSUFFIX=python_config['SO'],
@ -60,7 +61,7 @@ index 6c0b9b998..cd2a10c86 100644
CPPFLAGS=python_config['OPT'],
CFLAGS=python_config['BASECFLAGS'],
CXXFLAGS=python_config['BASECFLAGS'])
@@ -1994,12 +1994,14 @@ if ((not env['debug'] and not env['profiling'] and not env['nostrip'] and
@@ -1808,12 +1808,14 @@ if ((not env['debug'] and not env['profiling'] and not env['nostrip'] and
env.AddPostAction(binaryinstall, '$STRIP $TARGET')
if env['python']:
@ -76,6 +77,3 @@ index 6c0b9b998..cd2a10c86 100644
python_modules_install = python_env.Install(DESTDIR + python_module_dir,
python_modules)
--
2.24.0.rc1

View File

@ -1,37 +0,0 @@
From 2a4b3bcde0d73a3a4a6644d5f944ac9d16023ba9 Mon Sep 17 00:00:00 2001
From: Adrian Bunk <bunk@stusta.de>
Date: Mon, 21 Oct 2019 13:53:25 +0300
Subject: gps_shm_close: Free privdata
Previously every open/close cycle leaked privdata.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Gary E. Miller <gem@rellim.com>
Upstream-Status: Backport
---
libgps_shm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libgps_shm.c b/libgps_shm.c
index d93972bba..12bb3760b 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -163,8 +163,12 @@ int gps_shm_read(struct gps_data_t *gpsdata)
void gps_shm_close(struct gps_data_t *gpsdata)
{
- if (PRIVATE(gpsdata) && PRIVATE(gpsdata)->shmseg != NULL)
- (void)shmdt((const void *)PRIVATE(gpsdata)->shmseg);
+ if (PRIVATE(gpsdata)) {
+ if (PRIVATE(gpsdata)->shmseg != NULL)
+ (void)shmdt((const void *)PRIVATE(gpsdata)->shmseg);
+ free(PRIVATE(gpsdata));
+ gpsdata->privdata = NULL;
+ }
}
int gps_shm_mainloop(struct gps_data_t *gpsdata, int timeout,
--
2.20.1

View File

@ -0,0 +1,158 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: gpsd
# Required-Start: $remote_fs $syslog $network
# Should-Start: bluetooth dbus udev
# Required-Stop: $remote_fs $syslog $network
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Start-Before: ntp
# Short-Description: GPS (Global Positioning System) daemon start/stop script
# Description: Start/Stop script for the gpsd service daemon,
# which is able to monitor one or more GPS devices
# connected to a host computer, making all data on
# the location and movements of the sensors available
# to be queried on TCP port 2947.
### END INIT INFO
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="GPS (Global Positioning System) daemon"
NAME="gpsd"
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
. /etc/init.d/functions || exit 1
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
if [ -z "$GPSD_SOCKET" ] && [ -z "$DEVICES" ]; then
GPSD_SOCKET=/var/run/gpsd.sock
fi
if [ -n "$GPSD_SOCKET" ]; then
GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET"
fi
DAEMON_ARGS="$GPSD_OPTIONS $DEVICES"
#
# Function that starts the daemon/service
#
do_start() {
local status pid
status=0
pid=`pidofproc $NAME` || status=$?
case $status in
0)
echo "$DESC already running ($pid)."
exit 1
;;
*)
echo "Starting $DESC ..."
exec $DAEMON $DAEMON_ARGS >/dev/null 2>&1 || status=$?
echo "ERROR: Failed to start $DESC."
exit $status
;;
esac
}
#
# Function that stops the daemon/service
#
do_stop() {
local pid status
status=0
pid=`pidofproc $NAME` || status=$?
case $status in
0)
# Exit when fail to stop, the kill would complain when fail
kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
echo "Stopped $DESC ($pid)." || exit $?
;;
*)
echo "$DESC is not running; none killed." >&2
;;
esac
return $status
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
local pid status
status=0
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
pid=`pidofproc $NAME` || status=$?
case $status in
0)
echo "Reloading $DESC ..."
kill -s 1 $pid || exit $?
;;
*)
echo "$DESC is not running; none reloaded." >&2
;;
esac
exit $status
}
#
# Function that shows the daemon/service status
#
status_of_proc () {
local pid status
status=0
# pidof output null when no program is running, so no "2>/dev/null".
pid=`pidofproc $NAME` || status=$?
case $status in
0)
echo "$DESC is running ($pid)."
exit 0
;;
*)
echo "$DESC is not running." >&2
exit $status
;;
esac
}
case "$1" in
start)
do_start
;;
stop)
do_stop || exit $?
;;
status)
status_of_proc
;;
restart)
# Always start the service regardless the status of do_stop
do_stop
do_start
;;
force-reload)
# Only start the service when do_stop succeeds
do_stop && do_start
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

View File

@ -1,38 +1,12 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
RDEPENDS_${PN} += "python3-pyserial"
SRC_URI_prepend = " \
git://gitlab.com/netmodule/third-party/gpsd.git;protocol=ssh;user=git;branch=3.20/netmodule \
file://60-ublox-neo.rules \
file://0001-Revert-Fix-the-handling-of-defaults-from-the-environ.patch \
"
SRC_URI_remove = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz"
# overwrite default gpsd.service file with our configuration
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
SYSTEMD_SERVICE_${PN} += "${BPN}.service \
"
TTY_DEVICE = "/dev/gnss0"
USBAUTO_STATE = "false"
do_install_append () {
install -d ${D}${sysconfdir}/udev/rules.d
install -m 0644 ${WORKDIR}/60-ublox-neo.rules ${D}${sysconfdir}/udev/rules.d
sed -i 's|DEVICES=""|DEVICES="${TTY_DEVICE}"|g' ${D}/etc/default/gpsd.default
sed -i 's|USBAUTO="true"|USBAUTO="${USBAUTO_STATE}"|g' ${D}/etc/default/gpsd.default
}
# workaround for receipe backport: gpsd 3.19 is installing shared object files in different
# place than expect.
do_install_append() {
install -p ${D}/usr/lib/gps/*.so ${D}/usr/lib/python2.7/site-packages/gps/
}
do_install_append_am335x-nmhw21() {
sed -i "s/GPSD_OPTIONS=\"\(.*\)\"/GPSD_OPTIONS=\"\1 -s 115200\"/g" ${D}${sysconfdir}/default/gpsd.default
}

View File

@ -1,17 +1,21 @@
# NB: Backport from meta-oe/master
SUMMARY = "A TCP/IP Daemon simplifying the communication with GPS devices"
SECTION = "console/network"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=01764c35ae34d9521944bb6ab312af53"
DEPENDS = "dbus ncurses python python3 pps-tools"
DEPENDS = "dbus ncurses python3 pps-tools"
PROVIDES = "virtual/gpsd"
SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
file://0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch \
file://0001-Revert-SConstruct-Add-test-for-sizeof-time_t-result-.patch \
file://gpsd.init \
"
SRC_URI[md5sum] = "b3bf88706794eb8e5f2c2543bf7ba87b"
SRC_URI[sha256sum] = "27dd24d45b2ac69baab7933da2bf6ae5fb0be90130f67e753c110a3477155f39"
SRC_URI[md5sum] = "cf7fdec7ce7221d20bee1a7246362b05"
SRC_URI[sha256sum] = "172a7805068eacb815a3c5225436fcb0be46e7e49a5001a94034eac43df85e50"
inherit scons update-rc.d python-dir pythonnative systemd update-alternatives
inherit scons update-rc.d python3-dir python3native systemd update-alternatives
INITSCRIPT_PACKAGES = "gpsd-conf"
INITSCRIPT_NAME = "gpsd"
@ -22,6 +26,8 @@ SYSTEMD_OESCONS = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'f
export STAGING_INCDIR
export STAGING_LIBDIR
CLEANBROKEN = "1"
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} usb"
PACKAGECONFIG[bluez] = "bluez='true',bluez='false',bluez5"
PACKAGECONFIG[qt] = "qt='yes' qt_versioned=5,qt='no',qtbase"
@ -34,8 +40,8 @@ EXTRA_OESCONS = " \
systemd='${SYSTEMD_OESCONS}' \
libdir='${libdir}' \
manbuild='false' \
LINK='${CC}' \
${PACKAGECONFIG_CONFARGS} \
python_libdir=${libdir} \
"
# this cannot be used, because then chrpath is not found and only static lib is built
# target=${HOST_SYS}
@ -44,21 +50,26 @@ do_compile_prepend() {
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
export STAGING_PREFIX="${STAGING_DIR_HOST}/${prefix}"
export LD="${CC}"
export LINKFLAGS="${LDFLAGS}"
}
do_install_prepend() {
do_install() {
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
export STAGING_PREFIX="${STAGING_DIR_HOST}/${prefix}"
export LD="${CC}"
export LINKFLAGS="${LDFLAGS}"
export DESTDIR="${D}"
# prefix is used for RPATH and DESTDIR/prefix for instalation
${STAGING_BINDIR_NATIVE}/scons prefix=${prefix} python_libdir=${libdir} install ${EXTRA_OESCONS} || \
bbfatal "scons install execution failed."
}
do_install_append() {
install -d ${D}/${sysconfdir}/init.d
install -m 0755 ${S}/packaging/deb/etc_init.d_gpsd ${D}/${sysconfdir}/init.d/gpsd
install -m 0755 ${WORKDIR}/gpsd.init ${D}/${sysconfdir}/init.d/gpsd
install -d ${D}/${sysconfdir}/default
install -m 0644 ${S}/packaging/deb/etc_default_gpsd ${D}/${sysconfdir}/default/gpsd.default
@ -81,14 +92,7 @@ do_install_append() {
install -m 0644 ${S}/systemd/${BPN}.socket ${D}${systemd_unitdir}/system/${BPN}.socket
}
# Copying gps library to python3 site-packages.
# This can only be done in postinst because it is not possible to get both
# python3 and python2 site-packages at build time.
pkg_postinst_python-pygps() {
cp -r $D/${PYTHON_SITEPACKAGES_DIR}/gps $D/${libdir}/python3*/site-packages
}
PACKAGES =+ "libgps libgpsd python-pygps gpsd-udev gpsd-conf gpsd-gpsctl gps-utils"
PACKAGES =+ "libgps libgpsd python3-pygps gpsd-udev gpsd-conf gpsd-gpsctl gps-utils"
RPROVIDES_${PN}-dbg += "python-pygps-dbg"
@ -118,17 +122,17 @@ FILES_gpsd-gpsctl = "${bindir}/gpsctl"
SUMMARY_gps-utils = "Utils used for simulating, monitoring,... a GPS"
# Python files are required for gps/fake, required for gpsfake.
FILES_gps-utils = "${bindir}/* ${libdir}/gps/*.py ${libdir}/gps/*.so"
RDEPENDS_gps-utils = "python-pygps"
RDEPENDS_gps-utils = "python3-pygps"
SUMMARY_python-pygps = "Python bindings to gpsd"
FILES_python-pygps = "${PYTHON_SITEPACKAGES_DIR}/* ${libdir}/gps/*.py ${libdir}/*.egg-info"
RDEPENDS_python-pygps = " \
python-core \
python-io \
python-threading \
python-terminal \
SUMMARY_python3-pygps = "Python bindings to gpsd"
FILES_python3-pygps = "${PYTHON_SITEPACKAGES_DIR}/* ${libdir}/gps/*.py ${libdir}/*.egg-info"
RDEPENDS_python3-pygps = " \
python3-core \
python3-io \
python3-threading \
python3-terminal \
gpsd \
python-json"
python3-json"
RPROVIDES_${PN} += "${PN}-systemd"
RREPLACES_${PN} += "${PN}-systemd"