build: cope with realname for install of non-python libs
[ira/wip.git] / buildtools / wafsamba / wafsamba.py
1 # a waf tool to add autoconf-like macros to the configure section
2 # and for SAMBA_ macros for building libraries, binaries etc
3
4 import Build, os, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil, Logs, Constants
5 from Configure import conf
6 from Logs import debug
7 from samba_utils import SUBST_VARS_RECURSIVE
8
9 # bring in the other samba modules
10 from samba_optimisation import *
11 from samba_utils import *
12 from samba_autoconf import *
13 from samba_patterns import *
14 from samba_pidl import *
15 from samba_errtable import *
16 from samba_asn1 import *
17 from samba_autoproto import *
18 from samba_python import *
19 from samba_deps import *
20 from samba_bundled import *
21 import samba_install
22 import samba_conftests
23 import samba_abi
24 import tru64cc
25 import irixcc
26 import generic_cc
27 import samba_dist
28
29 O644 = 420
30
31 # some systems have broken threading in python
32 if os.environ.get('WAF_NOTHREADS') == '1':
33     import nothreads
34
35 LIB_PATH="shared"
36
37 os.putenv('PYTHONUNBUFFERED', '1')
38
39
40 if Constants.HEXVERSION < 0x105016:
41     Logs.error('''
42 Please use the version of waf that comes with Samba, not
43 a system installed version. See http://wiki.samba.org/index.php/Waf
44 for details.
45
46 Alternatively, please use ./autogen-waf.sh, and then
47 run ./configure and make as usual. That will call the right version of waf.
48 ''')
49     sys.exit(1)
50
51
52 @conf
53 def SAMBA_BUILD_ENV(conf):
54     '''create the samba build environment'''
55     conf.env.BUILD_DIRECTORY = conf.blddir
56     mkdir_p(os.path.join(conf.blddir, LIB_PATH))
57     mkdir_p(os.path.join(conf.blddir, 'python/samba/dcerpc'))
58     # this allows all of the bin/shared and bin/python targets
59     # to be expressed in terms of build directory paths
60     mkdir_p(os.path.join(conf.blddir, 'default'))
61     for p in ['python','shared']:
62         link_target = os.path.join(conf.blddir, 'default/' + p)
63         if not os.path.lexists(link_target):
64             os.symlink('../' + p, link_target)
65
66     # get perl to put the blib files in the build directory
67     blib_bld = os.path.join(conf.blddir, 'default/pidl/blib')
68     blib_src = os.path.join(conf.srcdir, 'pidl/blib')
69     mkdir_p(blib_bld + '/man1')
70     mkdir_p(blib_bld + '/man3')
71     if os.path.islink(blib_src):
72         os.unlink(blib_src)
73     elif os.path.exists(blib_src):
74         shutil.rmtree(blib_src)
75
76
77 def ADD_INIT_FUNCTION(bld, subsystem, target, init_function):
78     '''add an init_function to the list for a subsystem'''
79     if init_function is None:
80         return
81     bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function)
82     cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
83     if not subsystem in cache:
84         cache[subsystem] = []
85     cache[subsystem].append( { 'TARGET':target, 'INIT_FUNCTION':init_function } )
86 Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
87
88
89
90 #################################################################
91 def SAMBA_LIBRARY(bld, libname, source,
92                   deps='',
93                   public_deps='',
94                   includes='',
95                   public_headers=None,
96                   header_path=None,
97                   pc_files=None,
98                   vnum=None,
99                   cflags='',
100                   external_library=False,
101                   realname=None,
102                   autoproto=None,
103                   group='main',
104                   depends_on='',
105                   local_include=True,
106                   vars=None,
107                   install_path=None,
108                   install=True,
109                   needs_python=False,
110                   target_type='LIBRARY',
111                   bundled_extension=True,
112                   link_name=None,
113                   abi_file=None,
114                   abi_match=None,
115                   hide_symbols=False,
116                   enabled=True):
117     '''define a Samba library'''
118
119     if not enabled:
120         SET_TARGET_TYPE(bld, libname, 'DISABLED')
121         return
122
123     source = bld.EXPAND_VARIABLES(source, vars=vars)
124
125     # remember empty libraries, so we can strip the dependencies
126     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
127         SET_TARGET_TYPE(bld, libname, 'EMPTY')
128         return
129
130     if target_type != 'PYTHON' and BUILTIN_LIBRARY(bld, libname):
131         obj_target = libname
132     else:
133         obj_target = libname + '.objlist'
134
135     # first create a target for building the object files for this library
136     # by separating in this way, we avoid recompiling the C files
137     # separately for the install library and the build library
138     bld.SAMBA_SUBSYSTEM(obj_target,
139                         source         = source,
140                         deps           = deps,
141                         public_deps    = public_deps,
142                         includes       = includes,
143                         public_headers = public_headers,
144                         header_path    = header_path,
145                         cflags         = cflags,
146                         group          = group,
147                         autoproto      = autoproto,
148                         depends_on     = depends_on,
149                         needs_python   = needs_python,
150                         hide_symbols   = hide_symbols,
151                         local_include  = local_include)
152
153     if libname == obj_target:
154         return
155
156     if not SET_TARGET_TYPE(bld, libname, target_type):
157         return
158
159     # the library itself will depend on that object target
160     deps += ' ' + public_deps
161     deps = TO_LIST(deps)
162     deps.append(obj_target)
163
164     if target_type == 'PYTHON' or realname:
165         bundled_name = libname
166     else:
167         bundled_name = BUNDLED_NAME(bld, libname, bundled_extension)
168
169     features = 'cc cshlib symlink_lib install_lib'
170     if target_type == 'PYTHON':
171         features += ' pyext'
172     elif needs_python:
173         features += ' pyembed'
174     if abi_file:
175         features += ' abi_check'
176
177     if abi_file:
178         abi_file = os.path.join(bld.curdir, abi_file)
179
180     bld.SET_BUILD_GROUP(group)
181     t = bld(
182         features        = features,
183         source          = [],
184         target          = bundled_name,
185         samba_cflags    = CURRENT_CFLAGS(bld, libname, cflags),
186         depends_on      = depends_on,
187         samba_deps      = deps,
188         samba_includes  = includes,
189         local_include   = local_include,
190         vnum            = vnum,
191         install_path    = None,
192         samba_inst_path = install_path,
193         name            = libname,
194         samba_realname  = realname,
195         samba_install   = install,
196         abi_file        = abi_file,
197         abi_match       = abi_match
198         )
199
200     if realname and not link_name:
201         link_name = 'shared/%s' % realname
202
203     if link_name:
204         t.link_name = link_name
205
206     if pc_files is not None:
207         bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
208
209 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
210
211
212 #################################################################
213 def SAMBA_BINARY(bld, binname, source,
214                  deps='',
215                  includes='',
216                  public_headers=None,
217                  header_path=None,
218                  modules=None,
219                  ldflags=None,
220                  cflags='',
221                  autoproto=None,
222                  use_hostcc=False,
223                  use_global_deps=True,
224                  compiler=None,
225                  group='binaries',
226                  manpages=None,
227                  local_include=True,
228                  subsystem_name=None,
229                  needs_python=False,
230                  vars=None,
231                  install=True,
232                  install_path=None):
233     '''define a Samba binary'''
234
235     if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
236         return
237
238     features = 'cc cprogram symlink_bin install_bin'
239     if needs_python:
240         features += ' pyembed'
241
242     obj_target = binname + '.objlist'
243
244     source = bld.EXPAND_VARIABLES(source, vars=vars)
245     source = unique_list(TO_LIST(source))
246
247     # first create a target for building the object files for this binary
248     # by separating in this way, we avoid recompiling the C files
249     # separately for the install binary and the build binary
250     bld.SAMBA_SUBSYSTEM(obj_target,
251                         source         = source,
252                         deps           = deps,
253                         includes       = includes,
254                         cflags         = cflags,
255                         group          = group,
256                         autoproto      = autoproto,
257                         subsystem_name = subsystem_name,
258                         needs_python   = needs_python,
259                         local_include  = local_include,
260                         use_hostcc     = use_hostcc,
261                         use_global_deps= use_global_deps)
262
263     bld.SET_BUILD_GROUP(group)
264
265     # the binary itself will depend on that object target
266     deps = TO_LIST(deps)
267     deps.append(obj_target)
268
269     t = bld(
270         features       = features,
271         source         = [],
272         target         = binname,
273         samba_cflags   = CURRENT_CFLAGS(bld, binname, cflags),
274         samba_deps     = deps,
275         samba_includes = includes,
276         local_include  = local_include,
277         samba_modules  = modules,
278         top            = True,
279         samba_subsystem= subsystem_name,
280         install_path   = None,
281         samba_inst_path= install_path,
282         samba_install  = install
283         )
284
285     # setup the subsystem_name as an alias for the real
286     # binary name, so it can be found when expanding
287     # subsystem dependencies
288     if subsystem_name is not None:
289         bld.TARGET_ALIAS(subsystem_name, binname)
290
291 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
292
293
294 #################################################################
295 def SAMBA_MODULE(bld, modname, source,
296                  deps='',
297                  includes='',
298                  subsystem=None,
299                  init_function=None,
300                  autoproto=None,
301                  autoproto_extra_source='',
302                  aliases=None,
303                  cflags='',
304                  internal_module=True,
305                  local_include=True,
306                  vars=None,
307                  enabled=True):
308     '''define a Samba module.'''
309
310     # we add the init function regardless of whether the module
311     # is enabled or not, as we need to generate a null list if
312     # all disabled
313     bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
314
315     if internal_module or BUILTIN_LIBRARY(bld, modname):
316         # treat internal modules as subsystems for now
317         SAMBA_SUBSYSTEM(bld, modname, source,
318                         deps=deps,
319                         includes=includes,
320                         autoproto=autoproto,
321                         autoproto_extra_source=autoproto_extra_source,
322                         cflags=cflags,
323                         local_include=local_include,
324                         enabled=enabled)
325         return
326
327     if not enabled:
328         SET_TARGET_TYPE(bld, modname, 'DISABLED')
329         return
330
331     source = bld.EXPAND_VARIABLES(source, vars=vars)
332     source = unique_list(TO_LIST(source))
333
334     # remember empty modules, so we can strip the dependencies
335     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
336         SET_TARGET_TYPE(bld, modname, 'EMPTY')
337         return
338
339     if not SET_TARGET_TYPE(bld, modname, 'MODULE'):
340         return
341
342     if subsystem is not None:
343         deps += ' ' + subsystem
344
345     bld.SET_BUILD_GROUP('main')
346     bld(
347         features       = 'cc',
348         source         = source,
349         target         = modname,
350         samba_cflags   = CURRENT_CFLAGS(bld, modname, cflags),
351         samba_includes = includes,
352         local_include  = local_include,
353         samba_deps     = TO_LIST(deps)
354         )
355
356     if autoproto is not None:
357         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
358
359 Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
360
361
362 #################################################################
363 def SAMBA_SUBSYSTEM(bld, modname, source,
364                     deps='',
365                     public_deps='',
366                     includes='',
367                     public_headers=None,
368                     header_path=None,
369                     cflags='',
370                     cflags_end=None,
371                     group='main',
372                     init_function_sentinal=None,
373                     heimdal_autoproto=None,
374                     heimdal_autoproto_options=None,
375                     heimdal_autoproto_private=None,
376                     autoproto=None,
377                     autoproto_extra_source='',
378                     depends_on='',
379                     local_include=True,
380                     local_include_first=True,
381                     subsystem_name=None,
382                     enabled=True,
383                     use_hostcc=False,
384                     use_global_deps=True,
385                     vars=None,
386                     hide_symbols=False,
387                     needs_python=False):
388     '''define a Samba subsystem'''
389
390     if not enabled:
391         SET_TARGET_TYPE(bld, modname, 'DISABLED')
392         return
393
394     # remember empty subsystems, so we can strip the dependencies
395     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
396         SET_TARGET_TYPE(bld, modname, 'EMPTY')
397         return
398
399     if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
400         return
401
402     source = bld.EXPAND_VARIABLES(source, vars=vars)
403     source = unique_list(TO_LIST(source))
404
405     deps += ' ' + public_deps
406
407     bld.SET_BUILD_GROUP(group)
408
409     features = 'cc'
410     if needs_python:
411         features += ' pyext'
412
413     t = bld(
414         features       = features,
415         source         = source,
416         target         = modname,
417         samba_cflags   = CURRENT_CFLAGS(bld, modname, cflags, hide_symbols=hide_symbols),
418         depends_on     = depends_on,
419         samba_deps     = TO_LIST(deps),
420         samba_includes = includes,
421         local_include  = local_include,
422         local_include_first  = local_include_first,
423         samba_subsystem= subsystem_name,
424         samba_use_hostcc = use_hostcc,
425         samba_use_global_deps = use_global_deps
426         )
427
428     if cflags_end is not None:
429         t.samba_cflags.extend(TO_LIST(cflags_end))
430
431     if heimdal_autoproto is not None:
432         bld.HEIMDAL_AUTOPROTO(heimdal_autoproto, source, options=heimdal_autoproto_options)
433     if heimdal_autoproto_private is not None:
434         bld.HEIMDAL_AUTOPROTO_PRIVATE(heimdal_autoproto_private, source)
435     if autoproto is not None:
436         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
437     if public_headers is not None:
438         bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
439     return t
440
441
442 Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
443
444
445 def SAMBA_GENERATOR(bld, name, rule, source='', target='',
446                     group='generators', enabled=True,
447                     public_headers=None,
448                     header_path=None,
449                     vars=None):
450     '''A generic source generator target'''
451
452     if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
453         return
454
455     if not enabled:
456         return
457
458     bld.SET_BUILD_GROUP(group)
459     t = bld(
460         rule=rule,
461         source=bld.EXPAND_VARIABLES(source, vars=vars),
462         target=target,
463         shell=isinstance(rule, str),
464         on_results=True,
465         before='cc',
466         ext_out='.c',
467         name=name)
468
469     if public_headers is not None:
470         bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
471     return t
472 Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
473
474
475
476 @runonce
477 def SETUP_BUILD_GROUPS(bld):
478     '''setup build groups used to ensure that the different build
479     phases happen consecutively'''
480     bld.p_ln = bld.srcnode # we do want to see all targets!
481     bld.env['USING_BUILD_GROUPS'] = True
482     bld.add_group('setup')
483     bld.add_group('build_compiler_source')
484     bld.add_group('base_libraries')
485     bld.add_group('generators')
486     bld.add_group('compiler_prototypes')
487     bld.add_group('compiler_libraries')
488     bld.add_group('build_compilers')
489     bld.add_group('build_source')
490     bld.add_group('prototypes')
491     bld.add_group('main')
492     bld.add_group('binaries')
493     bld.add_group('final')
494 Build.BuildContext.SETUP_BUILD_GROUPS = SETUP_BUILD_GROUPS
495
496
497 def SET_BUILD_GROUP(bld, group):
498     '''set the current build group'''
499     if not 'USING_BUILD_GROUPS' in bld.env:
500         return
501     bld.set_group(group)
502 Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
503
504
505
506 @conf
507 def ENABLE_TIMESTAMP_DEPENDENCIES(conf):
508     """use timestamps instead of file contents for deps
509     this currently doesn't work"""
510     def h_file(filename):
511         import stat
512         st = os.stat(filename)
513         if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file')
514         m = Utils.md5()
515         m.update(str(st.st_mtime))
516         m.update(str(st.st_size))
517         m.update(filename)
518         return m.digest()
519     Utils.h_file = h_file
520
521
522
523 t = Task.simple_task_type('copy_script', 'rm -f ${LINK_TARGET} && ln -s ${SRC[0].abspath(env)} ${LINK_TARGET}',
524                           shell=True, color='PINK', ext_in='.bin')
525 t.quiet = True
526
527 @feature('copy_script')
528 @before('apply_link')
529 def copy_script(self):
530     tsk = self.create_task('copy_script', self.allnodes[0])
531     tsk.env.TARGET = self.target
532
533 def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
534     '''used to copy scripts from the source tree into the build directory
535        for use by selftest'''
536
537     source = bld.path.ant_glob(pattern)
538
539     bld.SET_BUILD_GROUP('build_source')
540     for s in TO_LIST(source):
541         iname = s
542         if installname != None:
543             iname = installname
544         target = os.path.join(installdir, iname)
545         tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target))
546         mkdir_p(tgtdir)
547         t = bld(features='copy_script',
548                 source       = s,
549                 target       = target,
550                 always       = True,
551                 install_path = None)
552         t.env.LINK_TARGET = target
553
554 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
555
556
557 def install_file(bld, destdir, file, chmod=O644, flat=False,
558                  python_fixup=False, destname=None, base_name=None):
559     '''install a file'''
560     destdir = bld.EXPAND_VARIABLES(destdir)
561     if not destname:
562         destname = file
563         if flat:
564             destname = os.path.basename(destname)
565     dest = os.path.join(destdir, destname)
566     if python_fixup:
567         # fixup the python path it will use to find Samba modules
568         inst_file = file + '.inst'
569         bld.SAMBA_GENERATOR('python_%s' % destname,
570                             rule="sed 's|\(sys.path.insert.*\)bin/python\(.*\)$|\\1${PYTHONDIR}\\2|g' < ${SRC} > ${TGT}",
571                             source=file,
572                             target=inst_file)
573         file = inst_file
574     if base_name:
575         file = os.path.join(base_name, file)
576     bld.install_as(dest, file, chmod=chmod)
577
578
579 def INSTALL_FILES(bld, destdir, files, chmod=O644, flat=False,
580                   python_fixup=False, destname=None, base_name=None):
581     '''install a set of files'''
582     for f in TO_LIST(files):
583         install_file(bld, destdir, f, chmod=chmod, flat=flat,
584                      python_fixup=python_fixup, destname=destname,
585                      base_name=base_name)
586 Build.BuildContext.INSTALL_FILES = INSTALL_FILES
587
588
589 def INSTALL_WILDCARD(bld, destdir, pattern, chmod=O644, flat=False,
590                      python_fixup=False, exclude=None, trim_path=None):
591     '''install a set of files matching a wildcard pattern'''
592     files=TO_LIST(bld.path.ant_glob(pattern))
593     if trim_path:
594         files2 = []
595         for f in files:
596             files2.append(os_path_relpath(f, trim_path))
597         files = files2
598
599     if exclude:
600         for f in files[:]:
601             if fnmatch.fnmatch(f, exclude):
602                 files.remove(f)
603     INSTALL_FILES(bld, destdir, files, chmod=chmod, flat=flat,
604                   python_fixup=python_fixup, base_name=trim_path)
605 Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
606
607
608 def INSTALL_DIRS(bld, destdir, dirs):
609     '''install a set of directories'''
610     destdir = bld.EXPAND_VARIABLES(destdir)
611     dirs = bld.EXPAND_VARIABLES(dirs)
612     for d in TO_LIST(dirs):
613         bld.install_dir(os.path.join(destdir, d))
614 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS
615
616
617 def PUBLIC_HEADERS(bld, public_headers, header_path=None):
618     '''install some headers
619
620     header_path may either be a string that is added to the INCLUDEDIR,
621     or it can be a dictionary of wildcard patterns which map to destination
622     directories relative to INCLUDEDIR
623     '''
624     dest = '${INCLUDEDIR}'
625     if isinstance(header_path, str):
626         dest += '/' + header_path
627     for h in TO_LIST(public_headers):
628         hdest = dest
629         if isinstance(header_path, list):
630             for (p1, dir) in header_path:
631                 found_match=False
632                 lst = TO_LIST(p1)
633                 for p2 in lst:
634                     if fnmatch.fnmatch(h, p2):
635                         if dir:
636                             hdest = os.path.join(hdest, dir)
637                         found_match=True
638                         break
639                 if found_match: break
640         if h.find(':') != -1:
641             hs=h.split(':')
642             INSTALL_FILES(bld, hdest, hs[0], flat=True, destname=hs[1])
643         else:
644             INSTALL_FILES(bld, hdest, h, flat=True)
645 Build.BuildContext.PUBLIC_HEADERS = PUBLIC_HEADERS
646
647
648 def subst_at_vars(task):
649     '''substiture @VAR@ style variables in a file'''
650     src = task.inputs[0].srcpath(task.env)
651     tgt = task.outputs[0].bldpath(task.env)
652
653     f = open(src, 'r')
654     s = f.read()
655     f.close()
656     # split on the vars
657     a = re.split('(@\w+@)', s)
658     out = []
659     back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
660     for v in a:
661         if re.match('@\w+@', v):
662             vname = v[1:-1]
663             if not vname in task.env and vname.upper() in task.env:
664                 vname = vname.upper()
665             if not vname in task.env:
666                 Logs.error("Unknown substitution %s in %s" % (v, task.name))
667                 sys.exit(1)
668             v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
669             # now we back substitute the allowed pc vars
670             for (b, m) in back_sub:
671                 s = task.env[b]
672                 if s == v[0:len(s)]:
673                     v = m + v[len(s):]
674         out.append(v)
675     contents = ''.join(out)
676     f = open(tgt, 'w')
677     s = f.write(contents)
678     f.close()
679     return 0
680
681
682
683 def PKG_CONFIG_FILES(bld, pc_files, vnum=None):
684     '''install some pkg_config pc files'''
685     dest = '${PKGCONFIGDIR}'
686     dest = bld.EXPAND_VARIABLES(dest)
687     for f in TO_LIST(pc_files):
688         base=os.path.basename(f)
689         t = bld.SAMBA_GENERATOR('PKGCONFIG_%s' % base,
690                                 rule=subst_at_vars,
691                                 source=f+'.in',
692                                 target=f)
693         if vnum:
694             t.env.PACKAGE_VERSION = vnum
695         INSTALL_FILES(bld, dest, f, flat=True, destname=base)
696 Build.BuildContext.PKG_CONFIG_FILES = PKG_CONFIG_FILES
697
698
699
700 #############################################################
701 # give a nicer display when building different types of files
702 def progress_display(self, msg, fname):
703     col1 = Logs.colors(self.color)
704     col2 = Logs.colors.NORMAL
705     total = self.position[1]
706     n = len(str(total))
707     fs = '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n, n, msg)
708     return fs % (self.position[0], self.position[1], col1, fname, col2)
709
710 def link_display(self):
711     if Options.options.progress_bar != 0:
712         return Task.Task.old_display(self)
713     fname = self.outputs[0].bldpath(self.env)
714     return progress_display(self, 'Linking', fname)
715 Task.TaskBase.classes['cc_link'].display = link_display
716
717 def samba_display(self):
718     if Options.options.progress_bar != 0:
719         return Task.Task.old_display(self)
720
721     targets    = LOCAL_CACHE(self, 'TARGET_TYPE')
722     if self.name in targets:
723         target_type = targets[self.name]
724         type_map = { 'GENERATOR' : 'Generating',
725                      'PROTOTYPE' : 'Generating'
726                      }
727         if target_type in type_map:
728             return progress_display(self, type_map[target_type], self.name)
729
730     fname = self.inputs[0].bldpath(self.env)
731     if fname[0:3] == '../':
732         fname = fname[3:]
733     ext_loc = fname.rfind('.')
734     if ext_loc == -1:
735         return Task.Task.old_display(self)
736     ext = fname[ext_loc:]
737
738     ext_map = { '.idl' : 'Compiling IDL',
739                 '.et'  : 'Compiling ERRTABLE',
740                 '.asn1': 'Compiling ASN1',
741                 '.c'   : 'Compiling' }
742     if ext in ext_map:
743         return progress_display(self, ext_map[ext], fname)
744     return Task.Task.old_display(self)
745
746 Task.TaskBase.classes['Task'].old_display = Task.TaskBase.classes['Task'].display
747 Task.TaskBase.classes['Task'].display = samba_display