[Git][NTPsec/ntpsec][master] 3 commits: No need to make a bin for the cross sizeof check.

Amar Takhar gitlab at mg.gitlab.com
Sat Jan 16 04:02:09 UTC 2016


Amar Takhar pushed to branch master at NTPsec / ntpsec


Commits:
17978bab by Amar Takhar at 2016-01-15T23:01:40-05:00
No need to make a bin for the cross sizeof check.

This speeds up configure.

- - - - -
75a950e7 by Amar Takhar at 2016-01-15T23:01:40-05:00
Push more settings into the host as required.

  * Also rename cross compile options and give them their own options group.
  * libpthread has been made optional.  This needs fixing in the future.

- - - - -
68d93437 by Amar Takhar at 2016-01-15T23:01:40-05:00
Fix 'waf check' and add variant subcommands.

- - - - -


3 changed files:

- pylib/check_sizeof.py
- pylib/configure.py
- wscript


Changes:

=====================================
pylib/check_sizeof.py
=====================================
--- a/pylib/check_sizeof.py
+++ b/pylib/check_sizeof.py
@@ -61,6 +61,7 @@ def check_sizeof_cross(ctx, header, sizeof, mandatory=True):
 		try:
 			ctx.check_cc(
 				fragment	= SIZE_FRAG_CROSS % (header_snippet, sizeof, size),
+				features	= "c",
 				execute     = False,
 				mandatory	= mandatory,
 			)


=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -8,19 +8,53 @@ def cmd_configure(ctx):
 	srcnode = ctx.srcnode.abspath()
 	bldnode = ctx.bldnode.abspath()
 
+	opt_map = {}
+	# Wipe out and override flags with those from the commandline
+	for flag in ctx.env.OPT_STORE:
+		opt = flag.replace("--", "").upper() # XXX: find a better way.
+		opt_map[opt] = ctx.env.OPT_STORE[flag]
+
+
+	msg("--- Configuring host ---")
+	ctx.setenv('host', ctx.env.derive())
+
 	ctx.load('compiler_c')
 	ctx.load('bison')
 
-	if ctx.options.enable_cross:
-		ctx.env.ENABLE_CROSS = True
+	for opt in opt_map:
+		ctx.env[opt] = opt_map[opt]
 
 	from compiler import check_compiler
 	check_compiler(ctx)
 
+
+
+	msg("--- Configuring main ---")
+	ctx.setenv("main", ctx.env.derive())
+
 	from check_type import check_type
 	from check_sizeof import check_sizeof
 	from check_structfield import check_structfield
 
+	for opt in opt_map:
+		ctx.env[opt] = opt_map[opt]
+
+	if ctx.options.cross_compiler:
+		ctx.env.ENABLE_CROSS = True
+
+		ctx.start_msg("Using Cross compiler CC:")
+#		ctx.get_cc_version(ctx.env.CC, gcc=True)
+		ctx.end_msg(ctx.options.cross_compiler)
+
+		ctx.env.CC = ctx.options.cross_compiler
+		ctx.env.LINK_CC = ctx.options.cross_compiler
+
+		if ctx.env["CROSS-CFLAGS"]:
+			ctx.env.CFLAGS = opt_map["CROSS-CFLAGS"]
+
+		if ctx.env["CROSS-LDFLAGS"]:
+			ctx.env.LDFLAGS = opt_map["CROSS-LDFLAGS"]
+
 
 	if ctx.options.list:
 		from refclock import refclock_map
@@ -32,6 +66,7 @@ def cmd_configure(ctx):
 		return
 
 
+
 	# This needs to be at the top since it modifies CC and AR
 	if ctx.options.enable_fortify:
 		from check_fortify import check_fortify
@@ -80,11 +115,6 @@ def cmd_configure(ctx):
 	if ctx.env.PLATFORM_TARGET == "osx":
 		ctx.define("__APPLE_USE_RFC_3542", 1)
 
-	# Wipe out and override flags with those from the commandline
-	for flag in ctx.env.OPT_STORE:
-		opt = flag.replace("--", "").upper() # XXX: find a better way.
-		ctx.env[opt] = ctx.env.OPT_STORE[flag]
-
 	if ctx.options.enable_rtems_trace:
 		ctx.find_program("rtems-tld", var="BIN_RTEMS_TLD", path_list=[ctx.options.rtems_trace_path, ctx.env.BINDIR])
 		ctx.env.RTEMS_TEST_ENABLE = True
@@ -215,7 +245,7 @@ def cmd_configure(ctx):
 	ctx.check_cc(lib="edit", mandatory=False)
 	ctx.check_cc(lib="m")
 	ctx.check_cc(lib="ossaudio", mandatory=False)  # NetBSD audio
-	ctx.check_cc(lib="pthread")
+	ctx.check_cc(lib="pthread", mandatory=False)
 	ctx.check_cc(lib="rt", mandatory=False)
 	ctx.check_cc(lib="readline", mandatory=False)
 	ctx.check_cc(lib="thr", mandatory=False)


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -51,8 +51,11 @@ def options(ctx):
 	grp.add_option('--disable-dns-lookup', action='store_true', default=False, help="Disable DNS lookups.")
 	grp.add_option('--disable-dns-retry', action='store_true', default=False, help="Disable retrying DNS lookups.")
 	grp.add_option('--disable-mdns-registration', action='store_true', default=False, help="Disable MDNS registration.")
-	grp.add_option('--enable-cross', action='store_true', default=False, help="Cross compile.")
 
+	grp = ctx.add_option_group("NTP cross compile options")
+	grp.add_option('--cross-compiler', type='string', help="Path to cross compiler CC. (enables cross-compiling)")
+	grp.add_option('--cross-cflags', type='string',  action="callback", callback=callback_flags, help="Cross compiler CFLAGS.")
+	grp.add_option('--cross-ldflags', type='string', action="callback", callback=callback_flags, help="Cross compiler LDFLAGS.")
 
 	grp = ctx.add_option_group("NTP configure features")
 	grp.add_option('--enable-leap-smear', action='store_true', default=False, help="Enable Leap Smearing.")
@@ -104,7 +107,7 @@ def configure(ctx):
 from waflib.Build import BuildContext
 class check(BuildContext):
 	cmd = 'check'
-
+	variant = "main"
 
 # Borrowed from https://www.rtems.org/
 variant_cmd = (
@@ -113,9 +116,17 @@ variant_cmd = (
 	("install", InstallContext),
 	("step",    StepContext),
 	("list",    ListContext),
-	("check",   BuildContext)
+#	("check",   BuildContext)
 )
 
+for v in ["host", "main"]:
+    # the reason for creating these subclasses is just for __doc__ below...
+	for cmd, cls in variant_cmd:
+		class tmp(cls):
+			__doc__ = "%s %s" % (cmd, v)
+			cmd = "%s_%s" % (cmd, v)
+			variant = v
+
 def init_handler(ctx):
 	cmd = ctx.cmd
 	if cmd == 'init_handler':



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5c551aa16d53f2cb6a6cab8c25df3dced7c3ca51...68d93437734637d04a5c2339f980161009d0347e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160116/bbe7914b/attachment.html>


More information about the vc mailing list