1 # a waf tool to add autoconf-like macros to the configure section
2 # and for SAMBA_ macros for building libraries, binaries etc
4 import Build, os, sys, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil, Logs, Constants
5 from Configure import conf
7 from samba_utils import SUBST_VARS_RECURSIVE
8 TaskGen.task_gen.apply_verif = Utils.nada
10 # bring in the other samba modules
11 from samba_optimisation import *
12 from samba_utils import *
13 from samba_version import *
14 from samba_autoconf import *
15 from samba_patterns import *
16 from samba_pidl import *
17 from samba_autoproto import *
18 from samba_python import *
19 from samba_perl import *
20 from samba_deps import *
21 from samba_bundled import *
22 from samba_third_party import *
24 import samba_conftests
38 # some systems have broken threading in python
39 if os.environ.get('WAF_NOTHREADS') == '1':
44 os.environ['PYTHONUNBUFFERED'] = '1'
47 if Constants.HEXVERSION < 0x105019:
49 Please use the version of waf that comes with Samba, not
50 a system installed version. See http://wiki.samba.org/index.php/Waf
53 Alternatively, please run ./configure and make as usual. That will
54 call the right version of waf.''')
59 def SAMBA_BUILD_ENV(conf):
60 '''create the samba build environment'''
61 conf.env.BUILD_DIRECTORY = conf.blddir
62 mkdir_p(os.path.join(conf.blddir, LIB_PATH))
63 mkdir_p(os.path.join(conf.blddir, LIB_PATH, "private"))
64 mkdir_p(os.path.join(conf.blddir, "modules"))
65 mkdir_p(os.path.join(conf.blddir, 'python/samba/dcerpc'))
66 # this allows all of the bin/shared and bin/python targets
67 # to be expressed in terms of build directory paths
68 mkdir_p(os.path.join(conf.blddir, 'default'))
69 for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python_modules')]:
70 link_target = os.path.join(conf.blddir, 'default/' + target)
71 if not os.path.lexists(link_target):
72 os.symlink('../' + source, link_target)
74 # get perl to put the blib files in the build directory
75 blib_bld = os.path.join(conf.blddir, 'default/pidl/blib')
76 blib_src = os.path.join(conf.srcdir, 'pidl/blib')
77 mkdir_p(blib_bld + '/man1')
78 mkdir_p(blib_bld + '/man3')
79 if os.path.islink(blib_src):
81 elif os.path.exists(blib_src):
82 shutil.rmtree(blib_src)
85 def ADD_INIT_FUNCTION(bld, subsystem, target, init_function):
86 '''add an init_function to the list for a subsystem'''
87 if init_function is None:
89 bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function)
90 cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
91 if not subsystem in cache:
93 cache[subsystem].append( { 'TARGET':target, 'INIT_FUNCTION':init_function } )
94 Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
98 #################################################################
99 def SAMBA_LIBRARY(bld, libname, source,
104 public_headers_install=True,
111 external_library=False,
113 keep_underscore=False,
115 autoproto_extra_source='',
126 target_type='LIBRARY',
127 bundled_extension=False,
133 private_library=False,
134 grouping_library=False,
135 allow_undefined_symbols=False,
136 allow_warnings=False,
138 '''define a Samba library'''
140 if LIB_MUST_BE_PRIVATE(bld, libname):
144 SET_TARGET_TYPE(bld, libname, 'DISABLED')
147 source = bld.EXPAND_VARIABLES(source, vars=vars)
149 source = bld.SUBDIR(subdir, source)
151 # remember empty libraries, so we can strip the dependencies
152 if ((source == '') or (source == [])) and deps == '' and public_deps == '':
153 SET_TARGET_TYPE(bld, libname, 'EMPTY')
156 if BUILTIN_LIBRARY(bld, libname):
159 obj_target = libname + '.objlist'
161 if group == 'libraries':
162 subsystem_group = 'main'
164 subsystem_group = group
166 # first create a target for building the object files for this library
167 # by separating in this way, we avoid recompiling the C files
168 # separately for the install library and the build library
169 bld.SAMBA_SUBSYSTEM(obj_target,
172 public_deps = public_deps,
174 public_headers = public_headers,
175 public_headers_install = public_headers_install,
176 header_path = header_path,
178 group = subsystem_group,
179 autoproto = autoproto,
180 autoproto_extra_source=autoproto_extra_source,
181 depends_on = depends_on,
182 hide_symbols = hide_symbols,
183 allow_warnings = allow_warnings,
186 local_include = local_include,
187 global_include = global_include)
189 if BUILTIN_LIBRARY(bld, libname):
192 if not SET_TARGET_TYPE(bld, libname, target_type):
195 # the library itself will depend on that object target
196 deps += ' ' + public_deps
198 deps.append(obj_target)
200 realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON'))
201 link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON'))
203 # we don't want any public libraries without version numbers
204 if (not private_library and target_type != 'PYTHON' and not realname):
205 if vnum is None and soname is None:
206 raise Utils.WafError("public library '%s' must have a vnum" %
209 raise Utils.WafError("public library '%s' must have pkg-config file" %
211 if public_headers is None:
212 raise Utils.WafError("public library '%s' must have header files" %
215 if target_type == 'PYTHON' or realname or not private_library:
217 bundled_name = libname
219 bundled_name = libname.replace('_', '-')
221 assert (private_library == True and realname is None)
222 if abi_directory or vnum or soname:
223 bundled_extension=True
224 bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-'),
225 bundled_extension, private_library)
227 ldflags = TO_LIST(ldflags)
229 features = 'cc cshlib symlink_lib install_lib'
233 features += ' pyembed'
236 features += ' abi_check'
239 if bld.env.HAVE_LD_VERSION_SCRIPT:
241 version = "%s_%s" % (Utils.g_module.APPNAME, Utils.g_module.VERSION)
243 version = "%s_%s" % (libname, vnum)
247 vscript = "%s.vscript" % libname
248 bld.ABI_VSCRIPT(libname, abi_directory, version, vscript,
250 fullname = apply_pattern(bundled_name, bld.env.shlib_PATTERN)
251 fullpath = bld.path.find_or_declare(fullname)
252 vscriptpath = bld.path.find_or_declare(vscript)
254 raise Utils.WafError("unable to find fullpath for %s" % fullname)
256 raise Utils.WafError("unable to find vscript path for %s" % vscript)
257 bld.add_manual_dependency(fullpath, vscriptpath)
258 if Options.is_install:
259 # also make the .inst file depend on the vscript
260 instname = apply_pattern(bundled_name + '.inst', bld.env.shlib_PATTERN)
261 bld.add_manual_dependency(bld.path.find_or_declare(instname), bld.path.find_or_declare(vscript))
262 vscript = os.path.join(bld.path.abspath(bld.env), vscript)
264 bld.SET_BUILD_GROUP(group)
268 target = bundled_name,
269 depends_on = depends_on,
270 samba_ldflags = ldflags,
272 samba_includes = includes,
273 version_script = vscript,
274 local_include = local_include,
275 global_include = global_include,
279 samba_inst_path = install_path,
281 samba_realname = realname,
282 samba_install = install,
283 abi_directory = "%s/%s" % (bld.path.abspath(), abi_directory),
284 abi_match = abi_match,
285 private_library = private_library,
286 grouping_library=grouping_library,
287 allow_undefined_symbols=allow_undefined_symbols
290 if realname and not link_name:
291 link_name = 'shared/%s' % realname
294 t.link_name = link_name
296 if pc_files is not None and not private_library:
297 bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
299 if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and
300 bld.env['XSLTPROC_MANPAGES']):
301 bld.MANPAGES(manpages, install)
304 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
307 #################################################################
308 def SAMBA_BINARY(bld, binname, source,
318 use_global_deps=True,
331 '''define a Samba binary'''
334 SET_TARGET_TYPE(bld, binname, 'DISABLED')
337 if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
340 features = 'cc cprogram symlink_bin install_bin'
342 features += ' pyembed'
344 obj_target = binname + '.objlist'
346 source = bld.EXPAND_VARIABLES(source, vars=vars)
348 source = bld.SUBDIR(subdir, source)
349 source = unique_list(TO_LIST(source))
351 if group == 'binaries':
352 subsystem_group = 'main'
354 subsystem_group = group
356 # only specify PIE flags for binaries
358 pie_ldflags = TO_LIST(ldflags)
359 if bld.env['ENABLE_PIE'] is True:
360 pie_cflags += ' -fPIE'
361 pie_ldflags.extend(TO_LIST('-pie'))
362 if bld.env['ENABLE_RELRO'] is True:
363 pie_ldflags.extend(TO_LIST('-Wl,-z,relro,-z,now'))
365 # first create a target for building the object files for this binary
366 # by separating in this way, we avoid recompiling the C files
367 # separately for the install binary and the build binary
368 bld.SAMBA_SUBSYSTEM(obj_target,
373 group = subsystem_group,
374 autoproto = autoproto,
375 subsystem_name = subsystem_name,
376 local_include = local_include,
377 global_include = global_include,
378 use_hostcc = use_hostcc,
380 use_global_deps= use_global_deps)
382 bld.SET_BUILD_GROUP(group)
384 # the binary itself will depend on that object target
386 deps.append(obj_target)
393 samba_includes = includes,
394 local_include = local_include,
395 global_include = global_include,
396 samba_modules = modules,
398 samba_subsystem= subsystem_name,
400 samba_inst_path= install_path,
401 samba_install = install,
402 samba_ldflags = pie_ldflags
405 if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
406 bld.MANPAGES(manpages, install)
408 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
411 #################################################################
412 def SAMBA_MODULE(bld, modname, source,
417 module_init_name='samba_init_module',
419 autoproto_extra_source='',
421 internal_module=True,
429 allow_undefined_symbols=False,
432 '''define a Samba module.'''
434 source = bld.EXPAND_VARIABLES(source, vars=vars)
436 source = bld.SUBDIR(subdir, source)
438 if internal_module or BUILTIN_LIBRARY(bld, modname):
439 # Do not create modules for disabled subsystems
440 if subsystem and GET_TARGET_TYPE(bld, subsystem) == 'DISABLED':
442 bld.SAMBA_SUBSYSTEM(modname, source,
446 autoproto_extra_source=autoproto_extra_source,
448 local_include=local_include,
449 global_include=global_include,
450 allow_warnings=allow_warnings,
453 bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
457 SET_TARGET_TYPE(bld, modname, 'DISABLED')
460 # Do not create modules for disabled subsystems
461 if subsystem and GET_TARGET_TYPE(bld, subsystem) == 'DISABLED':
464 obj_target = modname + '.objlist'
467 if subsystem is not None:
468 deps += ' ' + subsystem
469 while realname.startswith("lib"+subsystem+"_"):
470 realname = realname[len("lib"+subsystem+"_"):]
471 while realname.startswith(subsystem+"_"):
472 realname = realname[len(subsystem+"_"):]
474 realname = bld.make_libname(realname)
475 while realname.startswith("lib"):
476 realname = realname[len("lib"):]
478 build_link_name = "modules/%s/%s" % (subsystem, realname)
481 cflags += " -D%s=%s" % (init_function, module_init_name)
483 bld.SAMBA_LIBRARY(modname,
489 autoproto = autoproto,
490 local_include=local_include,
491 global_include=global_include,
493 link_name=build_link_name,
494 install_path="${MODULESDIR}/%s" % subsystem,
497 allow_undefined_symbols=allow_undefined_symbols,
498 allow_warnings=allow_warnings
502 Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
505 #################################################################
506 def SAMBA_SUBSYSTEM(bld, modname, source,
511 public_headers_install=True,
516 init_function_sentinel=None,
518 autoproto_extra_source='',
521 local_include_first=True,
526 use_global_deps=True,
530 allow_warnings=False,
533 '''define a Samba subsystem'''
536 SET_TARGET_TYPE(bld, modname, 'DISABLED')
539 # remember empty subsystems, so we can strip the dependencies
540 if ((source == '') or (source == [])) and deps == '' and public_deps == '':
541 SET_TARGET_TYPE(bld, modname, 'EMPTY')
544 if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
547 source = bld.EXPAND_VARIABLES(source, vars=vars)
549 source = bld.SUBDIR(subdir, source)
550 source = unique_list(TO_LIST(source))
552 deps += ' ' + public_deps
554 bld.SET_BUILD_GROUP(group)
560 features += ' pyembed'
566 samba_cflags = CURRENT_CFLAGS(bld, modname, cflags,
567 allow_warnings=allow_warnings,
568 hide_symbols=hide_symbols),
569 depends_on = depends_on,
570 samba_deps = TO_LIST(deps),
571 samba_includes = includes,
572 local_include = local_include,
573 local_include_first = local_include_first,
574 global_include = global_include,
575 samba_subsystem= subsystem_name,
576 samba_use_hostcc = use_hostcc,
577 samba_use_global_deps = use_global_deps,
580 if cflags_end is not None:
581 t.samba_cflags.extend(TO_LIST(cflags_end))
583 if autoproto is not None:
584 bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
585 if public_headers is not None:
586 bld.PUBLIC_HEADERS(public_headers, header_path=header_path,
587 public_headers_install=public_headers_install)
591 Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
594 def SAMBA_GENERATOR(bld, name, rule, source='', target='',
595 group='generators', enabled=True,
597 public_headers_install=True,
602 '''A generic source generator target'''
604 if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
610 dep_vars.append('ruledeps')
611 dep_vars.append('SAMBA_GENERATOR_VARS')
613 bld.SET_BUILD_GROUP(group)
616 source=bld.EXPAND_VARIABLES(source, vars=vars),
618 shell=isinstance(rule, str),
622 samba_type='GENERATOR',
628 t.env.SAMBA_GENERATOR_VARS = vars
633 if public_headers is not None:
634 bld.PUBLIC_HEADERS(public_headers, header_path=header_path,
635 public_headers_install=public_headers_install)
637 Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
642 def SETUP_BUILD_GROUPS(bld):
643 '''setup build groups used to ensure that the different build
644 phases happen consecutively'''
645 bld.p_ln = bld.srcnode # we do want to see all targets!
646 bld.env['USING_BUILD_GROUPS'] = True
647 bld.add_group('setup')
648 bld.add_group('build_compiler_source')
649 bld.add_group('vscripts')
650 bld.add_group('base_libraries')
651 bld.add_group('generators')
652 bld.add_group('compiler_prototypes')
653 bld.add_group('compiler_libraries')
654 bld.add_group('build_compilers')
655 bld.add_group('build_source')
656 bld.add_group('prototypes')
657 bld.add_group('headers')
658 bld.add_group('main')
659 bld.add_group('symbolcheck')
660 bld.add_group('syslibcheck')
661 bld.add_group('final')
662 Build.BuildContext.SETUP_BUILD_GROUPS = SETUP_BUILD_GROUPS
665 def SET_BUILD_GROUP(bld, group):
666 '''set the current build group'''
667 if not 'USING_BUILD_GROUPS' in bld.env:
670 Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
675 def ENABLE_TIMESTAMP_DEPENDENCIES(conf):
676 """use timestamps instead of file contents for deps
677 this currently doesn't work"""
678 def h_file(filename):
680 st = os.stat(filename)
681 if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file')
683 m.update(str(st.st_mtime))
684 m.update(str(st.st_size))
687 Utils.h_file = h_file
690 def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
691 '''used to copy scripts from the source tree into the build directory
692 for use by selftest'''
694 source = bld.path.ant_glob(pattern)
696 bld.SET_BUILD_GROUP('build_source')
697 for s in TO_LIST(source):
699 if installname is not None:
701 target = os.path.join(installdir, iname)
702 tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target))
704 link_src = os.path.normpath(os.path.join(bld.curdir, s))
705 link_dst = os.path.join(tgtdir, os.path.basename(iname))
706 if os.path.islink(link_dst) and os.readlink(link_dst) == link_src:
708 if os.path.exists(link_dst):
710 Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
711 os.symlink(link_src, link_dst)
712 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
715 def copy_and_fix_python_path(task):
716 pattern='sys.path.insert(0, "bin/python")'
717 if task.env["PYTHONARCHDIR"] in sys.path and task.env["PYTHONDIR"] in sys.path:
719 elif task.env["PYTHONARCHDIR"] == task.env["PYTHONDIR"]:
720 replacement="""sys.path.insert(0, "%s")""" % task.env["PYTHONDIR"]
722 replacement="""sys.path.insert(0, "%s")
723 sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
725 if task.env["PYTHON"][0] == "/":
726 replacement_shebang = "#!%s\n" % task.env["PYTHON"]
728 replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PYTHON"]
730 installed_location=task.outputs[0].bldpath(task.env)
731 source_file = open(task.inputs[0].srcpath(task.env))
732 installed_file = open(installed_location, 'w')
734 for line in source_file:
736 if (lineno == 0 and task.env["PYTHON_SPECIFIED"] is True and
738 newline = replacement_shebang
739 elif pattern in line:
740 newline = line.replace(pattern, replacement)
741 installed_file.write(newline)
743 installed_file.close()
744 os.chmod(installed_location, 0755)
747 def copy_and_fix_perl_path(task):
748 pattern='use lib "$RealBin/lib";'
751 if not task.env["PERL_LIB_INSTALL_DIR"] in task.env["PERL_INC"]:
752 replacement = 'use lib "%s";' % task.env["PERL_LIB_INSTALL_DIR"]
754 if task.env["PERL"][0] == "/":
755 replacement_shebang = "#!%s\n" % task.env["PERL"]
757 replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PERL"]
759 installed_location=task.outputs[0].bldpath(task.env)
760 source_file = open(task.inputs[0].srcpath(task.env))
761 installed_file = open(installed_location, 'w')
763 for line in source_file:
765 if lineno == 0 and task.env["PERL_SPECIFIED"] == True and line[:2] == "#!":
766 newline = replacement_shebang
767 elif pattern in line:
768 newline = line.replace(pattern, replacement)
769 installed_file.write(newline)
771 installed_file.close()
772 os.chmod(installed_location, 0755)
776 def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
777 python_fixup=False, perl_fixup=False,
778 destname=None, base_name=None):
780 destdir = bld.EXPAND_VARIABLES(destdir)
784 destname = os.path.basename(destname)
785 dest = os.path.join(destdir, destname)
787 # fix the path python will use to find Samba modules
788 inst_file = file + '.inst'
789 bld.SAMBA_GENERATOR('python_%s' % destname,
790 rule=copy_and_fix_python_path,
791 dep_vars=["PYTHON","PYTHON_SPECIFIED","PYTHONDIR","PYTHONARCHDIR"],
796 # fix the path perl will use to find Samba modules
797 inst_file = file + '.inst'
798 bld.SAMBA_GENERATOR('perl_%s' % destname,
799 rule=copy_and_fix_perl_path,
800 dep_vars=["PERL","PERL_SPECIFIED","PERL_LIB_INSTALL_DIR"],
805 file = os.path.join(base_name, file)
806 bld.install_as(dest, file, chmod=chmod)
809 def INSTALL_FILES(bld, destdir, files, chmod=MODE_644, flat=False,
810 python_fixup=False, perl_fixup=False,
811 destname=None, base_name=None):
812 '''install a set of files'''
813 for f in TO_LIST(files):
814 install_file(bld, destdir, f, chmod=chmod, flat=flat,
815 python_fixup=python_fixup, perl_fixup=perl_fixup,
816 destname=destname, base_name=base_name)
817 Build.BuildContext.INSTALL_FILES = INSTALL_FILES
820 def INSTALL_WILDCARD(bld, destdir, pattern, chmod=MODE_644, flat=False,
821 python_fixup=False, exclude=None, trim_path=None):
822 '''install a set of files matching a wildcard pattern'''
823 files=TO_LIST(bld.path.ant_glob(pattern))
827 files2.append(os_path_relpath(f, trim_path))
832 if fnmatch.fnmatch(f, exclude):
834 INSTALL_FILES(bld, destdir, files, chmod=chmod, flat=flat,
835 python_fixup=python_fixup, base_name=trim_path)
836 Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
839 def INSTALL_DIRS(bld, destdir, dirs):
840 '''install a set of directories'''
841 destdir = bld.EXPAND_VARIABLES(destdir)
842 dirs = bld.EXPAND_VARIABLES(dirs)
843 for d in TO_LIST(dirs):
844 bld.install_dir(os.path.join(destdir, d))
845 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS
848 def MANPAGES(bld, manpages, install):
849 '''build and install manual pages'''
850 bld.env.MAN_XSL = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
851 for m in manpages.split():
853 bld.SAMBA_GENERATOR(m,
857 rule='${XSLTPROC} --xinclude -o ${TGT} --nonet ${MAN_XSL} ${SRC}'
860 bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
861 Build.BuildContext.MANPAGES = MANPAGES
863 def SAMBAMANPAGES(bld, manpages, extra_source=None):
864 '''build and install manual pages'''
865 bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
866 bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl'
867 bld.env.SAMBA_CATALOGS = 'file:///etc/xml/catalog file:///usr/local/share/xml/catalog file://' + bld.srcnode.abspath() + '/bin/default/docs-xml/build/catalog.xml'
869 for m in manpages.split():
871 if extra_source is not None:
872 source = [source, extra_source]
873 bld.SAMBA_GENERATOR(m,
877 rule='''XML_CATALOG_FILES="${SAMBA_CATALOGS}"
878 export XML_CATALOG_FILES
879 ${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC[0].abspath(env)}
880 ${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'''
882 bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
883 Build.BuildContext.SAMBAMANPAGES = SAMBAMANPAGES
885 #############################################################
886 # give a nicer display when building different types of files
887 def progress_display(self, msg, fname):
888 col1 = Logs.colors(self.color)
889 col2 = Logs.colors.NORMAL
890 total = self.position[1]
892 fs = '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n, n, msg)
893 return fs % (self.position[0], self.position[1], col1, fname, col2)
895 def link_display(self):
896 if Options.options.progress_bar != 0:
897 return Task.Task.old_display(self)
898 fname = self.outputs[0].bldpath(self.env)
899 return progress_display(self, 'Linking', fname)
900 Task.TaskBase.classes['cc_link'].display = link_display
902 def samba_display(self):
903 if Options.options.progress_bar != 0:
904 return Task.Task.old_display(self)
906 targets = LOCAL_CACHE(self, 'TARGET_TYPE')
907 if self.name in targets:
908 target_type = targets[self.name]
909 type_map = { 'GENERATOR' : 'Generating',
910 'PROTOTYPE' : 'Generating'
912 if target_type in type_map:
913 return progress_display(self, type_map[target_type], self.name)
915 if len(self.inputs) == 0:
916 return Task.Task.old_display(self)
918 fname = self.inputs[0].bldpath(self.env)
919 if fname[0:3] == '../':
921 ext_loc = fname.rfind('.')
923 return Task.Task.old_display(self)
924 ext = fname[ext_loc:]
926 ext_map = { '.idl' : 'Compiling IDL',
927 '.et' : 'Compiling ERRTABLE',
928 '.asn1': 'Compiling ASN1',
931 return progress_display(self, ext_map[ext], fname)
932 return Task.Task.old_display(self)
934 Task.TaskBase.classes['Task'].old_display = Task.TaskBase.classes['Task'].display
935 Task.TaskBase.classes['Task'].display = samba_display
940 def apply_bundle_remove_dynamiclib_patch(self):
941 if self.env['MACBUNDLE'] or getattr(self,'mac_bundle',False):
942 if not getattr(self,'vnum',None):
944 self.env['LINKFLAGS'].remove('-dynamiclib')
945 self.env['LINKFLAGS'].remove('-single_module')