1 # a waf tool to add extension based build patterns for Samba
3 import os, sys, Options
4 import string, Task, Utils, optparse
5 from Configure import conf
7 from TaskGen import extension
8 from samba_utils import *
10 ##########################################################
11 # create a node with a new name, based on an existing node
12 def NEW_NODE(node, name):
13 ret = node.parent.find_or_declare([name])
14 ASSERT(node, ret is not None, "Unable to find new target with name '%s' from '%s'" % (
19 ################################################################################
20 # a et task which calls out to compile_et to do the work
21 Task.simple_task_type('et',
22 '../heimdal_build/et_compile_wrapper.sh . ${TGT[0].bld_dir(env)} default/source4/heimdal_build/compile_et ${SRC[0].abspath(env)} ${TGT[0].bldpath(env)}',
23 color='BLUE', ext_out='.c',
27 def process_et(self, node):
28 c_node = node.change_ext('.c')
29 h_node = node.change_ext('.h')
30 self.create_task('et', node, [c_node, h_node])
31 self.allnodes.append(c_node)
35 ################################################################################
36 # a idl task which calls out to pidl to do the work
37 Task.simple_task_type('idl', '../../pidl/pidl ${TGT[0].options} --header --ndr-parser --client --python --server --outputdir=${TGT[0].outputdir} -- ${SRC}', color='BLUE', ext_out='.c')
40 def process_idl(self, node):
41 bname = node.file_base()
42 c_node = NEW_NODE(node, 'ndr_%s.c' % bname)
43 h1_node = NEW_NODE(node, '%s.h' % bname)
44 h2_node = NEW_NODE(node, 'ndr_%s.h' % bname)
45 s_node = NEW_NODE(node, 'ndr_%s_s.c' % bname)
46 cli_node = NEW_NODE(node, 'ndr_%s_c.c' % bname)
47 cli_h_node = NEW_NODE(node, 'ndr_%s_c.h' % bname)
48 py_node = NEW_NODE(node, 'py_%s.c' % bname)
51 dname = os.path.dirname(node.bld_dir(self.env)) + "/gen_ndr"
52 c_node.outputdir = dname
53 c_node.options = self.options
55 self.create_task('idl', node, [c_node, h1_node, h2_node, s_node, cli_node, cli_h_node, py_node])
57 # reinject the c node to the list of nodes to process
58 self.allnodes.append(c_node)
63 ################################################################################
64 # a asn1 task which calls out to asn1_compile_wrapper.sh to do the work
65 Task.simple_task_type('asn1',
67 # shell script to convert ASN1 to C. This could be separated out if we want to
69 compiler=${TGT[0].compiler}
70 destdir=${TGT[0].destdir}
71 wrapper=${TGT[0].asn1wrapper}
72 srcfile=${SRC[0].abspath(env)}
73 asn1name=${TGT[0].asn1name}
74 options="${TGT[0].asn1options}"
77 $wrapper . $destdir $compiler $srcfile $asn1name ${options} --one-code-file
79 # that generated 3 files:
85 hxfile=$destdir/$asn1name.hx
86 xfile=$destdir/asn1_$asn1name.x
87 listfilee=$destdir/"$asn1name"_files
89 cfile=${TGT[0].abspath(env)}
90 hfile=${TGT[1].abspath(env)}
93 echo '#include "config.h"' > $cfile
103 def process_asn1(self, node):
105 asn1name = string.replace(node.file(), '.', '_')
106 c_node = NEW_NODE(node, 'asn1_%s.c' % asn1name)
107 h_node = NEW_NODE(node, '%s.h' % asn1name)
109 c_node.destdir = "default/source4/heimdal/" + self.asn1directory
110 c_node.asn1options = self.asn1options
111 c_node.asn1name = asn1name
112 c_node.asn1wrapper = "../heimdal_build/asn1_compile_wrapper.sh"
113 c_node.compiler = "default/source4/heimdal_build/asn1_compile"
115 self.create_task('asn1', node, [c_node, h_node])
116 self.allnodes.append(c_node)