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_deps
import *
20 from samba_bundled
import *
22 import samba_conftests
36 # some systems have broken threading in python
37 if os
.environ
.get('WAF_NOTHREADS') == '1':
42 os
.environ
['PYTHONUNBUFFERED'] = '1'
45 if Constants
.HEXVERSION
< 0x105019:
47 Please use the version of waf that comes with Samba, not
48 a system installed version. See http://wiki.samba.org/index.php/Waf
51 Alternatively, please run ./configure and make as usual. That will
52 call the right version of waf.''')
57 def SAMBA_BUILD_ENV(conf
):
58 '''create the samba build environment'''
59 conf
.env
.BUILD_DIRECTORY
= conf
.blddir
60 mkdir_p(os
.path
.join(conf
.blddir
, LIB_PATH
))
61 mkdir_p(os
.path
.join(conf
.blddir
, LIB_PATH
, "private"))
62 mkdir_p(os
.path
.join(conf
.blddir
, "modules"))
63 mkdir_p(os
.path
.join(conf
.blddir
, 'python/samba/dcerpc'))
64 # this allows all of the bin/shared and bin/python targets
65 # to be expressed in terms of build directory paths
66 mkdir_p(os
.path
.join(conf
.blddir
, 'default'))
67 for (source
, target
) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python_modules')]:
68 link_target
= os
.path
.join(conf
.blddir
, 'default/' + target
)
69 if not os
.path
.lexists(link_target
):
70 os
.symlink('../' + source
, link_target
)
72 # get perl to put the blib files in the build directory
73 blib_bld
= os
.path
.join(conf
.blddir
, 'default/pidl/blib')
74 blib_src
= os
.path
.join(conf
.srcdir
, 'pidl/blib')
75 mkdir_p(blib_bld
+ '/man1')
76 mkdir_p(blib_bld
+ '/man3')
77 if os
.path
.islink(blib_src
):
79 elif os
.path
.exists(blib_src
):
80 shutil
.rmtree(blib_src
)
83 def ADD_INIT_FUNCTION(bld
, subsystem
, target
, init_function
):
84 '''add an init_function to the list for a subsystem'''
85 if init_function
is None:
87 bld
.ASSERT(subsystem
is not None, "You must specify a subsystem for init_function '%s'" % init_function
)
88 cache
= LOCAL_CACHE(bld
, 'INIT_FUNCTIONS')
89 if not subsystem
in cache
:
91 cache
[subsystem
].append( { 'TARGET':target
, 'INIT_FUNCTION':init_function
} )
92 Build
.BuildContext
.ADD_INIT_FUNCTION
= ADD_INIT_FUNCTION
96 #################################################################
97 def SAMBA_LIBRARY(bld
, libname
, source
,
102 public_headers_install
=True,
109 external_library
=False,
112 autoproto_extra_source
='',
123 target_type
='LIBRARY',
124 bundled_extension
=True,
130 private_library
=False,
131 grouping_library
=False,
132 allow_undefined_symbols
=False,
135 '''define a Samba library'''
137 if LIB_MUST_BE_PRIVATE(bld
, libname
):
141 SET_TARGET_TYPE(bld
, libname
, 'DISABLED')
144 source
= bld
.EXPAND_VARIABLES(source
, vars=vars)
146 source
= bld
.SUBDIR(subdir
, source
)
148 # remember empty libraries, so we can strip the dependencies
149 if ((source
== '') or (source
== [])) and deps
== '' and public_deps
== '':
150 SET_TARGET_TYPE(bld
, libname
, 'EMPTY')
153 if BUILTIN_LIBRARY(bld
, libname
):
156 obj_target
= libname
+ '.objlist'
158 if group
== 'libraries':
159 subsystem_group
= 'main'
161 subsystem_group
= group
163 # first create a target for building the object files for this library
164 # by separating in this way, we avoid recompiling the C files
165 # separately for the install library and the build library
166 bld
.SAMBA_SUBSYSTEM(obj_target
,
169 public_deps
= public_deps
,
171 public_headers
= public_headers
,
172 public_headers_install
= public_headers_install
,
173 header_path
= header_path
,
175 group
= subsystem_group
,
176 autoproto
= autoproto
,
177 autoproto_extra_source
=autoproto_extra_source
,
178 depends_on
= depends_on
,
179 hide_symbols
= hide_symbols
,
180 allow_warnings
= allow_warnings
,
183 local_include
= local_include
,
184 global_include
= global_include
)
186 if BUILTIN_LIBRARY(bld
, libname
):
189 if not SET_TARGET_TYPE(bld
, libname
, target_type
):
192 # the library itself will depend on that object target
193 deps
+= ' ' + public_deps
195 deps
.append(obj_target
)
197 realname
= bld
.map_shlib_extension(realname
, python
=(target_type
=='PYTHON'))
198 link_name
= bld
.map_shlib_extension(link_name
, python
=(target_type
=='PYTHON'))
200 # we don't want any public libraries without version numbers
201 if (not private_library
and target_type
!= 'PYTHON' and not realname
):
202 if vnum
is None and soname
is None:
203 raise Utils
.WafError("public library '%s' must have a vnum" %
206 raise Utils
.WafError("public library '%s' must have pkg-config file" %
208 if public_headers
is None:
209 raise Utils
.WafError("public library '%s' must have header files" %
212 if target_type
== 'PYTHON' or realname
or not private_library
:
213 bundled_name
= libname
.replace('_', '-')
215 bundled_name
= PRIVATE_NAME(bld
, libname
, bundled_extension
,
218 ldflags
= TO_LIST(ldflags
)
220 features
= 'cc cshlib symlink_lib install_lib'
224 features
+= ' pyembed'
227 features
+= ' abi_check'
230 if bld
.env
.HAVE_LD_VERSION_SCRIPT
:
232 version
= "%s_%s" % (Utils
.g_module
.APPNAME
, Utils
.g_module
.VERSION
)
234 version
= "%s_%s" % (libname
, vnum
)
238 vscript
= "%s.vscript" % libname
239 bld
.ABI_VSCRIPT(libname
, abi_directory
, version
, vscript
,
241 fullname
= apply_pattern(bundled_name
, bld
.env
.shlib_PATTERN
)
242 fullpath
= bld
.path
.find_or_declare(fullname
)
243 vscriptpath
= bld
.path
.find_or_declare(vscript
)
245 raise Utils
.WafError("unable to find fullpath for %s" % fullname
)
247 raise Utils
.WafError("unable to find vscript path for %s" % vscript
)
248 bld
.add_manual_dependency(fullpath
, vscriptpath
)
249 if Options
.is_install
:
250 # also make the .inst file depend on the vscript
251 instname
= apply_pattern(bundled_name
+ '.inst', bld
.env
.shlib_PATTERN
)
252 bld
.add_manual_dependency(bld
.path
.find_or_declare(instname
), bld
.path
.find_or_declare(vscript
))
253 vscript
= os
.path
.join(bld
.path
.abspath(bld
.env
), vscript
)
255 bld
.SET_BUILD_GROUP(group
)
259 target
= bundled_name
,
260 depends_on
= depends_on
,
261 samba_ldflags
= ldflags
,
263 samba_includes
= includes
,
264 version_script
= vscript
,
265 local_include
= local_include
,
266 global_include
= global_include
,
270 samba_inst_path
= install_path
,
272 samba_realname
= realname
,
273 samba_install
= install
,
274 abi_directory
= "%s/%s" % (bld
.path
.abspath(), abi_directory
),
275 abi_match
= abi_match
,
276 private_library
= private_library
,
277 grouping_library
=grouping_library
,
278 allow_undefined_symbols
=allow_undefined_symbols
281 if realname
and not link_name
:
282 link_name
= 'shared/%s' % realname
285 t
.link_name
= link_name
287 if pc_files
is not None and not private_library
:
288 bld
.PKG_CONFIG_FILES(pc_files
, vnum
=vnum
)
290 if (manpages
is not None and 'XSLTPROC_MANPAGES' in bld
.env
and
291 bld
.env
['XSLTPROC_MANPAGES']):
292 bld
.MANPAGES(manpages
, install
)
295 Build
.BuildContext
.SAMBA_LIBRARY
= SAMBA_LIBRARY
298 #################################################################
299 def SAMBA_BINARY(bld
, binname
, source
,
309 use_global_deps
=True,
322 '''define a Samba binary'''
325 SET_TARGET_TYPE(bld
, binname
, 'DISABLED')
328 if not SET_TARGET_TYPE(bld
, binname
, 'BINARY'):
331 features
= 'cc cprogram symlink_bin install_bin'
333 features
+= ' pyembed'
335 obj_target
= binname
+ '.objlist'
337 source
= bld
.EXPAND_VARIABLES(source
, vars=vars)
339 source
= bld
.SUBDIR(subdir
, source
)
340 source
= unique_list(TO_LIST(source
))
342 if group
== 'binaries':
343 subsystem_group
= 'main'
345 subsystem_group
= group
347 # only specify PIE flags for binaries
349 pie_ldflags
= TO_LIST(ldflags
)
350 if bld
.env
['ENABLE_PIE'] == True:
351 pie_cflags
+= ' -fPIE'
352 pie_ldflags
.extend(TO_LIST('-pie'))
353 if bld
.env
['ENABLE_RELRO'] == True:
354 pie_ldflags
.extend(TO_LIST('-Wl,-z,relro,-z,now'))
356 # first create a target for building the object files for this binary
357 # by separating in this way, we avoid recompiling the C files
358 # separately for the install binary and the build binary
359 bld
.SAMBA_SUBSYSTEM(obj_target
,
364 group
= subsystem_group
,
365 autoproto
= autoproto
,
366 subsystem_name
= subsystem_name
,
367 local_include
= local_include
,
368 global_include
= global_include
,
369 use_hostcc
= use_hostcc
,
371 use_global_deps
= use_global_deps
)
373 bld
.SET_BUILD_GROUP(group
)
375 # the binary itself will depend on that object target
377 deps
.append(obj_target
)
384 samba_includes
= includes
,
385 local_include
= local_include
,
386 global_include
= global_include
,
387 samba_modules
= modules
,
389 samba_subsystem
= subsystem_name
,
391 samba_inst_path
= install_path
,
392 samba_install
= install
,
393 samba_ldflags
= pie_ldflags
396 if manpages
is not None and 'XSLTPROC_MANPAGES' in bld
.env
and bld
.env
['XSLTPROC_MANPAGES']:
397 bld
.MANPAGES(manpages
, install
)
399 Build
.BuildContext
.SAMBA_BINARY
= SAMBA_BINARY
402 #################################################################
403 def SAMBA_MODULE(bld
, modname
, source
,
408 module_init_name
='samba_init_module',
410 autoproto_extra_source
='',
412 internal_module
=True,
420 allow_undefined_symbols
=False,
423 '''define a Samba module.'''
425 source
= bld
.EXPAND_VARIABLES(source
, vars=vars)
427 source
= bld
.SUBDIR(subdir
, source
)
429 if internal_module
or BUILTIN_LIBRARY(bld
, modname
):
430 # Do not create modules for disabled subsystems
431 if subsystem
and GET_TARGET_TYPE(bld
, subsystem
) == 'DISABLED':
433 bld
.SAMBA_SUBSYSTEM(modname
, source
,
437 autoproto_extra_source
=autoproto_extra_source
,
439 local_include
=local_include
,
440 global_include
=global_include
,
441 allow_warnings
=allow_warnings
,
444 bld
.ADD_INIT_FUNCTION(subsystem
, modname
, init_function
)
448 SET_TARGET_TYPE(bld
, modname
, 'DISABLED')
451 # Do not create modules for disabled subsystems
452 if subsystem
and GET_TARGET_TYPE(bld
, subsystem
) == 'DISABLED':
455 obj_target
= modname
+ '.objlist'
458 if subsystem
is not None:
459 deps
+= ' ' + subsystem
460 while realname
.startswith("lib"+subsystem
+"_"):
461 realname
= realname
[len("lib"+subsystem
+"_"):]
462 while realname
.startswith(subsystem
+"_"):
463 realname
= realname
[len(subsystem
+"_"):]
465 realname
= bld
.make_libname(realname
)
466 while realname
.startswith("lib"):
467 realname
= realname
[len("lib"):]
469 build_link_name
= "modules/%s/%s" % (subsystem
, realname
)
472 cflags
+= " -D%s=%s" % (init_function
, module_init_name
)
474 bld
.SAMBA_LIBRARY(modname
,
480 autoproto
= autoproto
,
481 local_include
=local_include
,
482 global_include
=global_include
,
484 link_name
=build_link_name
,
485 install_path
="${MODULESDIR}/%s" % subsystem
,
488 allow_undefined_symbols
=allow_undefined_symbols
,
489 allow_warnings
=allow_warnings
493 Build
.BuildContext
.SAMBA_MODULE
= SAMBA_MODULE
496 #################################################################
497 def SAMBA_SUBSYSTEM(bld
, modname
, source
,
502 public_headers_install
=True,
507 init_function_sentinel
=None,
509 autoproto_extra_source
='',
512 local_include_first
=True,
517 use_global_deps
=True,
524 '''define a Samba subsystem'''
527 SET_TARGET_TYPE(bld
, modname
, 'DISABLED')
530 # remember empty subsystems, so we can strip the dependencies
531 if ((source
== '') or (source
== [])) and deps
== '' and public_deps
== '':
532 SET_TARGET_TYPE(bld
, modname
, 'EMPTY')
535 if not SET_TARGET_TYPE(bld
, modname
, 'SUBSYSTEM'):
538 source
= bld
.EXPAND_VARIABLES(source
, vars=vars)
540 source
= bld
.SUBDIR(subdir
, source
)
541 source
= unique_list(TO_LIST(source
))
543 deps
+= ' ' + public_deps
545 bld
.SET_BUILD_GROUP(group
)
551 features
+= ' pyembed'
557 samba_cflags
= CURRENT_CFLAGS(bld
, modname
, cflags
,
558 allow_warnings
=allow_warnings
,
559 hide_symbols
=hide_symbols
),
560 depends_on
= depends_on
,
561 samba_deps
= TO_LIST(deps
),
562 samba_includes
= includes
,
563 local_include
= local_include
,
564 local_include_first
= local_include_first
,
565 global_include
= global_include
,
566 samba_subsystem
= subsystem_name
,
567 samba_use_hostcc
= use_hostcc
,
568 samba_use_global_deps
= use_global_deps
,
571 if cflags_end
is not None:
572 t
.samba_cflags
.extend(TO_LIST(cflags_end
))
574 if autoproto
is not None:
575 bld
.SAMBA_AUTOPROTO(autoproto
, source
+ TO_LIST(autoproto_extra_source
))
576 if public_headers
is not None:
577 bld
.PUBLIC_HEADERS(public_headers
, header_path
=header_path
,
578 public_headers_install
=public_headers_install
)
582 Build
.BuildContext
.SAMBA_SUBSYSTEM
= SAMBA_SUBSYSTEM
585 def SAMBA_GENERATOR(bld
, name
, rule
, source
='', target
='',
586 group
='generators', enabled
=True,
588 public_headers_install
=True,
592 '''A generic source generator target'''
594 if not SET_TARGET_TYPE(bld
, name
, 'GENERATOR'):
601 if isinstance(vars, dict):
602 dep_vars
= vars.keys()
603 elif isinstance(vars, list):
606 bld
.SET_BUILD_GROUP(group
)
609 source
=bld
.EXPAND_VARIABLES(source
, vars=vars),
611 shell
=isinstance(rule
, str),
615 samba_type
='GENERATOR',
616 dep_vars
= [rule
] + dep_vars
,
622 if public_headers
is not None:
623 bld
.PUBLIC_HEADERS(public_headers
, header_path
=header_path
,
624 public_headers_install
=public_headers_install
)
626 Build
.BuildContext
.SAMBA_GENERATOR
= SAMBA_GENERATOR
631 def SETUP_BUILD_GROUPS(bld
):
632 '''setup build groups used to ensure that the different build
633 phases happen consecutively'''
634 bld
.p_ln
= bld
.srcnode
# we do want to see all targets!
635 bld
.env
['USING_BUILD_GROUPS'] = True
636 bld
.add_group('setup')
637 bld
.add_group('build_compiler_source')
638 bld
.add_group('vscripts')
639 bld
.add_group('base_libraries')
640 bld
.add_group('generators')
641 bld
.add_group('compiler_prototypes')
642 bld
.add_group('compiler_libraries')
643 bld
.add_group('build_compilers')
644 bld
.add_group('build_source')
645 bld
.add_group('prototypes')
646 bld
.add_group('headers')
647 bld
.add_group('main')
648 bld
.add_group('symbolcheck')
649 bld
.add_group('syslibcheck')
650 bld
.add_group('final')
651 Build
.BuildContext
.SETUP_BUILD_GROUPS
= SETUP_BUILD_GROUPS
654 def SET_BUILD_GROUP(bld
, group
):
655 '''set the current build group'''
656 if not 'USING_BUILD_GROUPS' in bld
.env
:
659 Build
.BuildContext
.SET_BUILD_GROUP
= SET_BUILD_GROUP
664 def ENABLE_TIMESTAMP_DEPENDENCIES(conf
):
665 """use timestamps instead of file contents for deps
666 this currently doesn't work"""
667 def h_file(filename
):
669 st
= os
.stat(filename
)
670 if stat
.S_ISDIR(st
[stat
.ST_MODE
]): raise IOError('not a file')
672 m
.update(str(st
.st_mtime
))
673 m
.update(str(st
.st_size
))
676 Utils
.h_file
= h_file
679 def SAMBA_SCRIPT(bld
, name
, pattern
, installdir
, installname
=None):
680 '''used to copy scripts from the source tree into the build directory
681 for use by selftest'''
683 source
= bld
.path
.ant_glob(pattern
)
685 bld
.SET_BUILD_GROUP('build_source')
686 for s
in TO_LIST(source
):
688 if installname
is not None:
690 target
= os
.path
.join(installdir
, iname
)
691 tgtdir
= os
.path
.dirname(os
.path
.join(bld
.srcnode
.abspath(bld
.env
), '..', target
))
693 link_src
= os
.path
.normpath(os
.path
.join(bld
.curdir
, s
))
694 link_dst
= os
.path
.join(tgtdir
, os
.path
.basename(iname
))
695 if os
.path
.islink(link_dst
) and os
.readlink(link_dst
) == link_src
:
697 if os
.path
.exists(link_dst
):
699 Logs
.info("symlink: %s -> %s/%s" % (s
, installdir
, iname
))
700 os
.symlink(link_src
, link_dst
)
701 Build
.BuildContext
.SAMBA_SCRIPT
= SAMBA_SCRIPT
704 def copy_and_fix_python_path(task
):
705 pattern
='sys.path.insert(0, "bin/python")'
706 if task
.env
["PYTHONARCHDIR"] in sys
.path
and task
.env
["PYTHONDIR"] in sys
.path
:
708 elif task
.env
["PYTHONARCHDIR"] == task
.env
["PYTHONDIR"]:
709 replacement
="""sys.path.insert(0, "%s")""" % task
.env
["PYTHONDIR"]
711 replacement
="""sys.path.insert(0, "%s")
712 sys.path.insert(1, "%s")""" % (task
.env
["PYTHONARCHDIR"], task
.env
["PYTHONDIR"])
716 if task
.env
["PYTHON"][0] == "/":
717 replacement_shebang
= "#!%s\n" % task
.env
["PYTHON"]
719 replacement_shebang
= "#!/usr/bin/env %s\n" % task
.env
["PYTHON"]
721 installed_location
=task
.outputs
[0].bldpath(task
.env
)
722 source_file
= open(task
.inputs
[0].srcpath(task
.env
))
723 installed_file
= open(installed_location
, 'w')
725 for line
in source_file
:
727 if lineno
== 0 and task
.env
["PYTHON_SPECIFIED"] == True and line
[:2] == "#!":
728 newline
= replacement_shebang
729 elif pattern
in line
:
730 newline
= line
.replace(pattern
, replacement
)
731 installed_file
.write(newline
)
733 installed_file
.close()
734 os
.chmod(installed_location
, 0755)
738 def install_file(bld
, destdir
, file, chmod
=MODE_644
, flat
=False,
739 python_fixup
=False, destname
=None, base_name
=None):
741 destdir
= bld
.EXPAND_VARIABLES(destdir
)
745 destname
= os
.path
.basename(destname
)
746 dest
= os
.path
.join(destdir
, destname
)
748 # fixup the python path it will use to find Samba modules
749 inst_file
= file + '.inst'
750 bld
.SAMBA_GENERATOR('python_%s' % destname
,
751 rule
=copy_and_fix_python_path
,
754 bld
.add_manual_dependency(bld
.path
.find_or_declare(inst_file
), bld
.env
["PYTHONARCHDIR"])
755 bld
.add_manual_dependency(bld
.path
.find_or_declare(inst_file
), bld
.env
["PYTHONDIR"])
756 bld
.add_manual_dependency(bld
.path
.find_or_declare(inst_file
), str(bld
.env
["PYTHON_SPECIFIED"]))
757 bld
.add_manual_dependency(bld
.path
.find_or_declare(inst_file
), bld
.env
["PYTHON"])
760 file = os
.path
.join(base_name
, file)
761 bld
.install_as(dest
, file, chmod
=chmod
)
764 def INSTALL_FILES(bld
, destdir
, files
, chmod
=MODE_644
, flat
=False,
765 python_fixup
=False, destname
=None, base_name
=None):
766 '''install a set of files'''
767 for f
in TO_LIST(files
):
768 install_file(bld
, destdir
, f
, chmod
=chmod
, flat
=flat
,
769 python_fixup
=python_fixup
, destname
=destname
,
771 Build
.BuildContext
.INSTALL_FILES
= INSTALL_FILES
774 def INSTALL_WILDCARD(bld
, destdir
, pattern
, chmod
=MODE_644
, flat
=False,
775 python_fixup
=False, exclude
=None, trim_path
=None):
776 '''install a set of files matching a wildcard pattern'''
777 files
=TO_LIST(bld
.path
.ant_glob(pattern
))
781 files2
.append(os_path_relpath(f
, trim_path
))
786 if fnmatch
.fnmatch(f
, exclude
):
788 INSTALL_FILES(bld
, destdir
, files
, chmod
=chmod
, flat
=flat
,
789 python_fixup
=python_fixup
, base_name
=trim_path
)
790 Build
.BuildContext
.INSTALL_WILDCARD
= INSTALL_WILDCARD
793 def INSTALL_DIRS(bld
, destdir
, dirs
):
794 '''install a set of directories'''
795 destdir
= bld
.EXPAND_VARIABLES(destdir
)
796 dirs
= bld
.EXPAND_VARIABLES(dirs
)
797 for d
in TO_LIST(dirs
):
798 bld
.install_dir(os
.path
.join(destdir
, d
))
799 Build
.BuildContext
.INSTALL_DIRS
= INSTALL_DIRS
802 def MANPAGES(bld
, manpages
, install
):
803 '''build and install manual pages'''
804 bld
.env
.MAN_XSL
= 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
805 for m
in manpages
.split():
807 bld
.SAMBA_GENERATOR(m
,
811 rule
='${XSLTPROC} --xinclude -o ${TGT} --nonet ${MAN_XSL} ${SRC}'
814 bld
.INSTALL_FILES('${MANDIR}/man%s' % m
[-1], m
, flat
=True)
815 Build
.BuildContext
.MANPAGES
= MANPAGES
817 def SAMBAMANPAGES(bld
, manpages
, extra_source
=None):
818 '''build and install manual pages'''
819 bld
.env
.SAMBA_EXPAND_XSL
= bld
.srcnode
.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
820 bld
.env
.SAMBA_MAN_XSL
= bld
.srcnode
.abspath() + '/docs-xml/xslt/man.xsl'
821 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'
823 for m
in manpages
.split():
825 if extra_source
is not None:
826 source
= [source
, extra_source
]
827 bld
.SAMBA_GENERATOR(m
,
831 rule
='''XML_CATALOG_FILES="${SAMBA_CATALOGS}"
832 export XML_CATALOG_FILES
833 ${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC[0].abspath(env)}
834 ${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'''
836 bld
.INSTALL_FILES('${MANDIR}/man%s' % m
[-1], m
, flat
=True)
837 Build
.BuildContext
.SAMBAMANPAGES
= SAMBAMANPAGES
839 #############################################################
840 # give a nicer display when building different types of files
841 def progress_display(self
, msg
, fname
):
842 col1
= Logs
.colors(self
.color
)
843 col2
= Logs
.colors
.NORMAL
844 total
= self
.position
[1]
846 fs
= '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n
, n
, msg
)
847 return fs
% (self
.position
[0], self
.position
[1], col1
, fname
, col2
)
849 def link_display(self
):
850 if Options
.options
.progress_bar
!= 0:
851 return Task
.Task
.old_display(self
)
852 fname
= self
.outputs
[0].bldpath(self
.env
)
853 return progress_display(self
, 'Linking', fname
)
854 Task
.TaskBase
.classes
['cc_link'].display
= link_display
856 def samba_display(self
):
857 if Options
.options
.progress_bar
!= 0:
858 return Task
.Task
.old_display(self
)
860 targets
= LOCAL_CACHE(self
, 'TARGET_TYPE')
861 if self
.name
in targets
:
862 target_type
= targets
[self
.name
]
863 type_map
= { 'GENERATOR' : 'Generating',
864 'PROTOTYPE' : 'Generating'
866 if target_type
in type_map
:
867 return progress_display(self
, type_map
[target_type
], self
.name
)
869 if len(self
.inputs
) == 0:
870 return Task
.Task
.old_display(self
)
872 fname
= self
.inputs
[0].bldpath(self
.env
)
873 if fname
[0:3] == '../':
875 ext_loc
= fname
.rfind('.')
877 return Task
.Task
.old_display(self
)
878 ext
= fname
[ext_loc
:]
880 ext_map
= { '.idl' : 'Compiling IDL',
881 '.et' : 'Compiling ERRTABLE',
882 '.asn1': 'Compiling ASN1',
885 return progress_display(self
, ext_map
[ext
], fname
)
886 return Task
.Task
.old_display(self
)
888 Task
.TaskBase
.classes
['Task'].old_display
= Task
.TaskBase
.classes
['Task'].display
889 Task
.TaskBase
.classes
['Task'].display
= samba_display
894 def apply_bundle_remove_dynamiclib_patch(self
):
895 if self
.env
['MACBUNDLE'] or getattr(self
,'mac_bundle',False):
896 if not getattr(self
,'vnum',None):
898 self
.env
['LINKFLAGS'].remove('-dynamiclib')
899 self
.env
['LINKFLAGS'].remove('-single_module')