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 *
11 ################################################################################
12 # a et task which calls out to compile_et to do the work
13 Task.simple_task_type('et',
14 '../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)}',
15 color='BLUE', ext_out='.c',
19 def process_et(self, node):
20 c_node = node.change_ext('.c')
21 h_node = node.change_ext('.h')
22 self.create_task('et', node, [c_node, h_node])
23 self.allnodes.append(c_node)
26 ################################################################################
27 # a idl task which calls out to pidl to do the work
28 Task.simple_task_type('idl', '../../pidl/pidl --header --ndr-parser --client --python --server --outputdir=${TGT[0].outputdir} -- ${SRC}', color='BLUE', ext_out='.c')
31 def process_idl(self, node):
32 bname = node.file_base()
33 c_node = NEW_NODE(node, 'ndr_%s.c' % bname)
34 h1_node = NEW_NODE(node, '%s.h' % bname)
35 h2_node = NEW_NODE(node, 'ndr_%s.h' % bname)
36 s_node = NEW_NODE(node, 'ndr_%s_s.c' % bname)
37 cli_node = NEW_NODE(node, 'ndr_%s_c.c' % bname)
38 cli_h_node = NEW_NODE(node, 'ndr_%s_c.h' % bname)
39 py_node = NEW_NODE(node, 'py_%s.c' % bname)
42 dname = os.path.dirname(node.bld_dir(self.env)) + "/gen_ndr"
43 c_node.outputdir = dname
45 self.create_task('idl', node, [c_node, h1_node, h2_node, s_node, cli_node, cli_h_node, py_node])
47 # reinject the c node to the list of nodes to process
48 self.allnodes.append(c_node)
53 ################################################################################
54 # a asn1 task which calls out to asn1_compile_wrapper.sh to do the work
55 Task.simple_task_type('asn1',
57 # shell script to convert ASN1 to C. This could be separated out if we want to
59 compiler=${TGT[0].compiler}
60 destdir=${TGT[0].destdir}
61 wrapper=${TGT[0].asn1wrapper}
62 srcfile=${SRC[0].abspath(env)}
63 asn1name=${TGT[0].asn1name}
64 options="${TGT[0].asn1options}"
67 $wrapper . $destdir $compiler $srcfile $asn1name ${options} --one-code-file
69 # that generated 3 files:
75 hxfile=$destdir/$asn1name.hx
76 xfile=$destdir/asn1_$asn1name.x
77 listfilee=$destdir/"$asn1name"_files
79 cfile=${TGT[0].abspath(env)}
80 hfile=${TGT[1].abspath(env)}
83 echo '#include "config.h"' > $cfile
93 def process_asn1(self, node):
95 asn1name = string.replace(node.file(), '.', '_')
96 c_node = NEW_NODE(node, 'asn1_%s.c' % asn1name)
97 h_node = NEW_NODE(node, '%s.h' % asn1name)
99 c_node.destdir = "default/source4/heimdal/" + self.asn1directory
100 c_node.asn1options = self.asn1options
101 c_node.asn1name = asn1name
102 c_node.asn1wrapper = "../heimdal_build/asn1_compile_wrapper.sh"
103 c_node.compiler = "default/source4/heimdal_build/asn1_compile"
105 self.create_task('asn1', node, [c_node, h_node])
106 self.allnodes.append(c_node)