[Git][NTPsec/ntpsec][master] waf: turn off debugging by default. Add --enable-debug.

Gary E. Miller gitlab at mg.gitlab.com
Thu Apr 6 20:26:47 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
302f32a7 by Gary E. Miller at 2017-04-06T13:15:18-07:00
waf: turn off debugging by default.  Add --enable-debug.

Now the ntpd binary is stripped by default, so is 100kB smaller.
Several annoying warnings turned on for developer use.

- - - - -


1 changed file:

- wafhelpers/configure.py


Changes:

=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -262,35 +262,44 @@ def cmd_configure(ctx, config):
 
     if ctx.options.enable_debug_gdb:
         ctx.env.CFLAGS += ["-g"]
+        ctx.options.enable_debug = 1
     else:
         cc_test_flags += [
             ('LTO', '-flto'),
             ]
 
-    if not ctx.options.disable_debug:
+    # Check which linker flags are supported
+    ld_hardening_flags = [
+        ("z_now", "-Wl,-z,now"),     # no deferred symbol resolution
+    ]
+
+    if ctx.options.enable_debug:
         ctx.define("DEBUG", 1, comment="Enable debug mode")
         ctx.env.BISONFLAGS += ["--debug"]
+        # turn on some annoying warnings
+        ctx.env.CFLAGS += [
+            "-Wfloat-equal",          # Not Ready For Prime Time
+            "-Wmissing-prototypes",   # Not Ready For Prime Time
+            "-Wmissing-declarations", # Not Ready For Primt Time
+            "-Wsign-conversion",      # fails on Solaris and OpenBSD 6
+        ]
+    else:
+        # not debugging
+        ld_hardening_flags += [
+            ('stripall', "-Wl,--strip-all"),    # Strip binaries
+            ]
 
     ctx.env.CFLAGS += [
         # -O1 will turn on -D_FORTIFY_SOURCE=2 for us
         "-O1",
         "-Wall",
         "-Wextra",
-        # "-Wfloat-equal",   # Not Ready For Prime Time
-        # "-Wmissing-prototypes",  # Not Ready For Prime Time
-        # "-Wmissing-declarations", # Not Ready For Primt Time
-        # "-Wsign-conversion",      # fails on Solaris and OpenBSD 6
         "-Wshadow",
         "-Wstrict-prototypes",
         "-Wundef",
         "-Wunused",
         ]
 
-    # Check which linker flags are supported
-    ld_hardening_flags = [
-        ("z_now", "-Wl,-z,now"),     # no deferred symbol resolution
-    ]
-
     FRAGMENT = '''
 int main(int argc, char **argv) {
         (void)argc; (void)argv;
@@ -351,12 +360,6 @@ int main(int argc, char **argv) {
             "-flto",
             ]
 
-    if ctx.options.disable_debug:
-        # not debugging
-        ld_hardening_flags += [
-            ('stripall', "-Wl,--strip-all"),    # Strip binaries
-            ]
-
     # old gcc takes -z,relro, but then barfs if -fPIE available and used.
     # ("relro", "-Wl,-z,relro"), # marks some sections read only
     old_run_build_cls = ctx.run_build_cls
@@ -756,12 +759,7 @@ int main(int argc, char **argv) {
     msg_setting("LDFLAGS", " ".join(ctx.env.LDFLAGS))
     msg_setting("LINKFLAGS_NTPD", " ".join(ctx.env.LINKFLAGS_NTPD))
     msg_setting("PREFIX", ctx.env.PREFIX)
-    msg_setting("Debug Support", yesno(not ctx.options.disable_debug))
+    msg_setting("Debug Support", yesno(ctx.options.enable_debug))
     msg_setting("Refclocks", ", ".join(ctx.env.REFCLOCK_LIST))
     msg_setting("Build Manpages",
                 yesno(ctx.env.ENABLE_DOC and not ctx.env.DISABLE_MANPAGE))
-
-    if ctx.options.enable_debug:
-        msg("")
-        msg("*** --enable-debug ignored.  (default on now)")
-        msg("")



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/302f32a75b9aa3e14a1ba9a7c1a0768a09f43bd8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170406/2667a740/attachment.html>


More information about the vc mailing list