[Git][NTPsec/ntpsec][master] Clean up waf include path configuration for C code

Matt Selsky gitlab at mg.gitlab.com
Fri Mar 8 21:28:52 UTC 2019



Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
407979f7 by Matt Selsky at 2019-03-08T05:11:15Z
Clean up waf include path configuration for C code

Remove our bld_includes and src_includes hooks since they don't seem to be compatible with waf-2.0
Limit waf task "includes" directives to what we actually need

- - - - -


9 changed files:

- attic/wscript
- libaes_siv/wscript
- libntp/wscript
- libparse/wscript
- ntpd/wscript
- ntpfrob/wscript
- ntptime/wscript
- tests/wscript
- wafhelpers/waf.py


Changes:

=====================================
attic/wscript
=====================================
@@ -1,14 +1,12 @@
 def build(ctx):
-    bldnode = ctx.bldnode.abspath()
-
     util = ['sht', 'digest-find', 'digest-timing', 'clocks']
 
     for name in util:
         ctx(
             target=name,
-            features="c cprogram bld_include src_include",
+            features="c cprogram",
+            includes=[ctx.bldnode.parent.abspath(), "../include"],
             source=[name + ".c"],
-            includes=["%s/%s/" % (bldnode, name)],
             use="ntp M CRYPTO RT PTHREAD",
             install_path=None,
         )


=====================================
libaes_siv/wscript
=====================================
@@ -5,7 +5,8 @@ def build(ctx):
 
     ctx(
         target="aes_siv",
-        features="c cstlib bld_include" ,
+        features="c cstlib",
+        includes=[ctx.bldnode.parent.abspath()],
         source="aes_siv.c",
         use="CRYPTO",
     )


=====================================
libntp/wscript
=====================================
@@ -41,12 +41,10 @@ def build(ctx):
     if not ctx.env.HAVE_STRLCAT or not ctx.env.HAVE_STRLCPY:
         libntp_source_sharable += ["strl_obsd.c"]
 
