diff --git a/SConstruct b/SConstruct index 290910b..5d343e6 100644 --- a/SConstruct +++ b/SConstruct @@ -967,8 +967,25 @@ gpsdlibs = ["-lgpsd"] + usblibs + bluezlibs + gpslibs # at runtime the shared libraries from the glibc version used for # linking # The final executable will build but not be portable. +# +# FIXME: This might clash with shared=False + +gpslib_static = env.StaticLibrary(target='gps', + source=libgps_sources, + parse_flags=dbus_libs + rtlibs) +env.Clean(gpslib_static, "gps_maskdump.c") + +gpsdlib_static = env.StaticLibrary(target='gpsd', + source=libgpsd_sources, + parse_flags=usblibs + rtlibs + bluezlibs) -env.StaticLibrary(target = 'libgps.a', source = libgps_sources) +gpsdlibs_static_flags = gpsdlibs +gpsdlibs_static_flags.remove("-lgpsd") +gpsdlibs_static_flags.append(["--static", "libgpsd.a"]) + +gpslibs_static_flags = gpslibs +gpslibs_static_flags.remove("-lgps") +gpslibs_static_flags.append(["--static", "libgps.a"]) # Source groups @@ -977,6 +994,7 @@ gpsd_sources = ['gpsd.c','ntpshm.c','shmexport.c','dbusexport.c'] if env['systemd']: gpsd_sources.append("sd_socket.c") + gpsmon_sources = [ 'gpsmon.c', 'monitor_italk.c', @@ -1031,21 +1049,21 @@ if ncurseslibs: # Test programs test_float = env.Program('test_float', ['test_float.c']) -test_geoid = env.Program('test_geoid', ['test_geoid.c'], parse_flags=gpsdlibs) -env.Depends(test_geoid, [compiled_gpsdlib, compiled_gpslib]) -test_json = env.Program('test_json', ['test_json.c'], parse_flags=gpslibs) -env.Depends(test_json, compiled_gpslib) -test_mkgmtime = env.Program('test_mkgmtime', ['test_mkgmtime.c'], parse_flags=gpslibs) -env.Depends(test_mkgmtime, compiled_gpslib) +test_geoid = env.Program('test_geoid', ['test_geoid.c'], parse_flags=gpsdlibs_static_flags) +env.Depends(test_geoid, [gpsdlib_static, gpslib_static]) +test_json = env.Program('test_json', ['test_json.c'], parse_flags=gpslibs_static_flags) +env.Depends(test_json, gpslib_static) +test_mkgmtime = env.Program('test_mkgmtime', ['test_mkgmtime.c'], parse_flags=gpslibs_static_flags) +env.Depends(test_mkgmtime, gpslib_static) test_trig = env.Program('test_trig', ['test_trig.c'], parse_flags=["-lm"]) test_packet = env.Program('test_packet', ['test_packet.c'], parse_flags=gpsdlibs) -env.Depends(test_packet, [compiled_gpsdlib, compiled_gpslib]) -test_bits = env.Program('test_bits', ['test_bits.c'], parse_flags=gpslibs) -env.Depends(test_bits, [compiled_gpsdlib, compiled_gpslib]) -test_gpsmm = env.Program('test_gpsmm', ['test_gpsmm.cpp'], parse_flags=gpslibs) -env.Depends(test_gpsmm, compiled_gpslib) -test_libgps = env.Program('test_libgps', ['test_libgps.c'], parse_flags=gpslibs) -env.Depends(test_libgps, compiled_gpslib) +env.Depends(test_packet, [gpsdlib_static, gpslib_static]) +test_bits = env.Program('test_bits', ['test_bits.c'], parse_flags=gpslibs_static_flags) +env.Depends(test_bits, [gpsdlib_static, gpslib_static]) +test_gpsmm = env.Program('test_gpsmm', ['test_gpsmm.cpp'], parse_flags=gpslibs_static_flags) +env.Depends(test_gpsmm, gpslib_static) +test_libgps = env.Program('test_libgps', ['test_libgps.c'], parse_flags=gpslibs_static_flags) +env.Depends(test_libgps, gpslib_static) testprogs = [test_float, test_trig, test_bits, test_packet, test_mkgmtime, test_geoid, test_libgps] if env['socket_export']: