summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_pidl.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-28 17:34:43 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:39 +1000
commitbc39054bc3da62ef6220f2bdae36ea9f9096da47 (patch)
treefbdf66b7a34cae4d9ec8441621b6e6d9cac947bd /buildtools/wafsamba/samba_pidl.py
parentbd54d2a87dcabe1ff520662780673a7aaf52cc3f (diff)
downloadsamba-bc39054bc3da62ef6220f2bdae36ea9f9096da47.tar.gz
samba-bc39054bc3da62ef6220f2bdae36ea9f9096da47.tar.bz2
samba-bc39054bc3da62ef6220f2bdae36ea9f9096da47.zip
build: rewrote PIDL rules, breaking them into a separate waf tool
Diffstat (limited to 'buildtools/wafsamba/samba_pidl.py')
-rw-r--r--buildtools/wafsamba/samba_pidl.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
new file mode 100644
index 0000000000..d239bb07b3
--- /dev/null
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -0,0 +1,53 @@
+# waf build tool for building IDL files with pidl
+
+from TaskGen import taskgen, before
+import Build, os, string
+from samba_utils import *
+
+def SAMBA_PIDL(bld, directory, source, options=''):
+ '''Build a IDL file using pidl.
+ This will produce 7 output files'''
+
+ name = os.path.basename(string.replace(source, '.idl', ''))
+ name = "PIDL_%s" % name.upper()
+
+ if not SET_TARGET_TYPE(bld, name, 'PIDL'):
+ return
+
+ bld.SET_BUILD_GROUP('build_source')
+ t = bld(name=name, source=source, options=options)
+ t.mappings['.idl'] = process_pidl
+ t.env.PIDL = "../../pidl/pidl"
+ t.env.PIDL_BUILD_TYPES = '--header --ndr-parser --client --python --server'.split()
+ t.env.OPTIONS = options
+
+Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL
+
+
+@taskgen
+def process_pidl(self, node, options=''):
+ '''Generate the list of output nodes for a given input IDL
+ file, and create the task to build them'''
+ bname = node.file_base()
+ # the output of pidl needs to go in the gen_ndr directory
+ gen_ndr_dir = "../gen_ndr/"
+ c_node = NEW_NODE(node, gen_ndr_dir + 'ndr_%s.c' % bname)
+ h1_node = NEW_NODE(node, gen_ndr_dir + '%s.h' % bname)
+ h2_node = NEW_NODE(node, gen_ndr_dir + 'ndr_%s.h' % bname)
+ s_node = NEW_NODE(node, gen_ndr_dir + 'ndr_%s_s.c' % bname)
+ cli_node = NEW_NODE(node, gen_ndr_dir + 'ndr_%s_c.c' % bname)
+ cli_h_node = NEW_NODE(node, gen_ndr_dir + 'ndr_%s_c.h' % bname)
+ py_node = NEW_NODE(node, gen_ndr_dir + 'py_%s.c' % bname)
+ t = self.create_task('pidl', node, [c_node, h1_node, h2_node, s_node,
+ cli_node, cli_h_node, py_node])
+ # setup ${OUTPUTDIR} in the pidl rule, and make sure it exists
+ t.env.OUTPUTDIR = os.path.dirname(c_node.abspath(self.env))
+ if not os.path.isdir(t.env.OUTPUTDIR):
+ os.mkdir(t.env.OUTPUTDIR, 0777)
+
+
+# the pidl task itself
+import Task
+Task.simple_task_type('pidl',
+ '${PIDL} ${PIDL_BUILD_TYPES} ${OPTIONS} --outputdir ${OUTPUTDIR} -- ${SRC}',
+ color='BLUE', before='cc', shell=False)