sizes 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/usr/bin/env python
  2. #
  3. # sizes -- explore the sizes of static gpsd binaries
  4. #
  5. # This code runs compatibly under Python 2 and 3.x for x >= 2.
  6. # Preserve this property!
  7. from __future__ import absolute_import, print_function, division
  8. import os
  9. # NMEA variants other than vanilla NMEA
  10. nmea_variants = [
  11. "fv18=no",
  12. "mtk3301=no",
  13. "tnt=no",
  14. "oceanserver=no",
  15. "gpsclock=no",
  16. ]
  17. # Binary GPS protocols
  18. binary_gps = [
  19. "oncore=no",
  20. "sirf=no",
  21. "superstar2=no",
  22. "tsip=no",
  23. "tripmate=no",
  24. "earthmate=no",
  25. "itrax=no",
  26. "ashtech=no",
  27. "navcom=no",
  28. "garmin=no",
  29. "garmintxt=no",
  30. "ubx=no",
  31. "geostar=no",
  32. "evermore=no",
  33. ]
  34. # Differential correction and AIVDM
  35. non_gps = [
  36. "rtcm104v2=no",
  37. "rtcm104v3=no",
  38. "ntrip=no",
  39. "aivdm=no",
  40. ]
  41. # Time service
  42. time_service = ["ntpshm=no", "pps=no"]
  43. # Debugging and profiling
  44. debugging = [
  45. "timing=no",
  46. "clientdebug=no",
  47. "oldstyle=no",
  48. ]
  49. class BuildFailed(BaseException):
  50. "Build failed for this configuration."
  51. pass
  52. def sizeit(legend, tag, options):
  53. print(legend + ":")
  54. print("Options:", " ".join(options))
  55. os.system("scons -c > /dev/null; rm -fr .scon*")
  56. status = os.system("scons shared=no " + " ".join(options)
  57. + " gpsd >/dev/null")
  58. if status != 0:
  59. raise BuildFailed(options)
  60. os.rename("gpsd", "gpsd-" + tag + "-build")
  61. os.rename("gpsd_config.h", "gpsd_config.h-" + tag)
  62. # Main sequence
  63. os.system("uname -a")
  64. sizeit("Minimalist build, stripped to NMEA only with shm interface",
  65. "minimalist",
  66. ["socket_export=no",
  67. "control_socket=no",
  68. "ipv6=no",
  69. "netfeed=no",
  70. "passthrough=no",
  71. "fixed_port_speed=9600",
  72. "max_devices=1",
  73. ] + nmea_variants + binary_gps + non_gps + time_service + debugging)
  74. sizeit("Normal build, configure options defaulted", "normal", [])
  75. os.system("size gpsd-*-build")
  76. # os.system("rm gpsd-*-build gpsd.h-*")
  77. os.system("scons -c > /dev/null; rm -fr .scon*")
  78. # end