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