summaryrefslogtreecommitdiff
path: root/devtools/sizes
blob: b8afa6eacf66cd975518c15943522a149a100c8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python
#
# sizes -- explore the sizes of static gpsd binaries
#
# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
from __future__ import absolute_import, print_function, division

import os

# NMEA variants other than vanilla NMEA
nmea_variants = [
  "fv18=no",
  "mtk3301=no",
  "tnt=no",
  "oceanserver=no",
  "gpsclock=no",
]

# Binary GPS protocols
binary_gps = [
  "oncore=no",
  "sirf=no",
  "superstar2=no",
  "tsip=no",
  "tripmate=no",
  "earthmate=no",
  "itrax=no",
  "ashtech=no",
  "navcom=no",
  "garmin=no",
  "garmintxt=no",
  "ubx=no",
  "geostar=no",
  "evermore=no",
]

# Differential correction and AIVDM
non_gps = [
  "rtcm104v2=no",
  "rtcm104v3=no",
  "ntrip=no",
  "aivdm=no",
  ]

# Time service
time_service = ["ntpshm=no", "pps=no"]

# Debugging and profiling
debugging = [
  "timing=no",
  "clientdebug=no",
  "oldstyle=no",
  ]


class BuildFailed(BaseException):
    "Build failed for this configuration."
    pass


def sizeit(legend, tag, options):
    print(legend + ":")
    print("Options:", " ".join(options))
    os.system("scons -c > /dev/null; rm -fr .scon*")
    status = os.system("scons shared=no " + " ".join(options)
                       + " gpsd >/dev/null")
    if status != 0:
        raise BuildFailed(options)
    os.rename("gpsd", "gpsd-" + tag + "-build")
    os.rename("gpsd_config.h", "gpsd_config.h-" + tag)


# Main sequence
os.system("uname -a")
sizeit("Minimalist build, stripped to NMEA only with shm interface",
       "minimalist",
       ["socket_export=no",
        "control_socket=no",
        "ipv6=no",
        "netfeed=no",
        "passthrough=no",
        "fixed_port_speed=9600",
        "max_devices=1",
        ] + nmea_variants + binary_gps + non_gps + time_service + debugging)
sizeit("Normal build, configure options defaulted", "normal", [])
os.system("size gpsd-*-build")
#os.system("rm gpsd-*-build gpsd.h-*")
os.system("scons -c > /dev/null; rm -fr .scon*")

#end