sizes 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/env python3
  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. "clientdebug=no",
  46. "oldstyle=no",
  47. ]
  48. class BuildFailed(BaseException):
  49. "Build failed for this configuration."
  50. pass
  51. def sizeit(legend, tag, options):
  52. print(legend + ":")
  53. print("Options:", " ".join(options))
  54. os.system("scons -c > /dev/null; rm -fr .scon*")
  55. status = os.system("scons shared=no " + " ".join(options)
  56. + " gpsd >/dev/null")
  57. if status != 0:
  58. raise BuildFailed(options)
  59. os.rename("gpsd", "gpsd-" + tag + "-build")
  60. os.rename("gpsd_config.h", "gpsd_config.h-" + tag)
  61. # Main sequence
  62. os.system("uname -a")
  63. sizeit("Minimalist build, stripped to NMEA only with shm interface",
  64. "minimalist",
  65. ["socket_export=no",
  66. "control_socket=no",
  67. "ipv6=no",
  68. "netfeed=no",
  69. "passthrough=no",
  70. "fixed_port_speed=9600",
  71. "max_devices=1",
  72. ] + nmea_variants + binary_gps + non_gps + time_service + debugging)
  73. sizeit("Normal build, configure options defaulted", "normal", [])
  74. os.system("size gpsd-*-build")
  75. # os.system("rm gpsd-*-build gpsd.h-*")
  76. os.system("scons -c > /dev/null; rm -fr .scon*")
  77. # end