build: added enabled=True/False option to SAMBA_BINARY()
[nivanova/samba-autobuild/.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                  enabled=True):
234     '''define a Samba binary'''
235
236     if not enabled:
237         SET_TARGET_TYPE(bld, binname, 'DISABLED')
238         return
239
240     if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
241         return
242
243     features = 'cc cprogram symlink_bin install_bin'
244     if needs_python:
245         features += ' pyembed'
246
247     obj_target = binname + '.objlist'
248
249     source = bld.EXPAND_VARIABLES(source, vars=vars)
250     source = unique_list(TO_LIST(source))
251
252     # first create a target for building the object files for this binary
253     # by separating in this way, we avoid recompiling the C files
254     # separately for the install binary and the build binary
255     bld.SAMBA_SUBSYSTEM(obj_target,
256                         source         = source,
257                         deps           = deps,
258                         includes       = includes,
259                         cflags         = cflags,
260                         group          = group,
261                         autoproto      = autoproto,
262                         subsystem_name = subsystem_name,
263                         needs_python   = needs_python,
264                         local_include  = local_include,
265                         use_hostcc     = use_hostcc,
266                         use_global_deps= use_global_deps)
267
268     bld.SET_BUILD_GROUP(group)
269
270     # the binary itself will depend on that object target
271     deps = TO_LIST(deps)
272     deps.append(obj_target)
273
274     t = bld(
275         features       = features,
276         source         = [],
277         target         = binname,
278         samba_cflags   = CURRENT_CFLAGS(bld, binname, cflags),
279         samba_deps     = deps,
280         samba_includes = includes,
281         local_include  = local_include,
282         samba_modules  = modules,
283         top            = True,
284         samba_subsystem= subsystem_name,
285         install_path   = None,
286         samba_inst_path= install_path,
287         samba_install  = install
288         )
289
290     # setup the subsystem_name as an alias for the real
291     # binary name, so it can be found when expanding
292     # subsystem dependencies
293     if subsystem_name is not None:
294         bld.TARGET_ALIAS(subsystem_name, binname)
295
296 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
297
298
299 #################################################################
300 def SAMBA_MODULE(bld, modname, source,
301                  deps='',
302                  includes='',
303                  subsystem=None,
304                  init_function=None,
305                  autoproto=None,
306                  autoproto_extra_source='',
307                  aliases=None,
308                  cflags='',
309                  internal_module=True,
310                  local_include=True,
311                  vars=None,
312                  enabled=True):
313     '''define a Samba module.'''
314
315     # we add the init function regardless of whether the module
316     # is enabled or not, as we need to generate a null list if
317     # all disabled
318     bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
319
320     if internal_module or BUILTIN_LIBRARY(bld, modname):
321         # treat internal modules as subsystems for now
322         SAMBA_SUBSYSTEM(bld, modname, source,
323                         deps=deps,
324                         includes=includes,
325                         autoproto=autoproto,
326                         autoproto_extra_source=autoproto_extra_source,
327                         cflags=cflags,
328                         local_include=local_include,
329                         enabled=enabled)
330         return
331
332     if not enabled:
333         SET_TARGET_TYPE(bld, modname, 'DISABLED')
334         return
335
336     source = bld.EXPAND_VARIABLES(source, vars=vars)
337     source = unique_list(TO_LIST(source))
338
339     # remember empty modules, so we can strip the dependencies
340     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
341         SET_TARGET_TYPE(bld, modname, 'EMPTY')
342         return
343
344     if not SET_TARGET_TYPE(bld, modname, 'MODULE'):
345         return
346
347     if subsystem is not None:
348         deps += ' ' + subsystem
349
350     bld.SET_BUILD_GROUP('main')
351     bld(
352         features       = 'cc',
353         source         = source,
354         target         = modname,
355         samba_cflags   = CURRENT_CFLAGS(bld, modname, cflags),
356         samba_includes = includes,
357         local_include  = local_include,
358         samba_deps     = TO_LIST(deps)
359         )
360
361     if autoproto is not None:
362         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
363
364 Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
365
366
367 #################################################################
368 def SAMBA_SUBSYSTEM(bld, modname, source,
369                     deps='',
370                     public_deps='',
371                     includes='',
372                     public_headers=None,
373                     header_path=None,
374                     cflags='',
375                     cflags_end=None,
376                     group='main',
377                     init_function_sentinal=None,
378                     heimdal_autoproto=None,
379                     heimdal_autoproto_options=None,
380                     heimdal_autoproto_private=None,
381                     autoproto=None,
382                     autoproto_extra_source='',
383                     depends_on='',
384                     local_include=True,
385                     local_include_first=True,
386                     subsystem_name=None,
387                     enabled=True,
388                     use_hostcc=False,
389                     use_global_deps=True,
390                     vars=None,
391                     hide_symbols=False,
392                     needs_python=False):
393     '''define a Samba subsystem'''
394
395     if not enabled:
396         SET_TARGET_TYPE(bld, modname, 'DISABLED')
397         return
398
399     # remember empty subsystems, so we can strip the dependencies
400     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
401         SET_TARGET_TYPE(bld, modname, 'EMPTY')
402         return
403
404     if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
405         return
406
407     source = bld.EXPAND_VARIABLES(source, vars=vars)
408     source = unique_list(TO_LIST(source))
409
410     deps += ' ' + public_deps
411
412     bld.SET_BUILD_GROUP(group)
413
414     features = 'cc'
415     if needs_python:
416         features += ' pyext'
417
418     t = bld(
419         features       = features,
420         source         = source,
421         target         = modname,
422         samba_cflags   = CURRENT_CFLAGS(bld, modname, cflags, hide_symbols=hide_symbols),
423         depends_on     = depends_on,
424         samba_deps     = TO_LIST(deps),
425         samba_includes = includes,
426         local_include  = local_include,
427         local_include_first  = local_include_first,
428         samba_subsystem= subsystem_name,
429         samba_use_hostcc = use_hostcc,
430         samba_use_global_deps = use_global_deps
431         )
432
433     if cflags_end is not None:
434         t.samba_cflags.extend(TO_LIST(cflags_end))
435
436     if heimdal_autoproto is not None:
437         bld.HEIMDAL_AUTOPROTO(heimdal_autoproto, source, options=heimdal_autoproto_options)
438     if heimdal_autoproto_private is not None:
439         bld.HEIMDAL_AUTOPROTO_PRIVATE(heimdal_autoproto_private, source)
440     if autoproto is not None:
441         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
442     if public_headers is not None:
443         bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
444     return t
445
446
447 Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
448
449
450 def SAMBA_GENERATOR(bld, name, rule, source='', target='',
451                     group='generators', enabled=True,
452                     public_headers=None,
453                     header_path=None,
454                     vars=None):
455     '''A generic source generator target'''
456
457     if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
458         return
459
460     if not enabled:
461         return
462
463     bld.SET_BUILD_GROUP(group)
464     t = bld(
465         rule=rule,
466         source=bld.EXPAND_VARIABLES(source, vars=vars),
467         target=target,
468         shell=isinstance(rule, str),
469         on_results=True,
470         before='cc',
471         ext_out='.c',
472         name=name)
473
474     if public_headers is not None:
475         bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
476     return t
477 Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
478
479
480
481 @runonce
482 def SETUP_BUILD_GROUPS(bld):
483     '''setup build groups used to ensure that the different build
484     phases happen consecutively'''
485     bld.p_ln = bld.srcnode # we do want to see all targets!
486     bld.env['USING_BUILD_GROUPS'] = True
487     bld.add_group('setup')
488     bld.add_group('build_compiler_source')
489     bld.add_group('base_libraries')
490     bld.add_group('generators')
491     bld.add_group('compiler_prototypes')
492     bld.add_group('compiler_libraries')
493     bld.add_group('build_compilers')
494     bld.add_group('build_source')
495     bld.add_group('prototypes')
496     bld.add_group('main')
497     bld.add_group('binaries')
498     bld.add_group('final')
499 Build.BuildContext.SETUP_BUILD_GROUPS = SETUP_BUILD_GROUPS
500
501
502 def SET_BUILD_GROUP(bld, group):
503     '''set the current build group'''
504     if not 'USING_BUILD_GROUPS' in bld.env:
505         return
506     bld.set_group(group)
507 Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
508
509
510
511 @conf
512 def ENABLE_TIMESTAMP_DEPENDENCIES(conf):
513     """use timestamps instead of file contents for deps
514     this currently doesn't work"""
515     def h_file(filename):
516         import stat
517         st = os.stat(filename)
518         if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file')
519         m = Utils.md5()
520         m.update(str(st.st_mtime))
521         m.update(str(st.st_size))
522         m.update(filename)
523         return m.digest()
524     Utils.h_file = h_file
525
526
527
528 t = Task.simple_task_type('copy_script', 'rm -f ${LINK_TARGET} && ln -s ${SRC[0].abspath(env)} ${LINK_TARGET}',
529                           shell=True, color='PINK', ext_in='.bin')
530 t.quiet = True
531
532 @feature('copy_script')
533 @before('apply_link')
534 def copy_script(self):
535     tsk = self.create_task('copy_script', self.allnodes[0])
536     tsk.env.TARGET = self.target
537
538 def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
539     '''used to copy scripts from the source tree into the build directory
540        for use by selftest'''
541
542     source = bld.path.ant_glob(pattern)
543
544     bld.SET_BUILD_GROUP('build_source')
545     for s in TO_LIST(source):
546         iname = s
547         if installname != None:
548             iname = installname
549         target = os.path.join(installdir, iname)
550         tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target))
551         mkdir_p(tgtdir)
552         t = bld(features='copy_script',
553                 source       = s,
554                 target       = target,
555                 always       = True,
556                 install_path = None)
557         t.env.LINK_TARGET = target
558
559 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
560
561
562 def install_file(bld, destdir, file, chmod=O644, flat=False,
563                  python_fixup=False, destname=None, base_name=None):
564     '''install a file'''
565     destdir = bld.EXPAND_VARIABLES(destdir)
566     if not destname:
567         destname = file
568         if flat:
569             destname = os.path.basename(destname)
570     dest = os.path.join(destdir, destname)
571     if python_fixup:
572         # fixup the python path it will use to find Samba modules
573         inst_file = file + '.inst'
574         bld.SAMBA_GENERATOR('python_%s' % destname,
575                             rule="sed 's|\(sys.path.insert.*\)bin/python\(.*\)$|\\1${PYTHONDIR}\\2|g' < ${SRC} > ${TGT}",
576                             source=file,
577                             target=inst_file)
578         file = inst_file
579     if base_name:
580         file = os.path.join(base_name, file)
581     bld.install_as(dest, file, chmod=chmod)
582
583
584 def INSTALL_FILES(bld, destdir, files, chmod=O644, flat=False,
585                   python_fixup=False, destname=None, base_name=None):
586     '''install a set of files'''
587     for f in TO_LIST(files):
588         install_file(bld, destdir, f, chmod=chmod, flat=flat,
589                      python_fixup=python_fixup, destname=destname,
590                      base_name=base_name)
591 Build.BuildContext.INSTALL_FILES = INSTALL_FILES
592
593
594 def INSTALL_WILDCARD(bld, destdir, pattern, chmod=O644, flat=False,
595                      python_fixup=False, exclude=None, trim_path=None):
596     '''install a set of files matching a wildcard pattern'''
597     files=TO_LIST(bld.path.ant_glob(pattern))
598     if trim_path:
599         files2 = []
600         for f in files:
601             files2.append(os_path_relpath(f, trim_path))
602         files = files2
603
604     if exclude:
605         for f in files[:]:
606             if fnmatch.fnmatch(f, exclude):
607                 files.remove(f)
608     INSTALL_FILES(bld, destdir, files, chmod=chmod, flat=flat,
609                   python_fixup=python_fixup, base_name=trim_path)
610 Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
611
612
613 def INSTALL_DIRS(bld, destdir, dirs):
614     '''install a set of directories'''
615     destdir = bld.EXPAND_VARIABLES(destdir)
616     dirs = bld.EXPAND_VARIABLES(dirs)
617     for d in TO_LIST(dirs):
618         bld.install_dir(os.path.join(destdir, d))
619 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS
620
621
622 def PUBLIC_HEADERS(bld, public_headers, header_path=None):
623     '''install some headers
624
625     header_path may either be a string that is added to the INCLUDEDIR,
626     or it can be a dictionary of wildcard patterns which map to destination
627     directories relative to INCLUDEDIR
628     '''
629     dest = '${INCLUDEDIR}'
630     if isinstance(header_path, str):
631         dest += '/' + header_path
632     for h in TO_LIST(public_headers):
633         hdest = dest
634         if isinstance(header_path, list):
635             for (p1, dir) in header_path:
636                 found_match=False
637                 lst = TO_LIST(p1)
638                 for p2 in lst:
639                     if fnmatch.fnmatch(h, p2):
640                         if dir:
641                             hdest = os.path.join(hdest, dir)
642                         found_match=True
643                         break
644                 if found_match: break
645         if h.find(':') != -1:
646             hs=h.split(':')
647             INSTALL_FILES(bld, hdest, hs[0], flat=True, destname=hs[1])
648         else:
649             INSTALL_FILES(bld, hdest, h, flat=True)
650 Build.BuildContext.PUBLIC_HEADERS = PUBLIC_HEADERS
651
652
653 def subst_at_vars(task):
654     '''substiture @VAR@ style variables in a file'''
655     src = task.inputs[0].srcpath(task.env)
656     tgt = task.outputs[0].bldpath(task.env)
657
658     f = open(src, 'r')
659     s = f.read()
660     f.close()
661     # split on the vars
662     a = re.split('(@\w+@)', s)
663     out = []
664     back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
665     for v in a:
666         if re.match('@\w+@', v):
667             vname = v[1:-1]
668             if not vname in task.env and vname.upper() in task.env:
669                 vname = vname.upper()
670             if not vname in task.env:
671                 Logs.error("Unknown substitution %s in %s" % (v, task.name))
672                 sys.exit(1)
673             v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
674             # now we back substitute the allowed pc vars
675             for (b, m) in back_sub:
676                 s = task.env[b]
677                 if s == v[0:len(s)]:
678                     v = m + v[len(s):]
679         out.append(v)
680     contents = ''.join(out)
681     f = open(tgt, 'w')
682     s = f.write(contents)
683     f.close()
684     return 0
685
686
687
688 def PKG_CONFIG_FILES(bld, pc_files, vnum=None):
689     '''install some pkg_config pc files'''
690     dest = '${PKGCONFIGDIR}'
691     dest = bld.EXPAND_VARIABLES(dest)
692     for f in TO_LIST(pc_files):
693         base=os.path.basename(f)
694         t = bld.SAMBA_GENERATOR('PKGCONFIG_%s' % base,
695                                 rule=subst_at_vars,
696                                 source=f+'.in',
697                                 target=f)
698         if vnum:
699             t.env.PACKAGE_VERSION = vnum
700         INSTALL_FILES(bld, dest, f, flat=True, destname=base)
701 Build.BuildContext.PKG_CONFIG_FILES = PKG_CONFIG_FILES
702
703
704
705 #############################################################
706 # give a nicer display when building different types of files
707 def progress_display(self, msg, fname):
708     col1 = Logs.colors(self.color)
709     col2 = Logs.colors.NORMAL
710     total = self.position[1]
711     n = len(str(total))
712     fs = '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n, n, msg)
713     return fs % (self.position[0], self.position[1], col1, fname, col2)
714
715 def link_display(self):
716     if Options.options.progress_bar != 0:
717         return Task.Task.old_display(self)
718     fname = self.outputs[0].bldpath(self.env)
719     return progress_display(self, 'Linking', fname)
720 Task.TaskBase.classes['cc_link'].display = link_display
721
722 def samba_display(self):
723     if Options.options.progress_bar != 0:
724         return Task.Task.old_display(self)
725
726     targets    = LOCAL_CACHE(self, 'TARGET_TYPE')
727     if self.name in targets:
728         target_type = targets[self.name]
729         type_map = { 'GENERATOR' : 'Generating',
730                      'PROTOTYPE' : 'Generating'
731                      }
732         if target_type in type_map:
733             return progress_display(self, type_map[target_type], self.name)
734
735     fname = self.inputs[0].bldpath(self.env)
736     if fname[0:3] == '../':
737         fname = fname[3:]
738     ext_loc = fname.rfind('.')
739     if ext_loc == -1:
740         return Task.Task.old_display(self)
741     ext = fname[ext_loc:]
742
743     ext_map = { '.idl' : 'Compiling IDL',
744                 '.et'  : 'Compiling ERRTABLE',
745                 '.asn1': 'Compiling ASN1',
746                 '.c'   : 'Compiling' }
747     if ext in ext_map:
748         return progress_display(self, ext_map[ext], fname)
749     return Task.Task.old_display(self)
750
751 Task.TaskBase.classes['Task'].old_display = Task.TaskBase.classes['Task'].display
752 Task.TaskBase.classes['Task'].display = samba_display