mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH v2] gpsd: version bump 3.19 -> 3.20
Date: Sun, 9 Feb 2020 17:59:04 +0100	[thread overview]
Message-ID: <20200209165904.GA334775@lenoch> (raw)

gpsd-3.20 removed a few config options, so remove them from KConfig.

As gpsd project does not do bugfix releases, pick build fixes
from git.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Changes:
 -v2: add patches from gpsd git... :-/

 ...Fix-python-binding-cross-compilation.patch |  96 ----------
 patches/gpsd-3.19/series                      |   5 -
 ...ce-custom-CheckSizeOf-with-standard-.patch |  74 ++++++++
 ...s-install-xpgs-xgpsspeed-programs-ma.patch | 148 +++++++++++++++
 ...s-install-xgps-.-Only-test-if-deps-f.patch | 108 +++++++++++
 ...sizeof-time_t-test-when-cross-compil.patch |  39 ++++
 ...ix-merging-and-using-of-python-flags.patch |  45 +++++
 ...-Remove-redundant-CheckHeaderDefines.patch |  52 ++++++
 ...emove-redundant-CheckCompilerDefines.patch |  67 +++++++
 ...thonValue-and-CheckPKG-were-using-wr.patch |  44 +++++
 ...ruct-Fix-GetPythonValue-for-python-3.patch |  57 ++++++
 ...move-more-checks-into-GetPythonValue.patch |  98 ++++++++++
 ...-target-python-version-not-scons-pyt.patch |  32 ++++
 ...ify-GetPythonValue-.-It-now-caches-p.patch | 174 ++++++++++++++++++
 ...3-SConstruct-fix-polystr-for-python2.patch |  34 ++++
 ...arget_python-when-constructing-exten.patch |  36 ++++
 ...truct-Search-for-ncursesw-pkgconfig.patch} |   8 +-
 ...SConstruct-HACK-use-target-INCLUDEPY.patch |  25 +++
 patches/gpsd-3.20/series                      |  20 ++
 rules/gpsd.in                                 |  28 +--
 rules/gpsd.make                               |  21 +--
 21 files changed, 1066 insertions(+), 145 deletions(-)
 delete mode 100644 patches/gpsd-3.19/0002-Fix-python-binding-cross-compilation.patch
 delete mode 100644 patches/gpsd-3.19/series
 create mode 100644 patches/gpsd-3.20/0001-SConstruct-replace-custom-CheckSizeOf-with-standard-.patch
 create mode 100644 patches/gpsd-3.20/0002-SConstruct-Always-install-xpgs-xgpsspeed-programs-ma.patch
 create mode 100644 patches/gpsd-3.20/0003-SConstruct-Always-install-xgps-.-Only-test-if-deps-f.patch
 create mode 100644 patches/gpsd-3.20/0004-SConstruct-Skip-sizeof-time_t-test-when-cross-compil.patch
 create mode 100644 patches/gpsd-3.20/0005-Fix-merging-and-using-of-python-flags.patch
 create mode 100644 patches/gpsd-3.20/0006-SConstruct-Remove-redundant-CheckHeaderDefines.patch
 create mode 100644 patches/gpsd-3.20/0007-SConstruct-remove-redundant-CheckCompilerDefines.patch
 create mode 100644 patches/gpsd-3.20/0008-SConstruct-GetPythonValue-and-CheckPKG-were-using-wr.patch
 create mode 100644 patches/gpsd-3.20/0009-SConstruct-Fix-GetPythonValue-for-python-3.patch
 create mode 100644 patches/gpsd-3.20/0010-SConstruct-move-more-checks-into-GetPythonValue.patch
 create mode 100644 patches/gpsd-3.20/0011-SConstruct-Check-target-python-version-not-scons-pyt.patch
 create mode 100644 patches/gpsd-3.20/0012-SConstruct-Simplify-GetPythonValue-.-It-now-caches-p.patch
 create mode 100644 patches/gpsd-3.20/0013-SConstruct-fix-polystr-for-python2.patch
 create mode 100644 patches/gpsd-3.20/0100-SConstruct-Use-target_python-when-constructing-exten.patch
 rename patches/{gpsd-3.19/0001-Search-for-ncursesw-pkgconfig.patch => gpsd-3.20/0101-SConstruct-Search-for-ncursesw-pkgconfig.patch} (79%)
 create mode 100644 patches/gpsd-3.20/0102-SConstruct-HACK-use-target-INCLUDEPY.patch
 create mode 100644 patches/gpsd-3.20/series

