[Git][NTPsec/ntpsec][master] Add (very) basic support for cross compiling.

Amar Takhar gitlab at mg.gitlab.com
Thu Jan 14 04:19:04 UTC 2016


Amar Takhar pushed to branch master at NTPsec / ntpsec


Commits:
c3fc50c9 by Amar Takhar at 2016-01-13T23:15:45-05:00
Add (very) basic support for cross compiling.

You will need to edit build/config.h by hand and possibly build/c4che/_cache.py
To figure out what is missing diff these files from a non-cross build.

- - - - -


3 changed files:

- pylib/compiler.py
- pylib/configure.py
- wscript


Changes:

=====================================
pylib/compiler.py
=====================================
--- a/pylib/compiler.py
+++ b/pylib/compiler.py
@@ -29,6 +29,9 @@ int main(void) {
 
 def check_compiler(ctx):
 
+	if ctx.env.ENABLE_CROSS:
+		return
+
 	defines = {
 		1: ("COMPILER_CLANG",	"clang"),
 		2: ("COMPILER_ICC",		"ICC"),


=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -11,6 +11,8 @@ def cmd_configure(ctx):
 	ctx.load('compiler_c')
 	ctx.load('bison')
 
+	if ctx.options.enable_cross:
+		ctx.env.ENABLE_CROSS = True
 
 	from compiler import check_compiler
 	check_compiler(ctx)
@@ -188,8 +190,9 @@ def cmd_configure(ctx):
 #HGM		(None,                  "signed char"),
 	]
 
-	for header, sizeof in sorted(sizeofs):
-		ctx.check_sizeof(header, sizeof)
+	if not ctx.env.ENABLE_CROSS:
+		for header, sizeof in sorted(sizeofs):
+			ctx.check_sizeof(header, sizeof)
 
 	# The protocol major number
 	ctx.define("NTP_API",	4)
@@ -213,7 +216,8 @@ 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")
+	if not ctx.env.ENABLE_CROSS:
+		ctx.check_cc(lib="pthread")
 	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
@@ -47,6 +47,7 @@ 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 configure features")



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c3fc50c9b93ad77c06c68e5c3868cc196909f159
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160114/619f67a3/attachment.html>


More information about the vc mailing list