summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_cross.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-12 22:06:51 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-12 23:13:30 +1000
commitd12605c679cf4f2c5057c548de1210e7fa03a2f1 (patch)
tree55947166783069670fcded9cc18d392433482946 /buildtools/wafsamba/samba_cross.py
parent83312a9e501ebbee15b4fd2353330880496f4add (diff)
downloadsamba-d12605c679cf4f2c5057c548de1210e7fa03a2f1.tar.gz
samba-d12605c679cf4f2c5057c548de1210e7fa03a2f1.tar.bz2
samba-d12605c679cf4f2c5057c548de1210e7fa03a2f1.zip
build: added cross-compilation configure options
this enables use of a cross-compilation emulator, so configure tests run on an emulator of the target platform
Diffstat (limited to 'buildtools/wafsamba/samba_cross.py')
-rw-r--r--buildtools/wafsamba/samba_cross.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
new file mode 100644
index 0000000000..70d74e0c94
--- /dev/null
+++ b/buildtools/wafsamba/samba_cross.py
@@ -0,0 +1,34 @@
+# functions for handling cross-compilation
+
+import pproc, Utils
+from Configure import conf
+from pproc import Popen
+
+real_Popen = None
+
+class cross_Popen(Popen):
+ '''cross-compilation wrapper for Popen'''
+ def __init__(*k, **kw):
+ (obj, args) = k
+ if '--cross-execute' in args:
+ # when --cross-execute is set, then change the arguments
+ # to use the cross emulator
+ i = args.index('--cross-execute')
+ newargs = args[i+1].split()
+ newargs.extend(args[0:i])
+ args = newargs
+ Popen.__init__(*(obj, args), **kw)
+
+
+@conf
+def SAMBA_CROSS_ARGS(conf):
+ '''get exec_args to pass when running cross compiled binaries'''
+ if not conf.env.CROSS_COMPILE or not conf.env.CROSS_EXECUTE:
+ return []
+
+ global real_Popen
+ if real_Popen is None:
+ real_Popen = Utils.pproc.Popen
+ Utils.pproc.Popen = cross_Popen
+
+ return ['--cross-execute', conf.env.CROSS_EXECUTE]