Ticket #50288: patch-SConstruct.diff

File patch-SConstruct.diff, 8.2 KB (added by fhgwright (Fred Wright), 9 years ago)

Patch for SConstruct build script

  • SConstruct

    old new  
    162162    ("manbuild",      True,  "build help in man and HTML formats"),
    163163    ("leapfetch",     True,  "fetch up-to-date data on leap seconds."),
    164164    ("minimal",       False, "turn off every option not set on the command line"),
     165    ("xgps",          True,  "include xgps and xgpsspeed."),
    165166    # Test control
    166167    ("slow",          False, "run tests with realistic (slow) delays"),
    167168    )
     
    186187    ("fixed_stop_bits",     0,             "fixed serial port stop bits"),
    187188    ("target",              "",            "cross-development target"),
    188189    ("sysroot",             "",            "cross-development system root"),
     190    ("qt_versioned",        "",            "version for versioned Qt"),
    189191    )
    190192for (name, default, help) in nonboolopts:
    191193    opts.Add(name, help, default)
     
    744746typedef int clockid_t;
    745747#define CLOCKID_T_DEFINED
    746748# endif
    747 /* OS X uses _STRUCT_TIMESPEC, but no clock_gettime */
    748 #ifndef _STRUCT_TIMESPEC
     749/* OS X 10.5 and later use _STRUCT_TIMESPEC; 10.4 uses _TIMESPEC; 10.3 and earlier use _TIMESPEC_DEFINED */
     750#if !defined _STRUCT_TIMESPEC && !defined _TIMESPEC && !defined _TIMESPEC_DEFINED
    749751struct timespec {
    750752    time_t  tv_sec;
    751753    long    tv_nsec;
    752754};
     755#define _STRUCT_TIMESPEC
    753756#endif
     757/* OS X does not have clock_gettime */
    754758#define CLOCK_REALTIME  0
    755759int clock_gettime(clockid_t, struct timespec *);
    756760# ifdef __cplusplus
     
    785789                                          src_suffix=".xml", suffix=".html")
    786790
    787791    # Determine if Qt network libraries are present, and if not, force qt to off
    788     qt_network = config.CheckPKG('QtNetwork')
     792    qt_net_name = 'Qt%sNetwork' % env["qt_versioned"]
     793    qt_network = config.CheckPKG(qt_net_name)
    789794    if not qt_network:
    790795        env["qt"] = False
    791796
     
    813818        qt_env.MergeFlags('-DUSE_QT')
    814819        qt_env.Append(OBJPREFIX='qt-')
    815820        try:
    816             qt_env.MergeFlags(pkg_config('QtNetwork'))
     821            qt_env.MergeFlags(pkg_config(qt_net_name))
    817822        except OSError:
    818             announce("pkg_config is confused about the state of QtNetwork.")
     823            announce("pkg_config is confused about the state of %s."
     824                     % qt_net_name)
    819825            qt_env = None
    820826    else:
    821827        qt_env = None
     
    985991## Production programs
    986992
    987993gpsd = env.Program('gpsd', gpsd_sources,
    988                    LIBS=['gpsd', 'gps_static'], LIBPATH='.',
     994                   LIBS=['gpsd', 'gps_static'],
    989995                   parse_flags=gpsdflags+gpsflags)
    990996gpsdecode = env.Program('gpsdecode', ['gpsdecode.c'],
    991                         LIBS=['gpsd', 'gps_static'], LIBPATH='.',
     997                        LIBS=['gpsd', 'gps_static'],
    992998                        parse_flags=gpsdflags+gpsflags)
    993999gpsctl = env.Program('gpsctl', ['gpsctl.c'],
    994                      LIBS=['gpsd', 'gps_static'], LIBPATH='.',
     1000                     LIBS=['gpsd', 'gps_static'],
    9951001                     parse_flags=gpsdflags+gpsflags)
    9961002gpsmon = env.Program('gpsmon', gpsmon_sources,
    997                      LIBS=['gpsd', 'gps_static'], LIBPATH='.',
     1003                     LIBS=['gpsd', 'gps_static'],
    9981004                     parse_flags=gpsdflags + gpsflags + ncurseslibs)
    9991005gpsdctl = env.Program('gpsdctl', ['gpsdctl.c'],
    1000                       LIBS=['gps_static'], LIBPATH='.',
     1006                      LIBS=['gps_static'],
    10011007                      parse_flags=gpsflags)
    10021008gpspipe = env.Program('gpspipe', ['gpspipe.c'],
    1003                       LIBS=['gps_static'], LIBPATH='.',
     1009                      LIBS=['gps_static'],
    10041010                      parse_flags=gpsflags)
    10051011gps2udp = env.Program('gps2udp', ['gps2udp.c'],
    1006                       LIBS=['gps_static'], LIBPATH='.',
     1012                      LIBS=['gps_static'],
    10071013                      parse_flags=gpsflags)
    10081014gpxlogger = env.Program('gpxlogger', ['gpxlogger.c'],
    1009                         LIBS=['gps_static'], LIBPATH='.',
     1015                        LIBS=['gps_static'],
    10101016                        parse_flags=gpsflags)
    10111017lcdgps = env.Program('lcdgps', ['lcdgps.c'],
    1012                      LIBS=['gps_static'], LIBPATH='.',
     1018                     LIBS=['gps_static'],
    10131019                     parse_flags=gpsflags)
    10141020cgps = env.Program('cgps', ['cgps.c'],
    1015                    LIBS=['gps_static'], LIBPATH='.',
     1021                   LIBS=['gps_static'],
    10161022                   parse_flags=gpsflags + ncurseslibs)
    10171023ntpshmmon = env.Program('ntpshmmon', ['ntpshmmon.c'],
    1018                         LIBS=['gps_static'], LIBPATH='.',
     1024                        LIBS=['gps_static'],
    10191025                        parse_flags=gpsflags)
    10201026
    10211027binaries = [gpsd, gpsdecode, gpsctl, gpsdctl, gpspipe, gps2udp, gpxlogger, lcdgps, ntpshmmon]
     
    10231029    binaries += [cgps, gpsmon]
    10241030
    10251031# Test programs - always link locally and statically
    1026 test_bits = env.Program('test_bits', ['test_bits.c'],
    1027                         LIBS=['gps_static'], LIBPATH='.')
     1032test_bits = env.Program('test_bits', ['test_bits.c'], LIBS=['gps_static'])
    10281033test_float = env.Program('test_float', ['test_float.c'])
    10291034test_geoid = env.Program('test_geoid', ['test_geoid.c'],
    10301035                         LIBS=['gpsd', 'gps_static'],
    1031                          LIBPATH='.', parse_flags=gpsdflags)
     1036                         parse_flags=gpsdflags)
    10321037test_matrix = env.Program('test_matrix', ['test_matrix.c'],
    10331038                          LIBS=['gpsd', 'gps_static'],
    1034                           LIBPATH='.', parse_flags=gpsdflags)
     1039                          parse_flags=gpsdflags)
    10351040test_mktime = env.Program('test_mktime', ['test_mktime.c'],
    1036                           LIBS=['gps_static'], LIBPATH='.', parse_flags=["-lm"])
     1041                          LIBS=['gps_static'], parse_flags=["-lm"])
    10371042test_packet = env.Program('test_packet', ['test_packet.c'],
    10381043                          LIBS=['gpsd', 'gps_static'],
    1039                           LIBPATH='.', parse_flags=gpsdflags)
     1044                          parse_flags=gpsdflags)
    10401045test_timespec = env.Program('test_timespec', ['test_timespec.c'],
    10411046                          LIBS=['gpsd', 'gps_static'],
    1042                           LIBPATH='.', parse_flags=gpsdflags)
     1047                          parse_flags=gpsdflags)
    10431048test_trig = env.Program('test_trig', ['test_trig.c'], parse_flags=["-lm"])
    10441049# test_libgps for glibc older than 2.17
    10451050test_libgps = env.Program('test_libgps', ['test_libgps.c'],
    1046                           LIBS=['gps_static'], LIBPATH='.', parse_flags=["-lm"] + rtlibs + dbusflags)
     1051                          LIBS=['gps_static'],
     1052                          parse_flags=["-lm"] + rtlibs + dbusflags)
    10471053
    10481054if not env['socket_export']:
    10491055    announce("test_json not building because socket_export is disabled")
     
    10511057else:
    10521058    test_json = env.Program(
    10531059        'test_json', ['test_json.c'],
    1054         LIBS=['gps_static'], LIBPATH='.',
     1060        LIBS=['gps_static'],
    10551061        parse_flags=["-lm"] + rtlibs + usbflags + dbusflags)
    10561062
    10571063test_gpsmm = env.Program('test_gpsmm', ['test_gpsmm.cpp'],
    1058                          LIBS=['gps_static'], LIBPATH='.', parse_flags=["-lm"])
     1064                         LIBS=['gps_static'], parse_flags=["-lm"])
    10591065testprogs = [test_bits, test_float, test_geoid, test_libgps, test_matrix, test_mktime, test_packet, test_timespec, test_trig]
    10601066if env['socket_export']:
    10611067    testprogs.append(test_json)
     
    10681074    python_targets = []
    10691075    python_progs = []
    10701076else:
    1071     python_progs = ["gpscat", "gpsfake", "gpsprof", "xgps", "xgpsspeed", "gegps"]
     1077    python_progs = ["gpscat", "gpsfake", "gpsprof", "gegps"]
     1078    if env['xgps']:
     1079        python_progs.extend(["xgps", "xgpsspeed"])
    10721080    python_modules = Glob('gps/*.py')
    10731081
    10741082    # Build Python binding
     
    11141122    else:
    11151123        python_env['CXX'] = ' '.join([env['CXX']] + cxx.split()[1:])
    11161124
     1125    ldshared=ldshared.replace(cc, env['CC'])
    11171126    ldshared=ldshared.replace('-fPIE', '')
    11181127    ldshared=ldshared.replace('-pie', '')
    11191128    python_env.Replace(SHLINKFLAGS=[],
     
    13071316    "gpsprof.1" : "gpsprof.xml",
    13081317    "gpsfake.1" : "gpsfake.xml",
    13091318    "gpscat.1" : "gpscat.xml",
    1310     "xgpsspeed.1" : "gps.xml",
    1311     "xgps.1" : "gps.xml",
    13121319    "gegps.1" : "gps.xml",
    13131320    }
     1321if env['xgps']:
     1322    python_manpages.update({
     1323        "xgpsspeed.1" : "gps.xml",
     1324        "xgps.1" : "gps.xml",
     1325    })
    13141326
    13151327manpage_targets = []
    13161328if manbuilder: