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