diff --git a/patches/gpsd-3.19/0002-Fix-python-binding-cross-compilation.patch b/patches/gpsd-3.19/0002-Fix-python-binding-cross-compilation.patch
deleted file mode 100644
index 94a4810f6..000000000
--- a/patches/gpsd-3.19/0002-Fix-python-binding-cross-compilation.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From: Ladislav Michl <ladis@linux-mips.org>
-Date: Wed, 30 Oct 2019 11:47:28 +0100
-Subject: [PATCH] Fix python binding cross-compilation
-
----
- SConstruct | 48 +++++++++++++++++++++---------------------------
- 1 file changed, 21 insertions(+), 27 deletions(-)
-
-diff --git a/SConstruct b/SConstruct
-index 7bd5b08f2a46..4895b659ba49 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -440,6 +440,10 @@ def announce(msg):
-     if not env.GetOption("silent"):
-         print(msg)
- 
-+if env['sysroot']:
-+    sysroot = env['sysroot']
-+else:
-+    sysroot = ''
- 
- # DESTDIR environment variable means user prefix the installation root.
- DESTDIR = os.environ.get('DESTDIR', '')
-@@ -454,12 +458,6 @@ def installdir(dir, add_destdir=True):
-     wrapped.replace("/usr/lib/systemd", "/lib/systemd")
-     return wrapped
- 
--
--# Honor the specified installation prefix in link paths.
--if env["sysroot"]:
--    env.Prepend(LIBPATH=[env["sysroot"] + installdir('libdir',
--                add_destdir=False)])
--
- # Give deheader a way to set compiler flags
- if 'MORECFLAGS' in os.environ:
-     env.Append(CFLAGS=Split(os.environ['MORECFLAGS']))
-@@ -513,11 +511,6 @@ if env['target']:
-     for (name, toolname) in devenv:
-         env[name] = env['target'] + '-' + toolname
- 
--if env['sysroot']:
--    env.MergeFlags({"CFLAGS": ["--sysroot=%s" % env['sysroot']]})
--    env.MergeFlags({"LINKFLAGS": ["--sysroot=%s" % env['sysroot']]})
--
--
- # Build help
- def cmp(a, b):
-     return (a > b) - (a < b)
-@@ -1156,22 +1149,23 @@ if helping:
- 
- else:
- 
--    if config.env['python'] and config.env['target_python']:
--        try:
--            config.CheckProg
--        except AttributeError:  # Older scons versions don't have CheckProg
--            target_python_path = config.env['target_python']
--        else:
--            target_python_path = config.CheckProg(config.env['target_python'])
--        if not target_python_path:
--            announce("Target Python doesn't exist - disabling Python.")
--            config.env['python'] = False
-     if config.env['python']:
--        # Maximize consistency by using the reported sys.executable
--        target_python_path = config.GetPythonValue('exe path',
--                                                   'import sys',
--                                                   'sys.executable',
--                                                   brief=cleaning)
-+        if config.env['target_python']:
-+            try:
-+                config.CheckProg
-+            except AttributeError:  # Older scons versions don't have CheckProg
-+                target_python_path = config.env['target_python']
-+            else:
-+                target_python_path = config.CheckProg(config.env['target_python'])
-+            if not target_python_path:
-+                announce("Target Python doesn't exist - disabling Python.")
-+                config.env['python'] = False
-+        else:
-+            # Maximize consistency by using the reported sys.executable
-+            target_python_path = config.GetPythonValue('exe path',
-+                                                       'import sys',
-+                                                       'sys.executable',
-+                                                       brief=cleaning)
-         if config.env['python_libdir']:
-             python_libdir = config.env['python_libdir']
-         else:
-@@ -1674,7 +1668,7 @@ else:
-                        LINK=ldshared,
-                        SHLIBPREFIX="",
-                        SHLIBSUFFIX=python_config['SO'],
--                       CPPPATH=[python_config['INCLUDEPY']],
-+                       CPPPATH=sysroot + python_config['INCLUDEPY'],
-                        CPPFLAGS=python_config['OPT'],
-                        CFLAGS=python_config['BASECFLAGS'],
-                        CXXFLAGS=python_config['BASECFLAGS'])
diff --git a/patches/gpsd-3.19/series b/patches/gpsd-3.19/series
deleted file mode 100644
index 32349387e..000000000
--- a/patches/gpsd-3.19/series
+++ /dev/null
@@ -1,5 +0,0 @@
-# generated by git-ptx-patches
-#tag:base --start-number 1
-0001-Search-for-ncursesw-pkgconfig.patch
-0002-Fix-python-binding-cross-compilation.patch
-# a402ea49345e59dc5c9f5487c0ce65c6  - git-ptx-patches magic
diff --git a/patches/gpsd-3.20/0001-SConstruct-replace-custom-CheckSizeOf-with-standard-.patch b/patches/gpsd-3.20/0001-SConstruct-replace-custom-CheckSizeOf-with-standard-.patch
new file mode 100644
index 000000000..0d5771bbe
--- /dev/null
+++ b/patches/gpsd-3.20/0001-SConstruct-replace-custom-CheckSizeOf-with-standard-.patch
@@ -0,0 +1,74 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Fri, 3 Jan 2020 16:15:53 -0800
+Subject: [PATCH] SConstruct: replace custom CheckSizeOf() with standard
+ CheckTypeSize()
+
+---
+ SConstruct | 40 ++--------------------------------------
+ 1 file changed, 2 insertions(+), 38 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 33e0ff32665c..bd008207011d 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("""
+@@ -708,7 +672,6 @@ config = Configure(env, custom_tests={
+     'CheckCompilerOption': CheckCompilerOption,
+     'CheckHeaderDefines': CheckHeaderDefines,
+     'CheckPKG': CheckPKG,
+-    'CheckSizeOf': CheckSizeOf,
+     'CheckXsltproc': CheckXsltproc,
+     'GetPythonValue': GetPythonValue,
+     })
+@@ -1043,7 +1006,8 @@ else:
+             confdefs.append("/* #undef HAVE_%s_H */\n"
+                             % hdr.replace("/", "_").upper())
+ 
+-    sizeof_time_t = config.CheckSizeOf("time_t")
++    sizeof_time_t = config.CheckTypeSize('time_t',
++                                         includes='#include <time.h>\n')
+     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):
diff --git a/patches/gpsd-3.20/0002-SConstruct-Always-install-xpgs-xgpsspeed-programs-ma.patch b/patches/gpsd-3.20/0002-SConstruct-Always-install-xpgs-xgpsspeed-programs-ma.patch
new file mode 100644
index 000000000..5800867b8
--- /dev/null
+++ b/patches/gpsd-3.20/0002-SConstruct-Always-install-xpgs-xgpsspeed-programs-ma.patch
@@ -0,0 +1,148 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Mon, 6 Jan 2020 12:29:10 -0800
+Subject: [PATCH] SConstruct: Always install xpgs/xgpsspeed programs, man
+ pages.
+
+Now the xgps/xgpsspeed dependencies are tested at build time but not
+mandatory.  The dependencies need to be installed for the programs to
+run.
+---
+ SConstruct | 75 ++++++++++++++++++++++++++------------------------------------
+ 1 file changed, 31 insertions(+), 44 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index bd008207011d..cfd1c4164337 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1179,15 +1179,13 @@ def polystr(o):
+ 
+ 
+ if helping:
+-
+     # If helping just get usable config info from the local Python
+     target_python_path = ''
+     py_config_text = str(eval(PYTHON_CONFIG_CALL))
+     python_libdir = str(eval(PYTHON_LIBDIR_CALL))
+ 
+-else:
+-
+-    if config.env['python'] and config.env['target_python']:
++elif config.env['python']:
++    if config.env['target_python']:
+         try:
+             config.CheckProg
+         except AttributeError:  # Older scons versions don't have CheckProg
+@@ -1197,6 +1195,7 @@ else:
+         if not target_python_path:
+             announce("Target Python doesn't exist - disabling Python.")
+             config.env['python'] = False
++
+     if config.env['python']:
+         # Maximize consistency by using the reported sys.executable
+         target_python_path = config.GetPythonValue('exe path',
+@@ -1235,41 +1234,36 @@ else:
+             imp.find_module('serial')
+             announce("Python module serial (pyserial) found.")
+         except ImportError:
+-            # no pycairo, don't build xgps, xgpsspeed
++            # no pyserial, used by ubxtool and zerk
+             announce("WARNING: Python module serial (pyserial) not found.")
+-            config.env['xgps'] = False
+ 
+-        if config.env['xgps']:
+-            # check for pycairo
+-            try:
+-                imp.find_module('cairo')
+-                announce("Python module cairo (pycairo) found.")
+-            except ImportError:
+-                # no pycairo, don't build xgps, xgpsspeed
+-                announce("WARNING: Python module cairo (pycairo) not found.")
+-                config.env['xgps'] = False
+-
+-            # check for pygobject
+-            try:
+-                imp.find_module('gi')
+-                announce("Python module gi (pygobject) found.")
+-            except ImportError:
+-                # no pygobject, don't build xgps, xgpsspeed
+-                announce("WARNING: Python module gi (pygobject) not found.")
+-                config.env['xgps'] = False
++        # check for pycairo
++        try:
++            imp.find_module('cairo')
++            announce("Python module cairo (pycairo) found.")
++        except ImportError:
++            # no pycairo, used by xgps, xgpsspeed
++            announce("WARNING: Python module cairo (pycairo) not found.")
+ 
+-            if not config.CheckPKG('gtk+-3.0'):
+-                config.env['xgps'] = False
++        # check for pygobject
++        try:
++            imp.find_module('gi')
++            announce("Python module gi (pygobject) found.")
++        except ImportError:
++            # no pycairo, used by xgps, xgpsspeed
++            announce("WARNING: Python module gi (pygobject) not found.")
+ 
++        # gtk+ needed by pygobject
++        config.CheckPKG('gtk+-3.0')
+ 
+-if config.env['python']:  # May have been turned off by error
+-    config.env['PYTHON'] = polystr(target_python_path)
+-    # For regress-driver
+-    config.env['ENV']['PYTHON'] = polystr(target_python_path)
+-    py_config_vars = ast.literal_eval(py_config_text.decode())
+-    py_config_vars = [[] if x is None else x for x in py_config_vars]
+-    python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
+-    announce(python_config)
++        config.env['PYTHON'] = polystr(target_python_path)
++        # For regress-driver
++        config.env['ENV']['PYTHON'] = polystr(target_python_path)
++        py_config_vars = ast.literal_eval(py_config_text.decode())
++        py_config_vars = [[] if x is None else x for x in py_config_vars]
++        python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
++        # debug
++        # announce(python_config)
+ 
+ 
+ env = config.Finish()
+@@ -1664,15 +1658,13 @@ else:
+         "man/gpsfake.1": "man/gpsfake.xml",
+         "man/gpsprof.1": "man/gpsprof.xml",
+         "man/ubxtool.1": "man/ubxtool.xml",
++        "man/xgps.1": "man/gps.xml",
++        "man/xgpsspeed.1": "man/gps.xml",
+         "man/zerk.1": "man/zerk.xml",
+     }
+ 
+     if env['xgps']:
+         python_progs.extend(["xgps", "xgpsspeed"])
+-        python_manpages.update({
+-            "man/xgps.1": "man/gps.xml",
+-            "man/xgpsspeed.1": "man/gps.xml",
+-        })
+     else:
+         announce("WARNING: xgps and xgpsspeed will not be installed")
+ 
+@@ -1961,11 +1953,6 @@ if tiocmiwait:
+     })
+ 
+ all_manpages = list(base_manpages.keys())
+-other_manpages = [
+-                  "man/gegps.1",
+-                  "man/xgps.1",
+-                  "man/xgpsspeed.1",
+-                  ]
+ 
+ if python_manpages:
+     all_manpages += list(python_manpages.keys())
+@@ -2701,7 +2688,7 @@ Utility('udev-test', '', ['$SRCDIR/gpsd -N -n -F /var/run/gpsd.sock -D 5', ])
+ # Dummy target for cleaning misc files
+ clean_misc = env.Alias('clean-misc')
+ # Since manpage targets are disabled in clean mode, we cover them here
+-env.Clean(clean_misc, all_manpages + other_manpages)
++env.Clean(clean_misc, all_manpages)
+ # Clean compiled Python
+ env.Clean(clean_misc,
+           glob.glob('*.pyc') + glob.glob('gps/*.pyc') +
diff --git a/patches/gpsd-3.20/0003-SConstruct-Always-install-xgps-.-Only-test-if-deps-f.patch b/patches/gpsd-3.20/0003-SConstruct-Always-install-xgps-.-Only-test-if-deps-f.patch
new file mode 100644
index 000000000..a05f411be
--- /dev/null
+++ b/patches/gpsd-3.20/0003-SConstruct-Always-install-xgps-.-Only-test-if-deps-f.patch
@@ -0,0 +1,108 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Mon, 6 Jan 2020 14:30:58 -0800
+Subject: [PATCH] SConstruct: Always install xgps*. Only test if deps found.
+
+Now no build time deps for xgps*.  Just runtime deps.
+---
+ SConstruct | 35 +++++++++++++++++++++++++----------
+ 1 file changed, 25 insertions(+), 10 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index cfd1c4164337..7b4a63f817f9 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1178,11 +1178,15 @@ def polystr(o):
+     raise ValueError
+ 
+ 
++# flag that we have xgps* dependencies, so xgps* should run OK
++config.env['xgps_deps'] = False
++
+ if helping:
+     # If helping just get usable config info from the local Python
+     target_python_path = ''
+     py_config_text = str(eval(PYTHON_CONFIG_CALL))
+     python_libdir = str(eval(PYTHON_LIBDIR_CALL))
++    config.env['xgps_deps'] = False
+ 
+ elif config.env['python']:
+     if config.env['target_python']:
+@@ -1237,12 +1241,14 @@ elif config.env['python']:
+             # no pyserial, used by ubxtool and zerk
+             announce("WARNING: Python module serial (pyserial) not found.")
+ 
++        config.env['xgps_deps'] = True
+         # check for pycairo
+         try:
+             imp.find_module('cairo')
+             announce("Python module cairo (pycairo) found.")
+         except ImportError:
+             # no pycairo, used by xgps, xgpsspeed
++            config.env['xgps_deps'] = False
+             announce("WARNING: Python module cairo (pycairo) not found.")
+ 
+         # check for pygobject
+@@ -1251,10 +1257,17 @@ elif config.env['python']:
+             announce("Python module gi (pygobject) found.")
+         except ImportError:
+             # no pycairo, used by xgps, xgpsspeed
++            config.env['xgps_deps'] = False
+             announce("WARNING: Python module gi (pygobject) not found.")
+ 
+         # gtk+ needed by pygobject
+-        config.CheckPKG('gtk+-3.0')
++        if not config.CheckPKG('gtk+-3.0'):
++            config.env['xgps_deps'] = False
++            announce("WARNING: gtk+-3.0 nnot found.")
++
++        if not env['xgps']:
++            # xgps* turned off by option
++            config.env['xgps_deps'] = False
+ 
+         config.env['PYTHON'] = polystr(target_python_path)
+         # For regress-driver
+@@ -1634,7 +1647,14 @@ if not env['python']:
+     python_targets = []
+ else:
+     # installed python programs
+-    python_progs = ["gegps", "gpscat", "gpsfake", "gpsprof", "ubxtool", "zerk"]
++    python_progs = ["gegps",
++                    "gpscat",
++                    "gpsfake",
++                    "gpsprof",
++                    "ubxtool",
++                    "xgps",
++                    "xgpsspeed",
++                    "zerk"]
+     python_deps = {'gpscat': 'packet'}
+ 
+     # python misc helpers and stuff
+@@ -1663,11 +1683,6 @@ else:
+         "man/zerk.1": "man/zerk.xml",
+     }
+ 
+-    if env['xgps']:
+-        python_progs.extend(["xgps", "xgpsspeed"])
+-    else:
+-        announce("WARNING: xgps and xgpsspeed will not be installed")
+-
+     # Glob() has to be run after all buildable objects defined
+     python_modules = Glob('gps/*.py', strings=True)
+ 
+@@ -2410,13 +2425,13 @@ method_regress = UtilityWithHerald(
+         '$SRCDIR/tests/test_packet -c >/dev/null', ])
+ 
+ # Test the xgps/xgpsspeed dependencies
+-if not env['python'] or not env['xgps']:
+-    test_xgps_deps = None
+-else:
++if env['xgps_deps']:
+     test_xgps_deps = UtilityWithHerald(
+         'Testing xgps/xgpsspeed dependencies (since xgps=yes)...',
+         'test-xgps-deps', [], [
+             '$PYTHON $SRCDIR/test_xgps_deps.py'])
++else:
++    test_xgps_deps = None
+ 
+ # Run a valgrind audit on the daemon  - not in normal tests
+ valgrind_audit = Utility('valgrind-audit', [
diff --git a/patches/gpsd-3.20/0004-SConstruct-Skip-sizeof-time_t-test-when-cross-compil.patch b/patches/gpsd-3.20/0004-SConstruct-Skip-sizeof-time_t-test-when-cross-compil.patch
new file mode 100644
index 000000000..9f9c0cd69
--- /dev/null
+++ b/patches/gpsd-3.20/0004-SConstruct-Skip-sizeof-time_t-test-when-cross-compil.patch
@@ -0,0 +1,39 @@
+From: Jeffery To <jeffery.to@gmail.com>
+Date: Fri, 17 Jan 2020 06:09:33 +0800
+Subject: [PATCH] SConstruct: Skip sizeof(time_t) test when cross-compiling
+
+Fixes #48.
+---
+ SConstruct | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 7b4a63f817f9..bf682a03e087 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1006,12 +1006,20 @@ else:
+             confdefs.append("/* #undef HAVE_%s_H */\n"
+                             % hdr.replace("/", "_").upper())
+ 
+-    sizeof_time_t = config.CheckTypeSize('time_t',
+-                                         includes='#include <time.h>\n')
++    if not env['target']:
++        sizeof_time_t = config.CheckTypeSize('time_t',
++                                             includes='#include <time.h>\n')
++        if 0 < sizeof_time_t:
++            announce("sizeof(time_t) is %s" % sizeof_time_t)
++            if 4 >= sizeof_time_t:
++                announce("WARNING: time_t is too small.  It will fail in 2038")
++        else:
++            announce("WARNING: could not get sizeof(time_t)")
++            sizeof_time_t = 8
++    else:
++        announce("Not checking sizeof(time_t) when cross-compiling")
++        sizeof_time_t = 8
+     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
diff --git a/patches/gpsd-3.20/0005-Fix-merging-and-using-of-python-flags.patch b/patches/gpsd-3.20/0005-Fix-merging-and-using-of-python-flags.patch
new file mode 100644
index 000000000..e4139f66c
--- /dev/null
+++ b/patches/gpsd-3.20/0005-Fix-merging-and-using-of-python-flags.patch
@@ -0,0 +1,45 @@
+From: Bernd Zeimetz <bernd@bzed.de>
+Date: Sat, 17 Aug 2019 01:27:08 +0200
+Subject: [PATCH] Fix merging and using of python *flags.
+
+As follow-up for d0e0864c2802860ff561fe0b39939b63d38b8c70,
+also fix the handling of python build flags.
+---
+ SConstruct | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index bf682a03e087..d71dfab48db3 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1169,7 +1169,7 @@ else:
+ 
+ PYTHON_LIBDIR_CALL = 'sysconfig.get_python_lib()'
+ 
+-PYTHON_CONFIG_NAMES = ['CC', 'CXX', 'OPT', 'BASECFLAGS',
++PYTHON_CONFIG_NAMES = ['CC', 'CXX', 'OPT', 'CFLAGS',
+                        'CCSHARED', 'LDSHARED', 'SO', 'INCLUDEPY', 'LDFLAGS']
+ PYTHON_CONFIG_QUOTED = ["'%s'" % s for s in PYTHON_CONFIG_NAMES]
+ PYTHON_CONFIG_CALL = ('sysconfig.get_config_vars(%s)'
+@@ -1753,14 +1753,17 @@ else:
+     ldshared = ldshared.replace('-fPIE', '')
+     ldshared = ldshared.replace('-pie', '')
+     python_env.Replace(SHLINKFLAGS=[],
+-                       LDFLAGS=python_config['LDFLAGS'],
++                       LDFLAGS=[],
+                        LINK=ldshared,
+                        SHLIBPREFIX="",
+                        SHLIBSUFFIX=python_config['SO'],
+                        CPPPATH=[python_config['INCLUDEPY']],
+-                       CPPFLAGS=python_config['OPT'],
+-                       CFLAGS=python_config['BASECFLAGS'],
+-                       CXXFLAGS=python_config['BASECFLAGS'])
++                       CPPFLAGS=[],
++                       CFLAGS=[],
++                       CXXFLAGS=[])
++
++    for flag in ['CFLAGS','LDFLAGS','OPT']:
++        python_env.MergeFlags(Split(python_config[flag]))
+ 
+     python_objects = {}
+     python_compiled_libs = {}
diff --git a/patches/gpsd-3.20/0006-SConstruct-Remove-redundant-CheckHeaderDefines.patch b/patches/gpsd-3.20/0006-SConstruct-Remove-redundant-CheckHeaderDefines.patch
new file mode 100644
index 000000000..a1519a723
--- /dev/null
+++ b/patches/gpsd-3.20/0006-SConstruct-Remove-redundant-CheckHeaderDefines.patch
@@ -0,0 +1,52 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Wed, 8 Jan 2020 14:56:58 -0800
+Subject: [PATCH] SConstruct: Remove redundant CheckHeaderDefines()
+
+---
+ SConstruct | 19 +------------------
+ 1 file changed, 1 insertion(+), 18 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index d71dfab48db3..1a0463f67a41 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -581,22 +581,6 @@ def CheckCompilerOption(context, option):
+     return ret
+ 
+ 
+-def CheckHeaderDefines(context, file, define):
+-    context.Message('Checking if %s supplies %s... ' % (file, define))
+-    ret = context.TryLink("""
+-        #include <%s>
+-        #ifndef %s
+-        #error %s is not defined
+-        #endif
+-        int main(int argc, char **argv) {
+-            (void) argc; (void) argv;
+-            return 0;
+-        }
+-    """ % (file, define, define), '.c')
+-    context.Result(ret)
+-    return ret
+-
+-
+ def CheckCompilerDefines(context, define):
+     context.Message('Checking if compiler supplies %s... ' % (define,))
+     ret = context.TryLink("""
+@@ -670,7 +654,6 @@ config = Configure(env, custom_tests={
+     'CheckC11': CheckC11,
+     'CheckCompilerDefines': CheckCompilerDefines,
+     'CheckCompilerOption': CheckCompilerOption,
+-    'CheckHeaderDefines': CheckHeaderDefines,
+     'CheckPKG': CheckPKG,
+     'CheckXsltproc': CheckXsltproc,
+     'GetPythonValue': GetPythonValue,
+@@ -1046,7 +1029,7 @@ else:
+         if config.env["magic_hat"]:
+             announce("Forcing magic_hat=no since RFC2783 API is unavailable")
+             config.env["magic_hat"] = False
+-    tiocmiwait = config.CheckHeaderDefines("sys/ioctl.h", "TIOCMIWAIT")
++    tiocmiwait = config.CheckDeclaration("TIOCMIWAIT", "#include <sys/ioctl.h>")
+     if not tiocmiwait and not kpps:
+         announce("Neither TIOCMIWAIT nor RFC2783 API is available)")
+         if config.env["timeservice"]:
diff --git a/patches/gpsd-3.20/0007-SConstruct-remove-redundant-CheckCompilerDefines.patch b/patches/gpsd-3.20/0007-SConstruct-remove-redundant-CheckCompilerDefines.patch
new file mode 100644
index 000000000..c99949f6a
--- /dev/null
+++ b/patches/gpsd-3.20/0007-SConstruct-remove-redundant-CheckCompilerDefines.patch
@@ -0,0 +1,67 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Wed, 8 Jan 2020 15:25:10 -0800
+Subject: [PATCH] SConstruct: remove redundant CheckCompilerDefines()
+
+Built in CheckDeclaration() works fine.
+---
+ SConstruct | 25 ++++---------------------
+ 1 file changed, 4 insertions(+), 21 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 1a0463f67a41..ea87d9204e60 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -581,23 +581,7 @@ def CheckCompilerOption(context, option):
+     return ret
+ 
+ 
+-def CheckCompilerDefines(context, define):
+-    context.Message('Checking if compiler supplies %s... ' % (define,))
+-    ret = context.TryLink("""
+-        #ifndef %s
+-        #error %s is not defined
+-        #endif
+-        int main(int argc, char **argv) {
+-            (void) argc; (void) argv;
+-            return 0;
+-        }
+-    """ % (define, define), '.c')
+-    context.Result(ret)
+-    return ret
+-
+ # Check if this compiler is C11 or better
+-
+-
+ def CheckC11(context):
+     context.Message('Checking if compiler is C11... ')
+     ret = context.TryLink("""
+@@ -652,7 +636,6 @@ 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,
+     'CheckPKG': CheckPKG,
+     'CheckXsltproc': CheckXsltproc,
+@@ -926,7 +909,7 @@ else:
+     # check for C11 or better, and __STDC__NO_ATOMICS__ is not defined
+     # before looking for stdatomic.h
+     if ((config.CheckC11() and
+-         not config.CheckCompilerDefines("__STDC_NO_ATOMICS__") and
++         not config.CheckDeclaration("__STDC_NO_ATOMICS__") and
+          config.CheckHeader("stdatomic.h"))):
+         confdefs.append("#define HAVE_STDATOMIC_H 1\n")
+     else:
+@@ -940,9 +923,9 @@ else:
+ 
+     # endian.h is required for rtcm104v2 unless the compiler defines
+     # __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__ and __BYTE_ORDER__
+-    if config.CheckCompilerDefines("__ORDER_BIG_ENDIAN__") \
+-       and config.CheckCompilerDefines("__ORDER_LITTLE_ENDIAN__") \
+-       and config.CheckCompilerDefines("__BYTE_ORDER__"):
++    if ((config.CheckDeclaration("__ORDER_BIG_ENDIAN__") and
++         config.CheckDeclaration("__ORDER_LITTLE_ENDIAN__") and
++         config.CheckDeclaration("__BYTE_ORDER__"))):
+         confdefs.append("#define HAVE_BUILTIN_ENDIANNESS 1\n")
+         confdefs.append("/* #undef HAVE_ENDIAN_H */\n")
+         confdefs.append("/* #undef HAVE_SYS_ENDIAN_H */\n")
diff --git a/patches/gpsd-3.20/0008-SConstruct-GetPythonValue-and-CheckPKG-were-using-wr.patch b/patches/gpsd-3.20/0008-SConstruct-GetPythonValue-and-CheckPKG-were-using-wr.patch
new file mode 100644
index 000000000..4db5abd2c
--- /dev/null
+++ b/patches/gpsd-3.20/0008-SConstruct-GetPythonValue-and-CheckPKG-were-using-wr.patch
@@ -0,0 +1,44 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Wed, 8 Jan 2020 15:46:03 -0800
+Subject: [PATCH] SConstruct: GetPythonValue() and CheckPKG were using wrong
+ env.
+
+---
+ SConstruct | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index ea87d9204e60..fc5ab39bfad6 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -524,7 +524,7 @@ values can be listed with 'scons -h'.
+ def CheckPKG(context, name):
+     context.Message('Checking pkg-config for %s... ' % name)
+     ret = context.TryAction('%s --exists \'%s\''
+-                            % (env['PKG_CONFIG'], name))[0]
++                            % (context.env['PKG_CONFIG'], name))[0]
+     context.Result(ret)
+     return ret
+ 
+@@ -599,8 +599,11 @@ def CheckC11(context):
+ 
+ def GetPythonValue(context, name, imp, expr, brief=False):
+     context.Message('Obtaining Python %s... ' % name)
++
++    # what is this about?
+     context.sconf.cached = 0  # Avoid bogus "(cached)"
+-    if not env['target_python']:
++
++    if not context.env['target_python']:
+         status, value = 0, str(eval(expr))
+     else:
+         command = [target_python_path, '-c', '%s; print(%s)' % (imp, expr)]
+@@ -615,7 +618,7 @@ def GetPythonValue(context, name, imp, expr, brief=False):
+             announce('Python command "%s" failed - disabling Python.\n'
+                      'Python components will NOT be installed' %
+                      command[2])
+-            env['python'] = False
++            context.env['python'] = False
+     context.Result('failed' if status else 'ok' if brief else value)
+     return value
+ 
diff --git a/patches/gpsd-3.20/0009-SConstruct-Fix-GetPythonValue-for-python-3.patch b/patches/gpsd-3.20/0009-SConstruct-Fix-GetPythonValue-for-python-3.patch
new file mode 100644
index 000000000..88c8cfbaa
--- /dev/null
+++ b/patches/gpsd-3.20/0009-SConstruct-Fix-GetPythonValue-for-python-3.patch
@@ -0,0 +1,57 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Wed, 8 Jan 2020 17:25:16 -0800
+Subject: [PATCH] SConstruct: Fix GetPythonValue() for python 3.
+
+---
+ SConstruct | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index fc5ab39bfad6..a5c41e8f4803 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -604,7 +604,8 @@ def GetPythonValue(context, name, imp, expr, brief=False):
+     context.sconf.cached = 0  # Avoid bogus "(cached)"
+ 
+     if not context.env['target_python']:
+-        status, value = 0, str(eval(expr))
++        status = 0
++        value = str(eval(expr))
+     else:
+         command = [target_python_path, '-c', '%s; print(%s)' % (imp, expr)]
+         try:
+@@ -619,7 +620,14 @@ def GetPythonValue(context, name, imp, expr, brief=False):
+                      'Python components will NOT be installed' %
+                      command[2])
+             context.env['python'] = False
+-    context.Result('failed' if status else 'ok' if brief else value)
++    if 0 != status:
++        result = 'failed'
++    elif brief:
++        result = 'ok'
++    else:
++        # context.Result() confused by bytes
++        result = polystr(value)
++    context.Result(result)
+     return value
+ 
+ 
+@@ -1181,15 +1189,14 @@ elif config.env['python']:
+         # Maximize consistency by using the reported sys.executable
+         target_python_path = config.GetPythonValue('exe path',
+                                                    'import sys',
+-                                                   'sys.executable',
+-                                                   brief=cleaning)
++                                                   'sys.executable')
++        # python module directory
+         if config.env['python_libdir']:
+             python_libdir = config.env['python_libdir']
+         else:
+             python_libdir = config.GetPythonValue('lib dir',
+                                                   PYTHON_SYSCONFIG_IMPORT,
+-                                                  PYTHON_LIBDIR_CALL,
+-                                                  brief=cleaning)
++                                                  PYTHON_LIBDIR_CALL)
+             # follow FHS, put in /usr/local/libXX, not /usr/libXX
+             # may be lib, lib32 or lib64
+             python_libdir = polystr(python_libdir)
diff --git a/patches/gpsd-3.20/0010-SConstruct-move-more-checks-into-GetPythonValue.patch b/patches/gpsd-3.20/0010-SConstruct-move-more-checks-into-GetPythonValue.patch
new file mode 100644
index 000000000..a68169431
--- /dev/null
+++ b/patches/gpsd-3.20/0010-SConstruct-move-more-checks-into-GetPythonValue.patch
@@ -0,0 +1,98 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Wed, 8 Jan 2020 18:04:15 -0800
+Subject: [PATCH] SConstruct: move more checks into GetPythonValue()
+
+So the target python is used, not the python used to run scons.
+---
+ SConstruct | 36 ++++++++++++++++--------------------
+ 1 file changed, 16 insertions(+), 20 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index a5c41e8f4803..9f88fa347b9a 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -33,7 +33,6 @@ from __future__ import print_function
+ import ast
+ import functools
+ import glob
+-import imp         # for imp.find_module('gps'), imp deprecated in 3.4
+ import operator
+ import os
+ import pickle
+@@ -598,12 +597,14 @@ def CheckC11(context):
+ 
+ 
+ def GetPythonValue(context, name, imp, expr, brief=False):
+-    context.Message('Obtaining Python %s... ' % name)
++    """Get a value from the target python, not the running one."""
++    context.Message('Checking Python %s... ' % name)
+ 
+     # what is this about?
+     context.sconf.cached = 0  # Avoid bogus "(cached)"
+ 
+     if not context.env['target_python']:
++        # FIXME: this ignores imp
+         status = 0
+         value = str(eval(expr))
+     else:
+@@ -616,10 +617,8 @@ def GetPythonValue(context, name, imp, expr, brief=False):
+             value = value.strip()
+         else:
+             value = ''
+-            announce('Python command "%s" failed - disabling Python.\n'
+-                     'Python components will NOT be installed' %
+-                     command[2])
+-            context.env['python'] = False
++            # do not disable python because this failed
++            # maybe testing for newer python feature
+     if 0 != status:
+         result = 'failed'
+     elif brief:
+@@ -1023,7 +1022,8 @@ else:
+         if config.env["magic_hat"]:
+             announce("Forcing magic_hat=no since RFC2783 API is unavailable")
+             config.env["magic_hat"] = False
+-    tiocmiwait = config.CheckDeclaration("TIOCMIWAIT", "#include <sys/ioctl.h>")
++    tiocmiwait = config.CheckDeclaration("TIOCMIWAIT",
++                                         "#include <sys/ioctl.h>")
+     if not tiocmiwait and not kpps:
+         announce("Neither TIOCMIWAIT nor RFC2783 API is available)")
+         if config.env["timeservice"]:
+@@ -1218,28 +1218,24 @@ elif config.env['python']:
+             config.env['aiogps'] = True
+ 
+         # check for pyserial
+-        try:
+-            imp.find_module('serial')
+-            announce("Python module serial (pyserial) found.")
+-        except ImportError:
++        if not config.GetPythonValue('module serial (pyserial)',
++                                     'import serial', '"found"'):
+             # no pyserial, used by ubxtool and zerk
+-            announce("WARNING: Python module serial (pyserial) not found.")
++            announce("WARNING: ubxtool and zerk are missing optional "
++                     "runtime module serial")
+ 
+         config.env['xgps_deps'] = True
++
+         # check for pycairo
+-        try:
+-            imp.find_module('cairo')
+-            announce("Python module cairo (pycairo) found.")
+-        except ImportError:
++        if not config.GetPythonValue('module cairo (pycairo)',
++                                     'import cairo', '"found"'):
+             # no pycairo, used by xgps, xgpsspeed
+             config.env['xgps_deps'] = False
+             announce("WARNING: Python module cairo (pycairo) not found.")
+ 
+         # check for pygobject
+-        try:
+-            imp.find_module('gi')
+-            announce("Python module gi (pygobject) found.")
+-        except ImportError:
++        if not config.GetPythonValue('module gi (pygobject)',
++                                     'import gi', '"found"'):
+             # no pycairo, used by xgps, xgpsspeed
+             config.env['xgps_deps'] = False
+             announce("WARNING: Python module gi (pygobject) not found.")
diff --git a/patches/gpsd-3.20/0011-SConstruct-Check-target-python-version-not-scons-pyt.patch b/patches/gpsd-3.20/0011-SConstruct-Check-target-python-version-not-scons-pyt.patch
new file mode 100644
index 000000000..19d3e3b23
--- /dev/null
+++ b/patches/gpsd-3.20/0011-SConstruct-Check-target-python-version-not-scons-pyt.patch
@@ -0,0 +1,32 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Wed, 8 Jan 2020 18:38:11 -0800
+Subject: [PATCH] SConstruct: Check target python version, not scons python
+ version.
+
+---
+ SConstruct | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 9f88fa347b9a..a02a2a897d32 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1209,11 +1209,14 @@ elif config.env['python']:
+                                                brief=True)
+ 
+         # aiogps is only available on Python >= 3.6
+-        # FIXME check target_python, not current python
+-        if sys.version_info < (3, 6):
++        sysver = config.GetPythonValue('version',
++                                       'import sys',
++                                       '"%d.%d" % sys.version_info[0:2]')
++        if 3 > int(sysver[0]) or 6 > int(sysver[2]):
+             config.env['aiogps'] = False
+-            announce("WARNING: Python too old: "
+-                     "gps/aiogps.py will not be installed\n")
++            announce("WARNING: Python%s too old (need 3.6): "
++                     "gps/aiogps.py will not be installed\n" %
++                     (sysver), end=True)
+         else:
+             config.env['aiogps'] = True
+ 
diff --git a/patches/gpsd-3.20/0012-SConstruct-Simplify-GetPythonValue-.-It-now-caches-p.patch b/patches/gpsd-3.20/0012-SConstruct-Simplify-GetPythonValue-.-It-now-caches-p.patch
new file mode 100644
index 000000000..e833a1f08
--- /dev/null
+++ b/patches/gpsd-3.20/0012-SConstruct-Simplify-GetPythonValue-.-It-now-caches-p.patch
@@ -0,0 +1,174 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Fri, 10 Jan 2020 16:24:58 -0800
+Subject: [PATCH] SConstruct: Simplify GetPythonValue(). It now caches
+ properly.
+
+---
+ SConstruct | 93 ++++++++++++++++++++++++++++++++------------------------------
+ 1 file changed, 48 insertions(+), 45 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index a02a2a897d32..f45efe4e19f0 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -22,12 +22,12 @@
+ # * Out-of-directory builds: see http://www.scons.org/wiki/UsingBuildDir
+ # * Coveraging mode: gcc "-coverage" flag requires a hack
+ #   for building the python bindings
+-# * Python 3 compatibility in this recipe
+-
+-# Since SCons 3.0.0 forces print_function on us, it needs to be unconditional.
+-# This is recognized to be a bug in SCons, but we need to live with it for now,
+-# and we'll need this for eventual Python 3 compatibility, anyway.
+-# Python requires this to precede any non-comment code.
++#
++# This file is Copyright (c) 2010-2020 by the GPSD project
++# SPDX-License-Identifier: BSD-2-clause
++#
++# This code runs compatibly under Python 2 and 3.x for x >= 2.
++# Preserve this property!
+ from __future__ import print_function
+ 
+ import ast
+@@ -600,33 +600,29 @@ def GetPythonValue(context, name, imp, expr, brief=False):
+     """Get a value from the target python, not the running one."""
+     context.Message('Checking Python %s... ' % name)
+ 
+-    # what is this about?
+-    context.sconf.cached = 0  # Avoid bogus "(cached)"
+-
+     if not context.env['target_python']:
+         # FIXME: this ignores imp
+-        status = 0
++        status = 1
+         value = str(eval(expr))
+     else:
+-        command = [target_python_path, '-c', '%s; print(%s)' % (imp, expr)]
+-        try:
+-            status, value = _getstatusoutput(command, shell=False)
+-        except OSError:
+-            status = -1
+-        if status == 0:
+-            value = value.strip()
+-        else:
+-            value = ''
+-            # do not disable python because this failed
+-            # maybe testing for newer python feature
+-    if 0 != status:
+-        result = 'failed'
+-    elif brief:
+-        result = 'ok'
+-    else:
+-        # context.Result() confused by bytes
+-        result = polystr(value)
+-    context.Result(result)
++        command = (context.env['target_python'] + " $SOURCE > $TARGET")
++        text = "%s; print(%s)" % (imp, expr)
++
++        # TryAction returns (1, outputStr), or (0, '') on fail
++        (status, value) = context.TryAction(command, text, '.py')
++
++        # do not disable python because this failed
++        # maybe testing for newer python feature
++
++    if 1 == status:
++        # we could convert to str(), but caching turns it into bytes anyway
++        value = value.strip()
++        if brief is True:
++            context.did_show_result = 1
++            print("ok")
++
++    context.Result(value)
++    # return value
+     return value
+ 
+ 
+@@ -1174,10 +1170,13 @@ if helping:
+     config.env['xgps_deps'] = False
+ 
+ elif config.env['python']:
++    target_python_path = None
+     if config.env['target_python']:
+         try:
+             config.CheckProg
+-        except AttributeError:  # Older scons versions don't have CheckProg
++        except AttributeError:
++            # scons versions before Sep 2015 (2.4.0) don't have CheckProg
++            # gpsd only asks for 2.3.0 or higher
+             target_python_path = config.env['target_python']
+         else:
+             target_python_path = config.CheckProg(config.env['target_python'])
+@@ -1186,10 +1185,13 @@ elif config.env['python']:
+             config.env['python'] = False
+ 
+     if config.env['python']:
+-        # Maximize consistency by using the reported sys.executable
+-        target_python_path = config.GetPythonValue('exe path',
+-                                                   'import sys',
+-                                                   'sys.executable')
++        if not target_python_path:
++            # Avoid double testing for target_python_path
++            # Maximize consistency by using the reported sys.executable
++            target_python_path = config.GetPythonValue('exe path',
++                                                       'import sys',
++                                                       'sys.executable')
++        target_python_path = polystr(target_python_path)
+         # python module directory
+         if config.env['python_libdir']:
+             python_libdir = config.env['python_libdir']
+@@ -1207,11 +1209,18 @@ elif config.env['python']:
+                                                PYTHON_SYSCONFIG_IMPORT,
+                                                PYTHON_CONFIG_CALL,
+                                                brief=True)
++        py_config_text = polystr(py_config_text)
++        py_config_vars = ast.literal_eval(py_config_text)
++        py_config_vars = [[] if x is None else x for x in py_config_vars]
++        python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
++        # debug
++        # announce(python_config)
+ 
+         # aiogps is only available on Python >= 3.6
+         sysver = config.GetPythonValue('version',
+                                        'import sys',
+                                        '"%d.%d" % sys.version_info[0:2]')
++
+         if 3 > int(sysver[0]) or 6 > int(sysver[2]):
+             config.env['aiogps'] = False
+             announce("WARNING: Python%s too old (need 3.6): "
+@@ -1252,14 +1261,8 @@ elif config.env['python']:
+             # xgps* turned off by option
+             config.env['xgps_deps'] = False
+ 
+-        config.env['PYTHON'] = polystr(target_python_path)
+-        # For regress-driver
+-        config.env['ENV']['PYTHON'] = polystr(target_python_path)
+-        py_config_vars = ast.literal_eval(py_config_text.decode())
+-        py_config_vars = [[] if x is None else x for x in py_config_vars]
+-        python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
+-        # debug
+-        # announce(python_config)
++        config.env['PYTHON'] = target_python_path
++        config.env['ENV']['PYTHON'] = target_python_path
+ 
+ 
+ env = config.Finish()
+@@ -1859,7 +1862,7 @@ else:
+ 
+ 
+ # Instantiate some file templates.  We'd like to use the Substfile builtin
+-# but it doesn't seem to work in scons 1.20
++# Substfile in scons 1.3.0+, since 2010
+ def substituter(target, source, env):
+     substmap = (
+         ('@ANNOUNCE@',   annmail),
+@@ -2371,8 +2374,8 @@ else:
+             ' $SRCDIR/test/clientlib/*.log', ])
+     # Unit-test the bitfield extractor
+     misc_regress = Utility('misc-regress', [], [
+-        '{} $SRCDIR/test_clienthelpers.py'.format(target_python_path.decode()),
+-        '{} $SRCDIR/test_misc.py'.format(target_python_path.decode())
++        '{} $SRCDIR/test_clienthelpers.py'.format(target_python_path),
++        '{} $SRCDIR/test_misc.py'.format(target_python_path)
+     ])
+ 
+ 
diff --git a/patches/gpsd-3.20/0013-SConstruct-fix-polystr-for-python2.patch b/patches/gpsd-3.20/0013-SConstruct-fix-polystr-for-python2.patch
new file mode 100644
index 000000000..0223a2735
--- /dev/null
+++ b/patches/gpsd-3.20/0013-SConstruct-fix-polystr-for-python2.patch
@@ -0,0 +1,34 @@
+From: "Gary E. Miller" <gem@rellim.com>
+Date: Fri, 10 Jan 2020 18:43:17 -0800
+Subject: [PATCH] SConstruct: fix polystr() for python2
+
+---
+ SConstruct | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index f45efe4e19f0..a4f8cdc763cd 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1152,11 +1152,16 @@ PYTHON_CONFIG_CALL = ('sysconfig.get_config_vars(%s)'
+ # ugly hack from http://www.catb.org/esr/faqs/practical-python-porting/
+ # handle python2/3 strings
+ def polystr(o):
+-    if isinstance(o, str):
+-        return o
+-    if isinstance(o, bytes):
+-        return str(o, encoding='latin-1')
+-    raise ValueError
++    if bytes is str:  # Python 2
++        return str(o)
++    else:             # python 3.
++        if isinstance(o, str):
++            return o
++        if isinstance(o, bytes) or isinstance(o, bytearray):
++            return str(o, encoding='latin1')
++        if isinstance(o, int):
++            return str(o)
++        raise ValueError
+ 
+ 
+ # flag that we have xgps* dependencies, so xgps* should run OK
diff --git a/patches/gpsd-3.20/0100-SConstruct-Use-target_python-when-constructing-exten.patch b/patches/gpsd-3.20/0100-SConstruct-Use-target_python-when-constructing-exten.patch
new file mode 100644
index 000000000..e01d92353
--- /dev/null
+++ b/patches/gpsd-3.20/0100-SConstruct-Use-target_python-when-constructing-exten.patch
@@ -0,0 +1,36 @@
+From: Ladislav Michl <ladis@linux-mips.org>
+Date: Sun, 2 Feb 2020 00:42:42 +0100
+Subject: [PATCH] SConstruct: Use target_python when constructing extension
+ name
+
+---
+ SConstruct | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index a4f8cdc763cd..cd30bb86f4ac 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1234,6 +1234,12 @@ elif config.env['python']:
+         else:
+             config.env['aiogps'] = True
+ 
++        # get version part of python extension name
++        ext_python_ver = config.GetPythonValue('ext version string',
++                                               'import sys',
++                                               '"_".join(map(str, '
++                                               'sys.version_info))')
++
+         # check for pyserial
+         if not config.GetPythonValue('module serial (pyserial)',
+                                      'import serial', '"found"'):
+@@ -1756,8 +1762,7 @@ else:
+             python_objects[ext].append(
+                 python_env.NoCache(
+                     python_env.SharedObject(
+-                        src.split(".")[0] + '-py_' +
+-                        '_'.join(['%s' % (x) for x in sys.version_info]) +
++                        src.split(".")[0] + '-py_' + ext_python_ver +
+                         python_config['SO'], src
+                     )
+                 )
diff --git a/patches/gpsd-3.19/0001-Search-for-ncursesw-pkgconfig.patch b/patches/gpsd-3.20/0101-SConstruct-Search-for-ncursesw-pkgconfig.patch
similarity index 79%
rename from patches/gpsd-3.19/0001-Search-for-ncursesw-pkgconfig.patch
rename to patches/gpsd-3.20/0101-SConstruct-Search-for-ncursesw-pkgconfig.patch
index 235d5b36e..ac233ca96 100644
--- a/patches/gpsd-3.19/0001-Search-for-ncursesw-pkgconfig.patch
+++ b/patches/gpsd-3.20/0101-SConstruct-Search-for-ncursesw-pkgconfig.patch
@@ -1,8 +1,8 @@
 From: Ladislav Michl <ladis@linux-mips.org>
 Date: Fri, 25 Oct 2019 14:18:30 +0200
-Subject: [PATCH] Search for ncursesw pkgconfig
+Subject: [PATCH] SConstruct: Search for ncursesw pkgconfig
 
-PTXDist can be configured to build wide char verson of ncurses
+PTXDist can be configured to build wide char version of ncurses
 which SConstruct is unaware of.
 
 Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
@@ -11,10 +11,10 @@ Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
  1 file changed, 2 insertions(+)
 
 diff --git a/SConstruct b/SConstruct
-index 5160481a7a7b..7bd5b08f2a46 100644
+index cd30bb86f4ac..841eb06b7793 100644
 --- a/SConstruct
 +++ b/SConstruct
-@@ -826,6 +826,8 @@ else:
+@@ -807,6 +807,8 @@ else:
              ncurseslibs = pkg_config('ncurses', rpath_hack=True)
              if config.CheckPKG('tinfo'):
                  ncurseslibs += pkg_config('tinfo', rpath_hack=True)
diff --git a/patches/gpsd-3.20/0102-SConstruct-HACK-use-target-INCLUDEPY.patch b/patches/gpsd-3.20/0102-SConstruct-HACK-use-target-INCLUDEPY.patch
new file mode 100644
index 000000000..c597c8393
--- /dev/null
+++ b/patches/gpsd-3.20/0102-SConstruct-HACK-use-target-INCLUDEPY.patch
@@ -0,0 +1,25 @@
+From: Ladislav Michl <ladis@linux-mips.org>
+Date: Fri, 7 Feb 2020 10:53:19 +0100
+Subject: [PATCH] SConstruct: HACK: use target INCLUDEPY
+
+Once PTXdist's cross-python starts returning proper INCLUDEPY
+path, this hack will wanish.
+
+Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
+---
+ SConstruct | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/SConstruct b/SConstruct
+index 841eb06b7793..3d885a17a5b9 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1748,7 +1748,7 @@ else:
+                        LINK=ldshared,
+                        SHLIBPREFIX="",
+                        SHLIBSUFFIX=python_config['SO'],
+-                       CPPPATH=[python_config['INCLUDEPY']],
++                       CPPPATH=[os.getenv('SYSROOT') + python_config['INCLUDEPY']],
+                        CPPFLAGS=[],
+                        CFLAGS=[],
+                        CXXFLAGS=[])
diff --git a/patches/gpsd-3.20/series b/patches/gpsd-3.20/series
new file mode 100644
index 000000000..cf6301f6d
--- /dev/null
+++ b/patches/gpsd-3.20/series
@@ -0,0 +1,20 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-SConstruct-replace-custom-CheckSizeOf-with-standard-.patch
+0002-SConstruct-Always-install-xpgs-xgpsspeed-programs-ma.patch
+0003-SConstruct-Always-install-xgps-.-Only-test-if-deps-f.patch
+0004-SConstruct-Skip-sizeof-time_t-test-when-cross-compil.patch
+0005-Fix-merging-and-using-of-python-flags.patch
+0006-SConstruct-Remove-redundant-CheckHeaderDefines.patch
+0007-SConstruct-remove-redundant-CheckCompilerDefines.patch
+0008-SConstruct-GetPythonValue-and-CheckPKG-were-using-wr.patch
+0009-SConstruct-Fix-GetPythonValue-for-python-3.patch
+0010-SConstruct-move-more-checks-into-GetPythonValue.patch
+0011-SConstruct-Check-target-python-version-not-scons-pyt.patch
+0012-SConstruct-Simplify-GetPythonValue-.-It-now-caches-p.patch
+0013-SConstruct-fix-polystr-for-python2.patch
+#tag:ptx --start-number 100
+0100-SConstruct-Use-target_python-when-constructing-exten.patch
+0101-SConstruct-Search-for-ncursesw-pkgconfig.patch
+0102-SConstruct-HACK-use-target-INCLUDEPY.patch
+# 0b0660f42833b6e75cc0bdf50a2eec25  - git-ptx-patches magic
diff --git a/rules/gpsd.in b/rules/gpsd.in
index 57731d040..154068162 100644
--- a/rules/gpsd.in
+++ b/rules/gpsd.in
@@ -13,6 +13,7 @@ menuconfig GPSD
 	select NCURSES			if GPSD_NCURSES
 	select DBUS_GLIB		if GPSD_DBUS
 	select PYTHON3			if GPSD_PYTHON
+	select PYSERIAL3		if GPSD_PYSERIAL
 	prompt "gpsd                          "
 	help
 	  gpsd is a daemon that listens to a GPS or Loran receiver
@@ -27,25 +28,15 @@ if GPSD
 config GPSD_NCURSES
 	bool
 
-comment "time service     ---"
-
-config GPSD_NTP
+config GPSD_PYSERIAL
 	bool
-	prompt "NTP time hinting support"
 
-config GPSD_NTPSHM
-	bool
-	depends on GPSD_NTP
-	prompt "NTP time hinting via shared memory"
+comment "time service     ---"
 
 config GPSD_OSCILLATOR
 	bool
 	prompt "Disciplined oscillator support"
 
-config GPSD_PPS
-	bool
-	prompt "PPS time syncing support"
-
 comment "export methods   ---"
 
 config GPSD_DBUS
@@ -111,14 +102,6 @@ config GPSD_USER
 	help
 	  This user is used for privilege separation.
 
-config GPSD_FIXED_PORT_SPEED
-	string
-	prompt "fixed port speed"
-
-config GPSD_FIXED_PORT_BITS
-	string
-	prompt "fixed port bits"
-
 config GPSD_MAX_CLIENTS
 	string
 	prompt "max clients"
@@ -207,7 +190,6 @@ menu "drivers"
 
 	config GPSD_DRIVER_UBX
 		bool
-		select GPSD_NTPSHM
 		select GPSD_DRIVER_NMEA
 		prompt "ubx"
 
@@ -367,8 +349,6 @@ menu "install options"
 
 	config GPSD_NTPSHMMON
 		bool
-		select GPSD_NTP
-		select GPSD_PPS
 		select GPSD_SHM
 		prompt "ntpshmmon"
 		help
@@ -431,6 +411,7 @@ menu "install options"
 	config GPSD_UBXTOOL
 		bool
 		select GPSD_PYTHON
+		select GPSD_PYSERIAL
 		prompt "ubxtool"
 		help
 		  ubxtool is a tool for u-blox GPS. ubxtool can decode common
@@ -441,6 +422,7 @@ menu "install options"
 	config GPSD_ZERK
 		bool
 		select GPSD_PYTHON
+		select GPSD_PYSERIAL
 		prompt "zerk"
 		help
 		  zerk is an all purpose GREIS fitting. zerk can decode common
diff --git a/rules/gpsd.make b/rules/gpsd.make
index afe02c925..e6c166150 100644
--- a/rules/gpsd.make
+++ b/rules/gpsd.make
@@ -16,8 +16,8 @@ PACKAGES-$(PTXCONF_GPSD) += gpsd
 #
 # Paths and names
 #
-GPSD_VERSION	:= 3.19
-GPSD_MD5	:= b3bf88706794eb8e5f2c2543bf7ba87b
+GPSD_VERSION	:= 3.20
+GPSD_MD5	:= cf7fdec7ce7221d20bee1a7246362b05
 GPSD		:= gpsd-$(GPSD_VERSION)
 GPSD_SUFFIX	:= tar.gz
 GPSD_URL	:= http://download.savannah.gnu.org/releases/gpsd/$(GPSD).$(GPSD_SUFFIX)
@@ -52,6 +52,8 @@ GPSD_PROGS-$(PTXCONF_GPSD_UBXTOOL)	+= ubxtool
 GPSD_PROGS-$(PTXCONF_GPSD_ZERK)		+= zerk
 
 GPSD_CONF_TOOL	:= scons
+GPSD_CONF_ENV	:= \
+	$(CROSS_ENV_PKG_CONFIG)
 GPSD_CONF_OPT	:= \
 	aivdm=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_AIVDM) \
 	ashtech=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_ASHTECH) \
@@ -75,10 +77,8 @@ GPSD_CONF_OPT	:= \
 	gpsdclients=$(GPSD_BUILD_CLIENTS) \
 	greis=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_GREIS) \
 	implicit_link=yes \
-	ipv6=$(call ptx/yesno, PTXCONF_GLOBAL_IPV6) \
 	isync=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_ISYNC) \
 	itrax=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_ITRAX) \
-	leapfetch=yes \
 	libdir=/usr/$(CROSS_LIB_DIR) \
 	libgpsmm=no \
 	magic_hat=no \
@@ -90,16 +90,12 @@ GPSD_CONF_OPT	:= \
 	netfeed=yes \
 	nmea0183=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_NMEA) \
 	nmea2000=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_NMEA) \
-	nofloats=no \
 	nostrip=yes \
-	ntp=$(call ptx/yesno, PTXCONF_GPSD_NTP) \
-	ntpshm=$(call ptx/yesno, PTXCONF_GPSD_SHM) \
 	ntrip=$(call ptx/yesno, GPSD_DRIVER_NTRIP) \
 	oceanserver=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_OCEANSERVER) \
 	oncore=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_ONCORE) \
 	oscillator=$(call ptx/yesno, PTXCONF_GPSD_OSCILLATOR) \
 	passthrough=no \
-	pps=$(call ptx/yesno, PTXCONF_GPSD_PPS) \
 	prefix=/usr \
 	profiling=$(call ptx/yesno, PTXCONF_GPSD_PROFILING) \
 	python=$(call ptx/yesno, PTXCONF_GPSD_PYTHON) \
@@ -116,12 +112,10 @@ GPSD_CONF_OPT	:= \
 	squelch=yes \
 	superstar2=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_SUPERSTAR2) \
 	sysconfdir=/etc \
-	sysroot=$(SYSROOT) \
 	systemd=$(call ptx/yesno, PTXCONF_GPSD_SYSTEMD) \
 	target=$(PTXCONF_GNU_TARGET) \
 	target_python=$(CROSS_PYTHON3) \
 	timeservice=no \
-	timing=no \
 	tnt=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_TNT) \
 	tripmate=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_TRIPMATE) \
 	tsip=$(call ptx/yesno, PTXCONF_GPSD_DRIVER_TSIP) \
@@ -130,13 +124,6 @@ GPSD_CONF_OPT	:= \
 	usb=$(call ptx/yesno, PTXCONF_GPSD_USB) \
 	xgps=no
 
-ifneq ($(call remove_quotes,$(PTXCONF_GPSD_FIXED_PORT_SPEED)),)
-GPSD_CONF_OPT += fixed_port_speed=$(PTXCONF_GPSD_FIXED_PORT_SPEED)
-endif
-ifneq ($(call remove_quotes,$(PTXCONF_GPSD_FIXED_PORT_BITS)),)
-GPSD_CONF_OPT += fixed_port_bits=$(PTXCONF_GPSD_FIXED_PORT_BITS)
-endif
-
 ifneq ($(call remove_quotes,$(PTXCONF_GPSD_GROUP)),)
 GPSD_CONF_OPT += gpsd_group=$(PTXCONF_GPSD_GROUP)
 endif
-- 
2.25.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

                 reply	other threads:[~2020-02-09 16:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200209165904.GA334775@lenoch \
    --to=ladis@linux-mips.org \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox