[Git][NTPsec/ntpsec][master] 2 commits: Fix typo which reenables detection of libevent2 and building of ntpdig.

Amar Takhar gitlab at mg.gitlab.com
Fri Jan 15 21:38:11 UTC 2016


Amar Takhar pushed to branch master at NTPsec / ntpsec


Commits:
b0a9944c by Amar Takhar at 2016-01-15T16:34:07-05:00
Fix typo which reenables detection of libevent2 and building of ntpdig.

- - - - -
62dd53da by Amar Takhar at 2016-01-15T16:36:35-05:00
Add a variant build for 'host'.

This is the initial work for splitting 'host' tasks from 'architecture' tasks.
The next step is to push all host tasks to the 'host' part of the build and
everything else under the 'main' build.

- - - - -


5 changed files:

- ntpd/wscript
- pylib/check_libevent2.py
- pylib/configure.py
- pylib/waf.py
- wscript


Changes:

=====================================
ntpd/wscript
=====================================
--- a/ntpd/wscript
+++ b/ntpd/wscript
@@ -3,52 +3,56 @@ def build(ctx):
 	srcnode = ctx.srcnode.abspath()
 	bldnode = ctx.bldnode.abspath()
 
-	bison_source = [
-		"ntp_parser.y"
-	]
 
-	ctx(
-		target		= "bison_obj",
-		features	= "c src_include bld_include libisc_include",
-		source		= bison_source,
-		includes    = [
-						"%s/ntpd/" % srcnode
+	if ctx.variant == "host":
+
+		bison_source = [
+			"ntp_parser.y"
 		]
-	)
 
-	ctx.add_group() # Generate Bison files first.
+		ctx(
+			target		= "bison_obj",
+			features	= "c src_include bld_include libisc_include",
+			source		= bison_source,
+			includes    = [
+							"%s/ntpd/" % srcnode,
+							"%s/" % ctx.bldnode.parent.abspath()
+			]
+		)
+
+		ctx.add_group() # Generate Bison files first.
 
 
-	keyword_gen_source = [
-		"keyword-gen.c",
-    ]
+		keyword_gen_source = [
+			"keyword-gen.c",
+   	 ]
 
-	ctx(
-		target      = "keyword-gen",
-		features    = "c cprogram bld_include src_include libisc_include",
-# src_include libisc_include",
-		source      = keyword_gen_source,
-#		use			= "ntp isc RT THR PTHREAD",
-		includes    = [
-						"%s/ntpd/" % bldnode
-		],
-		install_path= False
-	)
+		ctx(
+			target      = "keyword-gen",
+			features    = "c cprogram bld_include src_include libisc_include",
+			source      = keyword_gen_source,
+			includes    = [
+							"%s/ntpd/" % bldnode,
+							"%s/" % ctx.bldnode.parent.abspath()
+			],
+			install_path= False
+		)
 
-	# XXX: needs a dependency to rebuild ntp_keyword.h when keyword-gen is rebuilt
+		# XXX: needs a dependency to rebuild ntp_keyword.h when keyword-gen is rebuilt
 
-	ctx.add_group() # Make sure keyword-gen is created next.
+		ctx.add_group() # Make sure keyword-gen is created next.
 
-	ctx(
-		rule        = "%s/ntpd/keyword-gen ${SRC} > ${TGT}" % bldnode,
-		features    = "c bld_include src_include",
-		source      = "ntp_parser.tab.h",
-		target      = "ntp_keyword.h"
-	)
+		ctx(
+			rule        = "%s/ntpd/keyword-gen ${SRC} > ${TGT}" % bldnode,
+			features    = "c bld_include src_include",
+			source      = "ntp_parser.tab.h",
+			target      = "ntp_keyword.h"
+		)
 
 
-	ctx.add_group() # Make sure ntp_keyword.h is created last.
+		ctx.add_group() # Make sure ntp_keyword.h is created last.
 
+		return
 
 
 	libntpd_source = [
@@ -107,14 +111,12 @@ def build(ctx):
 			)
 			use_refclock += " refclock_%s" % file
 
-
-
-
 	ntpd_source = [
 		"ntp_config.c",
 		"ntp_io.c",
 		"ntp_scanner.c",
 		"ntpd.c",
+		ctx.bldnode.parent.find_node("host/ntpd/ntp_parser.tab.c")
 	]
 
 
@@ -137,8 +139,8 @@ def build(ctx):
 		source		= ntpd_source,
 		use			= "libntpd_obj bison_obj isc ntp sodium opts OSSAUDIO M parse GCC_S RT CAP THR PTHREAD CRYPTO DNS_SD DNS_SD_INCLUDES %s" % use_refclock,
 		includes	= [
-			"%s/ntpd/" % bldnode,
-			"%s/ntpd/" % srcnode,
+						"%s/host/ntpd/" % ctx.bldnode.parent.abspath(),
+						"%s/ntpd/" % srcnode,
                         "%s/libsodium/include" % srcnode
 		],
 		install_path= "${PREFIX}/sbin/",


=====================================
pylib/check_libevent2.py
=====================================
--- a/pylib/check_libevent2.py
+++ b/pylib/check_libevent2.py
@@ -29,7 +29,7 @@ def check_libevent2_run(ctx):
 		if ctx.env.EVENT2_HEADER: # XXX Remove when variant builds exist
 			ctx.define("HAVE_LIBEVENT2", 1)
 			ctx.env.LIBEVENT2_ENABLE = True
-	return
+		return
 
 	ctx.check(
 		fragment	= LIBEVENT2_FRAG,


=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -483,7 +483,6 @@ def cmd_configure(ctx):
 	ctx.define("HAVE_IFLIST_SYSCTL", 1)
 
 
-
 	# Header checks
 	from pylib.check_cap import check_cap_header
 	check_cap_header(ctx)


=====================================
pylib/waf.py
=====================================
--- a/pylib/waf.py
+++ b/pylib/waf.py
@@ -6,7 +6,7 @@ from waflib.Task import Task
 @before_method('apply_incpaths')
 @feature('bld_include')
 def insert_blddir(self):
-	bldnode = self.bld.bldnode.abspath()
+	bldnode = self.bld.bldnode.parent.abspath()
 	self.includes += [bldnode]
 
 @before_method('apply_incpaths')


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -1,4 +1,8 @@
 from waflib import Utils
+from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext, StepContext, ListContext
+from waflib import Context, Errors
+from waflib import Scripting
+from waflib.Logs import pprint
 
 out="build"
 
@@ -102,6 +106,57 @@ class check(BuildContext):
 	cmd = 'check'
 
 
+# Borrowed from https://www.rtems.org/
+variant_cmd = (
+	("build",   BuildContext),
+	("clean",   CleanContext),
+	("install", InstallContext),
+	("step",    StepContext),
+	("list",    ListContext),
+	("check",   BuildContext)
+)
+
+def init_handler(ctx):
+	cmd = ctx.cmd
+	if cmd == 'init_handler':
+		cmd = 'build'
+
+	def make_context(name):
+		for x in Context.classes:
+			if x.cmd == name and x.fun != 'init_handler':
+				return x()
+		ctx.fatal('No class for %r' % cmd)
+
+	# By default we want to iterate over each variant.
+	for v in ["host", "main"]:
+		obj = make_context(cmd)
+		obj.variant = v
+		pprint("YELLOW", "--- %sing %s ---" % (cmd, v))
+		obj.execute()
+
+commands = (
+	("install",     "init_handler", None),
+	("uninstall",   "init_handler", None),
+	("build",       "init_handler", None),
+	("clean",       "init_handler", None),
+	("list",        "init_handler", None),
+	("step",        "init_handler", None),
+#	("info",        "cmd_info",     "Show build information / configuration.")
+)
+
+
+for command, func, descr in commands:
+	class tmp(Context.Context):
+		if descr:
+			__doc__ = descr
+		cmd = command
+		fun = func
+		if command in 'install uninstall build clean list step docs bsp info':
+			execute = Scripting.autoconfigure(Context.Context.execute)
+# end borrowed code
+
+
+
 def build(ctx):
 
 	ctx.load('waf', tooldir='pylib/')
@@ -109,6 +164,10 @@ def build(ctx):
 	ctx.load('asciidoc', tooldir='pylib/')
 	ctx.load('rtems_trace', tooldir='pylib/')
 
+	if ctx.variant == "host":
+		ctx.recurse("ntpd")
+		return
+
 	if ctx.env.ENABLE_DOC:
 		ctx.recurse("docs")
 
@@ -149,17 +208,20 @@ def build(ctx):
 	ctx.manpage(1, "ntptrace/ntptrace-man.txt")
 
 
-	# Force re-running of tests.  Same as 'waf --alltests'
-	if ctx.cmd == "check":
-		ctx.options.all_tests = True
-
-		# Print log if -v is supplied
-		if ctx.options.verbose:
-			ctx.add_post_fun(test_print_log)
+	# Skip running unit tests on a cross compile build
+	if not ctx.env.ENABLE_CROSS:
+		# Force re-running of tests.  Same as 'waf --alltests'
+		if ctx.cmd == "check":
+			ctx.options.all_tests = True
 
-	# Write test log to a file
-	ctx.add_post_fun(test_write_log)
+			# Print log if -v is supplied
+			if ctx.options.verbose:
+				ctx.add_post_fun(test_print_log)
 
-	# Print a summary at the end
-	ctx.add_post_fun(waf_unit_test.summary)
+		# Write test log to a file
+		ctx.add_post_fun(test_write_log)
 
+		# Print a summary at the end
+		ctx.add_post_fun(waf_unit_test.summary)
+	else:
+		pprint("YELLOW", "Unit test runner skipped on a cross-compiled build.")



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5549b6a2c90ae5992b9956be18be1201d8f9bb7f...62dd53daa07bc8f83d3f38be796c7bd32e0c4871
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160115/b7acc6f0/attachment.html>


More information about the vc mailing list