gpsd: merge upstream (#436)

Co-authored-by: zhengmz <zhengmz@flowsea.com>
This commit is contained in:
zhengmz 2022-05-07 20:33:18 +08:00 committed by GitHub
parent d1500ae414
commit 88c3ff214b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 167 additions and 27 deletions

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gpsd
PKG_VERSION:=3.21
PKG_VERSION:=3.23.1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME)
PKG_HASH:=5512a7d3c2e86be83c5555652e5b4cc9049e8878a4320be7f039eb1a7203e5f0
PKG_HASH:=ca2c466df783c57b8a07ad3f5c67943186d05befdc377de938ed111d1358a8c1
PKG_MAINTAINER:=Pushpal Sidhu <psidhu.devel@gmail.com>
PKG_LICENSE:=BSD-3-Clause
@ -87,6 +87,7 @@ define Package/libgps
SECTION:=libs
CATEGORY:=Libraries
TITLE:=C service library for communicating with the GPS daemon
ABI_VERSION:=29
endef
define Package/libgps/description
@ -99,6 +100,7 @@ SCONS_VARS += \
LINKFLAGS="$(TARGET_LDFLAGS)"
SCONS_OPTIONS += \
target_platform=linux \
dbus_export=no \
tsip=no \
fv18=no \
@ -157,7 +159,7 @@ endef
define Package/libgps/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps.so.* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps.so.$(ABI_VERSION)* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,gpsd))

View File

@ -1,19 +0,0 @@
--- a/SConstruct
+++ b/SConstruct
@@ -42,7 +42,6 @@ import re
import subprocess
import sys
import time
-from distutils import sysconfig
import SCons
@@ -303,7 +302,7 @@ EnsureSConsVersion(2, 3, 0)
EnsurePythonVersion(2, 6)
-PYTHON_SYSCONFIG_IMPORT = 'from distutils import sysconfig'
+PYTHON_SYSCONFIG_IMPORT = ''
# Utility productions

View File

@ -1,11 +1,9 @@
--- a/SConstruct
+++ b/SConstruct
@@ -1068,6 +1068,10 @@ else:
--- a/SConscript
+++ b/SConscript
@@ -1038,6 +1038,8 @@ if not cleaning and not helping:
ncurseslibs += pkg_config('tinfo', rpath_hack=True)
# It's not yet known whether rpath_hack is appropriate for
# ncurses5-config.
+ elif WhereIs('ncurses6-config'):
+ ncurseslibs = ['!ncurses6-config --libs --cflags']
+ elif WhereIs('ncursesw6-config'):
+ ncurseslibs = ['!ncursesw6-config --libs --cflags']
elif WhereIs('ncurses5-config'):

View File

@ -0,0 +1,159 @@
Backported from:
https://gitlab.com/gpsd/gpsd/-/commit/28fb46ac70059d3b0eb64041c35ef83027bd8506
https://gitlab.com/gpsd/gpsd/-/commit/c5ed9736d859fed0682e60e899e9617ac67da11b
From c2b4d3fb9a9e011bdc2fb891b78c6ce13f0c7101 Mon Sep 17 00:00:00 2001
From: "Sergey V. Lobanov" <sergey@lobanov.in>
Date: Mon, 24 Jan 2022 16:01:54 -0800
Subject: [PATCH] SConscript: Add target_platform config option.
This patch adds an ability to redefine target platform using config
optiont target_platform=<platform> to support cross-platform compilation.
This allows cross cimpileg for openWRT (target_platform=linux) on
osX (sys.platform() == darwin)
Signed-off-by: Gary E. Miller <gem@rellim.com>
---
SConscript | 41 +++++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 14 deletions(-)
--- a/SConscript
+++ b/SConscript
@@ -52,6 +52,7 @@ EnsurePythonVersion(2, 6)
# e.g. "scons-3" on CentOS 8.
scons_executable_name = os.path.basename(sys.argv[0]) or 'scons'
+
# Have scons rebuild an existing target when the source(s) MD5 changes
# Do not use time to prevent rebuilding when sources, like gpsd_config.h,
# are rebuilt, but with no changes.
@@ -351,6 +352,7 @@ boolopts = (
("gpsdclients", True, "gspd client programs"),
("gpsd", True, "gpsd itself"),
("implicit_link", imloads, "implicit linkage is supported in shared libs"),
+ # FIXME: should check for Pi, not for "linux"
("magic_hat", sys.platform.startswith('linux'),
"special Linux PPS hack for Raspberry Pi et al"),
("minimal", False, "turn off every option not set on the command line"),
@@ -410,6 +412,10 @@ nonboolopts = (
"Prefix to the binary tools to use (gcc, ld, etc.)\n"
"For cross-compiling, or building with multiple local toolchains.\n"
),
+ # If build and target platform are different, then redefining target
+ # platform might be necessary to use better build flags
+ ("target_platform", sys.platform,
+ "target platform for cross-compiling (linux, darwin, etc.)"),
("target_python", def_target_python, "target Python version as command"),
)
@@ -878,13 +884,16 @@ have_valgrind = False
# per SCons 4.0.1 doc: Section 23.9. Not Configuring When Cleaning Targets
if not cleaning and not helping:
# OS X aliases gcc to clang
+ if (sys.platform != config.env['target_platform']):
+ announce("Target system is: %s" % config.env['target_platform'])
+
announce("cc is %s, version %s" % (env['CC'], env['CCVERSION']))
# clang accepts -pthread, then warns it is unused.
if not config.CheckCC():
announce("ERROR: CC doesn't work")
if ((config.CheckCompilerOption("-pthread") and
- not sys.platform.startswith('darwin'))):
+ not config.env['target_platform'].startswith('darwin'))):
config.env.MergeFlags("-pthread")
confdefs = ["/* gpsd_config.h generated by scons, do not hand-hack. */\n"]
@@ -935,7 +944,7 @@ if not cleaning and not helping:
# confdefs.append('#endif\n')
# Reinstated for FreeBSD (below) 16-Aug-2019
- if sys.platform.startswith('linux'):
+ if config.env['target_platform'].startswith('linux'):
# for cfmakeraw(), strsep(), etc. on CentOS 7
# glibc 2.19 and before
# sets __USE_MISC
@@ -947,7 +956,7 @@ if not cleaning and not helping:
confdefs.append('#if !defined(_GNU_SOURCE)')
confdefs.append('#define _GNU_SOURCE 1')
confdefs.append('#endif\n')
- elif sys.platform.startswith('darwin'):
+ elif config.env['target_platform'].startswith('darwin'):
# strlcpy() and SIGWINCH need _DARWIN_C_SOURCE
confdefs.append('#if !defined(_DARWIN_C_SOURCE)')
confdefs.append('#define _DARWIN_C_SOURCE 1\n')
@@ -962,7 +971,7 @@ if not cleaning and not helping:
"-Wl,-compatibility_version,%s" % libgps_version,
"-Wl,-install_name,%s/$TARGET.srcpath" %
installdir('libdir', add_destdir=False)]
- elif sys.platform.startswith('freebsd'):
+ elif config.env['target_platform'].startswith('freebsd'):
# for isascii(), putenv(), nice(), strptime()
confdefs.append('#if !defined(_XOPEN_SOURCE)')
confdefs.append('#define _XOPEN_SOURCE 700')
@@ -975,7 +984,7 @@ if not cleaning and not helping:
confdefs.append('#if !defined(__BSD_VISIBLE)')
confdefs.append("#define __BSD_VISIBLE 1\n")
confdefs.append('#endif\n')
- elif sys.platform.startswith('openbsd'):
+ elif config.env['target_platform'].startswith('openbsd'):
# required to define u_int in sys/time.h
confdefs.append('#if !defined(_BSD_SOURCE)')
confdefs.append("#define _BSD_SOURCE 1\n")
@@ -984,12 +993,12 @@ if not cleaning and not helping:
confdefs.append('#if !defined(__BSD_VISIBLE)')
confdefs.append("#define __BSD_VISIBLE 1\n")
confdefs.append('#endif\n')
- elif sys.platform.startswith('netbsd'):
+ elif config.env['target_platform'].startswith('netbsd'):
# required to get strlcpy(), and more, from string.h
confdefs.append('#if !defined(_NETBSD_SOURCE)')
confdefs.append("#define _NETBSD_SOURCE 1\n")
confdefs.append('#endif\n')
- elif sys.platform.startswith('sunos5'):
+ elif config.env['target_platform'].startswith('sunos5'):
# tested with gcc-5.5 on slowlaris 10
# required to get isascii(), and more, from ctype.h
confdefs.append('#if !defined(__XPG4_CHAR_CLASS__)')
@@ -1044,11 +1053,11 @@ if not cleaning and not helping:
ncurseslibs = ['!ncurses5-config --libs --cflags']
elif WhereIs('ncursesw5-config'):
ncurseslibs = ['!ncursesw5-config --libs --cflags']
- elif sys.platform.startswith('freebsd'):
+ elif config.env['target_platform'].startswith('freebsd'):
ncurseslibs = ['-lncurses']
- elif (sys.platform.startswith('darwin') or
- sys.platform.startswith('openbsd') or
- sys.platform.startswith('sunos5')):
+ elif (config.env['target_platform'].startswith('darwin') or
+ config.env['target_platform'].startswith('openbsd') or
+ config.env['target_platform'].startswith('sunos5')):
ncurseslibs = ['-lcurses']
else:
announce('Turning off ncurses support, library not found.')
@@ -1064,7 +1073,8 @@ if not cleaning and not helping:
announce("pkg_config is confused about the state "
"of libusb-1.0.")
usbflags = []
- elif sys.platform.startswith("freebsd"):
+ elif config.env['target_platform'].startswith('freebsd'):
+ # FIXME: shold directly test for libusb existence.
confdefs.append("#define HAVE_LIBUSB 1\n")
usbflags = ["-lusb"]
else:
@@ -2498,8 +2508,11 @@ if qt_env:
binaryinstall.append(GPSLibraryInstall(qt_env, installdir('libdir'),
compiled_qgpsmmlib, libgps_version))
-if ((not env['debug'] and not env['debug_opt'] and not env['profiling'] and
- not env['nostrip'] and not sys.platform.startswith('darwin'))):
+if ((not env['debug'] and
+ not env['debug_opt'] and
+ not env['profiling'] and
+ not env['nostrip'] and
+ not env['target_platform'].startswith('darwin'))):
env.AddPostAction(binaryinstall, '$STRIP $TARGET')
binaryinstall.append(env.Install(installdir('bindir'), bin_scripts))