-    includes = ctx.env.PLATFORM_INCLUDES
-
     # C library
     ctx(
-        features="c cstlib bld_include src_include",
-        includes=includes,
+        features="c cstlib",
+        includes=[ctx.bldnode.parent.abspath(), "../include"] + ctx.env.PLATFORM_INCLUDES,
         source=libntp_source + libntp_source_sharable,
         target="ntp",
         use="SSL CRYPTO",
@@ -54,9 +52,9 @@ def build(ctx):
 
     # Loadable Python extension
     ctx(
-        features="c cshlib bld_include src_include pyext",
+        features="c cshlib pyext",
         install_path='${PYTHONARCHDIR}/ntp',
-        includes=includes,
+        includes=[ctx.bldnode.parent.abspath(), "../include"] + ctx.env.PLATFORM_INCLUDES,
         source=["pymodule.c"] + libntp_source_sharable,
         target="../pylib/ntpc",  # Put the output in the pylib directory
         use="M RT CRYPTO",


=====================================
libparse/wscript
=====================================
@@ -24,7 +24,8 @@ def build(ctx):
 
     ctx(
         target="parse",
-        features="c cstlib bld_include src_include",
+        features="c cstlib",
+        includes=[ctx.bldnode.parent.abspath(), "../include"],
         source=libparse_source,
         use="CRYPTO",
     )


=====================================
ntpd/wscript
=====================================
@@ -1,16 +1,13 @@
 
 def build(ctx):
-    srcnode = ctx.srcnode.abspath()
     bldnode = ctx.bldnode.abspath()
 
     if ctx.variant == "host":
         bison_source = ["ntp_parser.y"]
 
         ctx(
-            features="c src_include bld_include",
-            includes=["%s/ntpd/" % srcnode,
-                      "%s/" % ctx.bldnode.parent.abspath()
-                      ],
+            features="c",
+            includes=[ctx.bldnode.parent.abspath(), "../include", "."],
             source=bison_source,
             target="bison_obj",
             use="CRYPTO",
@@ -22,10 +19,8 @@ def build(ctx):
         keyword_gen_source = ["keyword-gen.c", ]
 
         ctx(
-            features="c cprogram bld_include src_include",
-            includes=["%s/ntpd/" % bldnode,
-                      "%s/" % ctx.bldnode.parent.abspath()
-                      ],
+            features="c cprogram",
+            includes=[ctx.bldnode.parent.abspath(), "../include", "."],
             install_path=None,
             source=keyword_gen_source,
             target="keyword-gen",
@@ -39,7 +34,7 @@ def build(ctx):
         ctx.add_group()
 
         ctx(
-            features="c bld_include src_include",
+            features="c",
             rule="%s/ntpd/keyword-gen ${SRC} > ${TGT}" % bldnode,
             source="ntp_parser.tab.h",
             target="ntp_keyword.h"
@@ -66,8 +61,8 @@ def build(ctx):
     ]
 
     ctx(
-        features="c bld_include src_include",
-        includes=["%s/libaes_siv/" % srcnode] + ctx.env.PLATFORM_INCLUDES,
+        features="c",
+        includes=[ctx.bldnode.parent.abspath(), "../include", "../libaes_siv"] + ctx.env.PLATFORM_INCLUDES,
         source=libntpd_source,
         target="libntpd_obj",
         use="CRYPTO aes_siv",
@@ -89,7 +84,8 @@ def build(ctx):
 
         ctx(
             target="refclock",
-            features="c bld_include src_include",
+            features="c",
+            includes=[ctx.bldnode.parent.abspath(), "../include"],
             source=refclock_source,
             use="CRYPTO",
         )
@@ -98,7 +94,8 @@ def build(ctx):
         for file, define in ctx.env.REFCLOCK_SOURCE:
             ctx(
                 defines=["%s=1" % define],
-                features="c bld_include src_include",
+                features="c",
+                includes=[ctx.bldnode.parent.abspath(), "../include"],
                 # XXX: These need to go into config.h
                 #      rather than the command line for the individual drivers
                 source="refclock_%s.c" % file,
@@ -124,10 +121,11 @@ def build(ctx):
     ]
 
     ctx(
-        features="c rtems_trace cprogram bld_include src_include",
-        includes=["%s/host/ntpd/" % ctx.bldnode.parent.abspath(),
-                  "%s/ntpd/" % srcnode,
-                  ] + ctx.env.PLATFORM_INCLUDES,
+        features="c rtems_trace cprogram",
+        includes=[
+            ctx.bldnode.parent.abspath(), "../include",
+            "%s/host/ntpd/" % ctx.bldnode.parent.abspath(), "."
+        ] + ctx.env.PLATFORM_INCLUDES,
         install_path='${SBINDIR}',
         source=ntpd_source,
         target="ntpd",


=====================================
ntpfrob/wscript
=====================================
@@ -1,12 +1,10 @@
 def build(ctx):
-    bldnode = ctx.bldnode.abspath()
-
     frob_sources = ['main.c', 'bumpclock.c', 'dump.c', 'jitter.c',
                     'precision.c', 'pps-api.c', 'tickadj.c']
 
     ctx(
-        features="c cprogram bld_include src_include",
-        includes=["%s/ntpfrob/" % bldnode],
+        features="c cprogram",
+        includes=[ctx.bldnode.parent.abspath(), "../include"],
         install_path='${BINDIR}',
         source=frob_sources,
         target="ntpfrob",


=====================================
ntptime/wscript
=====================================
@@ -1,15 +1,10 @@
 def build(ctx):
     if ctx.env.HEADER_SYS_TIMEX_H:
-        srcnode = ctx.srcnode.abspath()
-        bldnode = ctx.bldnode.abspath()
-
         ctx(
             target="ntptime",
-            features="c cprogram bld_include src_include",
+            features="c cprogram",
+            includes=[ctx.bldnode.parent.abspath(), "../include"],
             source=["ntptime.c"],
-            includes=["%s/ntptime/" % bldnode,
-                      "%s/ntptime/" % srcnode,
-                      ],
             use="ntp M RT",
             install_path='${BINDIR}',
         )


=====================================
tests/wscript
=====================================
@@ -3,7 +3,6 @@ from waflib import Utils  # pylint: disable=import-error
 
 
 def build(ctx):
-    srcnode = ctx.srcnode.abspath()
     testsrc = ctx.srcnode.make_node('tests')
     pylib = ctx.srcnode.make_node('pylib')
     testpylib = testsrc.make_node('pylib')
@@ -57,15 +56,11 @@ def build(ctx):
     ] + common_source
 
     ctx.ntp_test(
-        features="c cprogram bld_include src_include test",
+        features="c cprogram test",
         target="test_libntp",
         install_path=None,
         defines=unity_config + ["TEST_LIBNTP=1"],
-        includes=["%s/tests/unity/" % srcnode,
-                  "%s/tests/libntp/" % srcnode,
-                  "%s/tests/ntpdig/" % srcnode,
-                  "%s/tests/common/" % srcnode
-                  ] + ctx.env.PLATFORM_INCLUDES,
+        includes=[ctx.bldnode.parent.abspath(), "../include", "unity", "common"] + ctx.env.PLATFORM_INCLUDES,
         use="unity ntp parse M PTHREAD CRYPTO RT SOCKET NSL",
         source=libntp_source,
     )
@@ -82,11 +77,8 @@ def build(ctx):
 
         ctx.ntp_test(
             defines=unity_config + ["TEST_LIBPARSE=1"],
-            features="c cprogram bld_include src_include test",
-            includes=["%s/tests/unity/" % srcnode,
-                      "%s/tests/libparse/" % srcnode,
-                      "%s/tests/common/" % srcnode
-                      ] + ctx.env.PLATFORM_INCLUDES,
+            features="c cprogram test",
+            includes=[ctx.bldnode.parent.abspath(), "../include", "unity"] + ctx.env.PLATFORM_INCLUDES,
             install_path=None,
             lib=["parse"],
             libpath=["libparse"],
@@ -105,12 +97,8 @@ def build(ctx):
 
     ctx.ntp_test(
         defines=unity_config + ["TEST_NTPD=1"],
-        features="c cprogram bld_include src_include test",
-        includes=["%s/tests/unity/" % srcnode,
-                  "%s/ntpd/" % srcnode,
-                  "%s/tests/libntp/" % srcnode,
-                  "%s/tests/common/" % srcnode,
-                  ],
+        features="c cprogram test",
+        includes=[ctx.bldnode.parent.abspath(), "../include", "unity", "../ntpd", "common"],
         install_path=None,
         source=ntpd_source,
         target="test_ntpd",


=====================================
wafhelpers/waf.py
=====================================
@@ -1,19 +1,5 @@
 from waflib.Configure import conf
-from waflib.TaskGen import before_method, feature, re_m4
-
-
- at before_method('apply_incpaths')
- at feature('bld_include')
-def insert_blddir(self):
-    bldnode = self.bld.bldnode.parent.abspath()
-    self.includes += [bldnode]
-
-
- at before_method('apply_incpaths')
- at feature('src_include')
-def insert_srcdir(self):
-    srcnode = self.bld.srcnode.abspath()
-    self.includes += ["%s/include" % srcnode]
+from waflib.TaskGen import re_m4
 
 
 def manpage_subst_fun(self, code):



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/407979f7c3e22b6bdf0f6523930e9bae699c362b

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/407979f7c3e22b6bdf0f6523930e9bae699c362b
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190308/538ba4d0/attachment-0001.html>


More information about the vc mailing list