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 os, sys, re, shutil, fnmatch
5 from waflib import Build, Options, Task, Utils, TaskGen, Logs, Context, Errors
6 from waflib.Configure import conf
7 from waflib.Logs import debug
8 from samba_utils import SUBST_VARS_RECURSIVE
9 TaskGen.task_gen.apply_verif = Utils.nada
11 # bring in the other samba modules
12 from samba_utils import *
13 from samba_utils import symlink
14 from samba_version import *
15 from samba_autoconf import *
16 from samba_patterns import *
17 from samba_pidl import *
18 from samba_autoproto import *
19 from samba_python import *
20 from samba_perl import *
21 from samba_deps import *
22 from samba_bundled import *
23 from samba_third_party import *
26 import samba_conftests
39 os.environ['PYTHONUNBUFFERED'] = '1'
41 if Context.HEXVERSION not in (0x2001200,):
43 Please use the version of waf that comes with Samba, not
44 a system installed version. See http://wiki.samba.org/index.php/Waf
47 Alternatively, please run ./configure and make as usual. That will
48 call the right version of waf.''')
52 def SAMBA_BUILD_ENV(conf):
53 '''create the samba build environment'''
54 conf.env.BUILD_DIRECTORY = conf.bldnode.abspath()
55 mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, LIB_PATH))
56 mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, LIB_PATH, "private"))
57 mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, "modules"))
58 mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, 'python/samba/dcerpc'))
59 # this allows all of the bin/shared and bin/python targets
60 # to be expressed in terms of build directory paths
61 mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, 'default'))
62 for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python')]:
63 link_target = os.path.join(conf.env.BUILD_DIRECTORY, 'default/' + target)
64 if not os.path.lexists(link_target):
65 symlink('../' + source, link_target)
67 # get perl to put the blib files in the build directory
68 blib_bld = os.path.join(conf.env.BUILD_DIRECTORY, 'default/pidl/blib')
69 blib_src = os.path.join(conf.srcnode.abspath(), 'pidl/blib')
70 mkdir_p(blib_bld + '/man1')
71 mkdir_p(blib_bld + '/man3')
72 if os.path.islink(blib_src):
74 elif os.path.exists(blib_src):
75 shutil.rmtree(blib_src)
78 def ADD_INIT_FUNCTION(bld, subsystem, target, init_function):
79 '''add an init_function to the list for a subsystem'''
80 if init_function is None:
82 bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function)
83 cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
84 if not subsystem in cache:
86 cache[subsystem].append( { 'TARGET':target, 'INIT_FUNCTION':init_function } )
87 Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
90 def generate_empty_file(task):
91 task.outputs[0].write('')
94 #################################################################
95 def SAMBA_LIBRARY(bld, libname, source,
100 public_headers_install=True,
101 private_headers=None,
109 external_library=False,
111 keep_underscore=False,
113 autoproto_extra_source='',
124 target_type='LIBRARY',
125 bundled_extension=False,
132 private_library=False,
133 grouping_library=False,
134 allow_undefined_symbols=False,
135 allow_warnings=False,
137 '''define a Samba library'''
139 if private_library and public_headers:
140 raise Errors.WafError("private library '%s' must not have public header files" %
143 if LIB_MUST_BE_PRIVATE(bld, libname):
144 private_library = True
147 SET_TARGET_TYPE(bld, libname, 'DISABLED')
150 source = bld.EXPAND_VARIABLES(source, vars=vars)
152 source = bld.SUBDIR(subdir, source)
154 # remember empty libraries, so we can strip the dependencies
155 if ((source == '') or (source == [])):
156 if deps == '' and public_deps == '':
157 SET_TARGET_TYPE(bld, libname, 'EMPTY')
159 empty_c = libname + '.empty.c'
160 bld.SAMBA_GENERATOR('%s_empty_c' % libname,
161 rule=generate_empty_file,
165 if BUILTIN_LIBRARY(bld, libname):
168 obj_target = libname + '.objlist'
170 if group == 'libraries':
171 subsystem_group = 'main'
173 subsystem_group = group
175 # first create a target for building the object files for this library
176 # by separating in this way, we avoid recompiling the C files
177 # separately for the install library and the build library
178 bld.SAMBA_SUBSYSTEM(obj_target,
181 public_deps = public_deps,
183 public_headers = public_headers,
184 public_headers_install = public_headers_install,
185 private_headers= private_headers,
186 header_path = header_path,
188 cflags_end = cflags_end,
189 group = subsystem_group,
190 autoproto = autoproto,
191 autoproto_extra_source=autoproto_extra_source,
192 depends_on = depends_on,
193 hide_symbols = hide_symbols,
194 allow_warnings = allow_warnings,
197 local_include = local_include,
198 global_include = global_include)
200 if BUILTIN_LIBRARY(bld, libname):
203 if not SET_TARGET_TYPE(bld, libname, target_type):
206 # the library itself will depend on that object target
207 deps += ' ' + public_deps
209 deps.append(obj_target)
211 realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON'))
212 link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON'))
214 # we don't want any public libraries without version numbers
215 if (not private_library and target_type != 'PYTHON' and not realname):
216 if vnum is None and soname is None:
217 raise Errors.WafError("public library '%s' must have a vnum" %
220 raise Errors.WafError("public library '%s' must have pkg-config file" %
222 if public_headers is None:
223 raise Errors.WafError("public library '%s' must have header files" %
226 if bundled_name is not None:
228 elif target_type == 'PYTHON' or realname or not private_library:
230 bundled_name = libname
232 bundled_name = libname.replace('_', '-')
234 assert (private_library == True and realname is None)
235 if abi_directory or vnum or soname:
236 bundled_extension=True
237 bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-'),
238 bundled_extension, private_library)
240 ldflags = TO_LIST(ldflags)
241 if bld.env['ENABLE_RELRO'] is True:
242 ldflags.extend(TO_LIST('-Wl,-z,relro,-z,now'))
244 features = 'c cshlib symlink_lib install_lib'
248 features += ' pyembed'
251 features += ' abi_check'
253 if pyembed and bld.env['PYTHON_SO_ABI_FLAG']:
254 # For ABI checking, we don't care about the Python version.
255 # Remove the Python ABI tag (e.g. ".cpython-35m")
256 abi_flag = bld.env['PYTHON_SO_ABI_FLAG']
258 version_libname = libname.replace(abi_flag, replacement)
260 version_libname = libname
263 if bld.env.HAVE_LD_VERSION_SCRIPT:
265 version = "%s_%s" % (Context.g_module.APPNAME, Context.g_module.VERSION)
267 version = "%s_%s" % (libname, vnum)
271 vscript = "%s.vscript" % libname
272 bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
274 fullname = apply_pattern(bundled_name, bld.env.cshlib_PATTERN)
275 fullpath = bld.path.find_or_declare(fullname)
276 vscriptpath = bld.path.find_or_declare(vscript)
278 raise Errors.WafError("unable to find fullpath for %s" % fullname)
280 raise Errors.WafError("unable to find vscript path for %s" % vscript)
281 bld.add_manual_dependency(fullpath, vscriptpath)
283 # also make the .inst file depend on the vscript
284 instname = apply_pattern(bundled_name + '.inst', bld.env.cshlib_PATTERN)
285 bld.add_manual_dependency(bld.path.find_or_declare(instname), bld.path.find_or_declare(vscript))
286 vscript = os.path.join(bld.path.abspath(bld.env), vscript)
288 bld.SET_BUILD_GROUP(group)
292 target = bundled_name,
293 depends_on = depends_on,
294 samba_ldflags = ldflags,
296 samba_includes = includes,
297 version_script = vscript,
298 version_libname = version_libname,
299 local_include = local_include,
300 global_include = global_include,
304 samba_inst_path = install_path,
306 samba_realname = realname,
307 samba_install = install,
308 abi_directory = "%s/%s" % (bld.path.abspath(), abi_directory),
309 abi_match = abi_match,
310 private_library = private_library,
311 grouping_library=grouping_library,
312 allow_undefined_symbols=allow_undefined_symbols
315 if realname and not link_name:
316 link_name = 'shared/%s' % realname
319 if 'waflib.extras.compat15' in sys.modules:
320 link_name = 'default/' + link_name
321 t.link_name = link_name
323 if pc_files is not None and not private_library:
325 bld.PKG_CONFIG_FILES(pc_files, vnum=vnum, extra_name=bld.env['PYTHON_SO_ABI_FLAG'])
327 bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
329 if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and
330 bld.env['XSLTPROC_MANPAGES']):
331 bld.MANPAGES(manpages, install)
334 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
337 #################################################################
338 def SAMBA_BINARY(bld, binname, source,
342 private_headers=None,
350 use_global_deps=True,
363 '''define a Samba binary'''
366 SET_TARGET_TYPE(bld, binname, 'DISABLED')
369 if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
372 features = 'c cprogram symlink_bin install_bin'
374 features += ' pyembed'
376 obj_target = binname + '.objlist'
378 source = bld.EXPAND_VARIABLES(source, vars=vars)
380 source = bld.SUBDIR(subdir, source)
381 source = unique_list(TO_LIST(source))
383 if group == 'binaries':
384 subsystem_group = 'main'
386 subsystem_group = group
388 # only specify PIE flags for binaries
390 pie_ldflags = TO_LIST(ldflags)
391 if bld.env['ENABLE_PIE'] is True:
392 pie_cflags += ' -fPIE'
393 pie_ldflags.extend(TO_LIST('-pie'))
394 if bld.env['ENABLE_RELRO'] is True:
395 pie_ldflags.extend(TO_LIST('-Wl,-z,relro,-z,now'))
397 # first create a target for building the object files for this binary
398 # by separating in this way, we avoid recompiling the C files
399 # separately for the install binary and the build binary
400 bld.SAMBA_SUBSYSTEM(obj_target,
405 cflags_end = cflags_end,
406 group = subsystem_group,
407 autoproto = autoproto,
408 subsystem_name = subsystem_name,
409 local_include = local_include,
410 global_include = global_include,
411 use_hostcc = use_hostcc,
413 use_global_deps= use_global_deps)
415 bld.SET_BUILD_GROUP(group)
417 # the binary itself will depend on that object target
419 deps.append(obj_target)
426 samba_includes = includes,
427 local_include = local_include,
428 global_include = global_include,
429 samba_modules = modules,
431 samba_subsystem= subsystem_name,
433 samba_inst_path= install_path,
434 samba_install = install,
435 samba_ldflags = pie_ldflags
438 if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
439 bld.MANPAGES(manpages, install)
441 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
444 #################################################################
445 def SAMBA_MODULE(bld, modname, source,
450 module_init_name='samba_init_module',
452 autoproto_extra_source='',
455 internal_module=True,
463 allow_undefined_symbols=False,
464 allow_warnings=False,
467 '''define a Samba module.'''
469 bld.ASSERT(subsystem, "You must specify a subsystem for SAMBA_MODULE(%s)" % modname)
471 source = bld.EXPAND_VARIABLES(source, vars=vars)
473 source = bld.SUBDIR(subdir, source)
475 if internal_module or BUILTIN_LIBRARY(bld, modname):
476 # Do not create modules for disabled subsystems
477 if GET_TARGET_TYPE(bld, subsystem) == 'DISABLED':
479 bld.SAMBA_SUBSYSTEM(modname, source,
483 autoproto_extra_source=autoproto_extra_source,
485 cflags_end=cflags_end,
486 local_include=local_include,
487 global_include=global_include,
488 allow_warnings=allow_warnings,
491 bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
495 SET_TARGET_TYPE(bld, modname, 'DISABLED')
498 # Do not create modules for disabled subsystems
499 if GET_TARGET_TYPE(bld, subsystem) == 'DISABLED':
503 deps += ' ' + subsystem
504 while realname.startswith("lib"+subsystem+"_"):
505 realname = realname[len("lib"+subsystem+"_"):]
506 while realname.startswith(subsystem+"_"):
507 realname = realname[len(subsystem+"_"):]
509 build_name = "%s_module_%s" % (subsystem, realname)
511 realname = bld.make_libname(realname)
512 while realname.startswith("lib"):
513 realname = realname[len("lib"):]
515 build_link_name = "modules/%s/%s" % (subsystem, realname)
518 cflags += " -D%s=%s" % (init_function, module_init_name)
520 bld.SAMBA_LIBRARY(modname,
525 cflags_end=cflags_end,
527 autoproto = autoproto,
528 local_include=local_include,
529 global_include=global_include,
531 bundled_name=build_name,
532 link_name=build_link_name,
533 install_path="${MODULESDIR}/%s" % subsystem,
536 allow_undefined_symbols=allow_undefined_symbols,
537 allow_warnings=allow_warnings,
542 Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
545 #################################################################
546 def SAMBA_SUBSYSTEM(bld, modname, source,
551 public_headers_install=True,
552 private_headers=None,
557 init_function_sentinel=None,
559 autoproto_extra_source='',
562 local_include_first=True,
567 use_global_deps=True,
571 allow_warnings=False,
574 '''define a Samba subsystem'''
577 SET_TARGET_TYPE(bld, modname, 'DISABLED')
580 # remember empty subsystems, so we can strip the dependencies
581 if ((source == '') or (source == [])):
582 if deps == '' and public_deps == '':
583 SET_TARGET_TYPE(bld, modname, 'EMPTY')
585 empty_c = modname + '.empty.c'
586 bld.SAMBA_GENERATOR('%s_empty_c' % modname,
587 rule=generate_empty_file,
591 if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
594 source = bld.EXPAND_VARIABLES(source, vars=vars)
596 source = bld.SUBDIR(subdir, source)
597 source = unique_list(TO_LIST(source))
599 deps += ' ' + public_deps
601 bld.SET_BUILD_GROUP(group)
607 features += ' pyembed'
613 samba_cflags = CURRENT_CFLAGS(bld, modname, cflags,
614 allow_warnings=allow_warnings,
615 hide_symbols=hide_symbols),
616 depends_on = depends_on,
617 samba_deps = TO_LIST(deps),
618 samba_includes = includes,
619 local_include = local_include,
620 local_include_first = local_include_first,
621 global_include = global_include,
622 samba_subsystem= subsystem_name,
623 samba_use_hostcc = use_hostcc,
624 samba_use_global_deps = use_global_deps,
627 if cflags_end is not None:
628 t.samba_cflags.extend(TO_LIST(cflags_end))
630 if autoproto is not None:
631 bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
632 if public_headers is not None:
633 bld.PUBLIC_HEADERS(public_headers, header_path=header_path,
634 public_headers_install=public_headers_install)
638 Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
641 def SAMBA_GENERATOR(bld, name, rule, source='', target='',
642 group='generators', enabled=True,
644 public_headers_install=True,
645 private_headers=None,
650 '''A generic source generator target'''
652 if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
658 dep_vars.append('ruledeps')
659 dep_vars.append('SAMBA_GENERATOR_VARS')
661 bld.SET_BUILD_GROUP(group)
664 source=bld.EXPAND_VARIABLES(source, vars=vars),
666 shell=isinstance(rule, str),
670 samba_type='GENERATOR',
676 t.env.SAMBA_GENERATOR_VARS = vars
681 if public_headers is not None:
682 bld.PUBLIC_HEADERS(public_headers, header_path=header_path,
683 public_headers_install=public_headers_install)
685 Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
690 def SETUP_BUILD_GROUPS(bld):
691 '''setup build groups used to ensure that the different build
692 phases happen consecutively'''
693 bld.p_ln = bld.srcnode # we do want to see all targets!
694 bld.env['USING_BUILD_GROUPS'] = True
695 bld.add_group('setup')
696 bld.add_group('build_compiler_source')
697 bld.add_group('vscripts')
698 bld.add_group('base_libraries')
699 bld.add_group('generators')
700 bld.add_group('compiler_prototypes')
701 bld.add_group('compiler_libraries')
702 bld.add_group('build_compilers')
703 bld.add_group('build_source')
704 bld.add_group('prototypes')
705 bld.add_group('headers')
706 bld.add_group('main')
707 bld.add_group('symbolcheck')
708 bld.add_group('syslibcheck')
709 bld.add_group('final')
710 Build.BuildContext.SETUP_BUILD_GROUPS = SETUP_BUILD_GROUPS
713 def SET_BUILD_GROUP(bld, group):
714 '''set the current build group'''
715 if not 'USING_BUILD_GROUPS' in bld.env:
718 Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
722 def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
723 '''used to copy scripts from the source tree into the build directory
724 for use by selftest'''
726 source = bld.path.ant_glob(pattern, flat=True)
728 bld.SET_BUILD_GROUP('build_source')
729 for s in TO_LIST(source):
731 if installname is not None:
733 target = os.path.join(installdir, iname)
734 tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target))
736 link_src = os.path.normpath(os.path.join(bld.path.abspath(), s))
737 link_dst = os.path.join(tgtdir, os.path.basename(iname))
738 if os.path.islink(link_dst) and os.readlink(link_dst) == link_src:
740 if os.path.islink(link_dst):
742 Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
743 symlink(link_src, link_dst)
744 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
747 def copy_and_fix_python_path(task):
748 pattern='sys.path.insert(0, "bin/python")'
749 if task.env["PYTHONARCHDIR"] in sys.path and task.env["PYTHONDIR"] in sys.path:
751 elif task.env["PYTHONARCHDIR"] == task.env["PYTHONDIR"]:
752 replacement="""sys.path.insert(0, "%s")""" % task.env["PYTHONDIR"]
754 replacement="""sys.path.insert(0, "%s")
755 sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
757 if task.env["PYTHON"][0].startswith("/"):
758 replacement_shebang = "#!%s\n" % task.env["PYTHON"][0]
760 replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PYTHON"][0]
762 installed_location=task.outputs[0].bldpath(task.env)
763 source_file = open(task.inputs[0].srcpath(task.env))
764 installed_file = open(installed_location, 'w')
766 for line in source_file:
770 newline = replacement_shebang
771 elif pattern in line:
772 newline = line.replace(pattern, replacement)
773 installed_file.write(newline)
775 installed_file.close()
776 os.chmod(installed_location, 0o755)
779 def copy_and_fix_perl_path(task):
780 pattern='use lib "$RealBin/lib";'
783 if not task.env["PERL_LIB_INSTALL_DIR"] in task.env["PERL_INC"]:
784 replacement = 'use lib "%s";' % task.env["PERL_LIB_INSTALL_DIR"]
786 if task.env["PERL"][0] == "/":
787 replacement_shebang = "#!%s\n" % task.env["PERL"]
789 replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PERL"]
791 installed_location=task.outputs[0].bldpath(task.env)
792 source_file = open(task.inputs[0].srcpath(task.env))
793 installed_file = open(installed_location, 'w')
795 for line in source_file:
797 if lineno == 0 and task.env["PERL_SPECIFIED"] == True and line[:2] == "#!":
798 newline = replacement_shebang
799 elif pattern in line:
800 newline = line.replace(pattern, replacement)
801 installed_file.write(newline)
803 installed_file.close()
804 os.chmod(installed_location, 0o755)
808 def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
809 python_fixup=False, perl_fixup=False,
810 destname=None, base_name=None):
812 if not isinstance(file, str):
813 file = file.abspath()
814 destdir = bld.EXPAND_VARIABLES(destdir)
818 destname = os.path.basename(destname)
819 dest = os.path.join(destdir, destname)
821 # fix the path python will use to find Samba modules
822 inst_file = file + '.inst'
823 bld.SAMBA_GENERATOR('python_%s' % destname,
824 rule=copy_and_fix_python_path,
825 dep_vars=["PYTHON","PYTHON_SPECIFIED","PYTHONDIR","PYTHONARCHDIR"],
830 # fix the path perl will use to find Samba modules
831 inst_file = file + '.inst'
832 bld.SAMBA_GENERATOR('perl_%s' % destname,
833 rule=copy_and_fix_perl_path,
834 dep_vars=["PERL","PERL_SPECIFIED","PERL_LIB_INSTALL_DIR"],
839 file = os.path.join(base_name, file)
840 bld.install_as(dest, file, chmod=chmod)
843 def INSTALL_FILES(bld, destdir, files, chmod=MODE_644, flat=False,
844 python_fixup=False, perl_fixup=False,
845 destname=None, base_name=None):
846 '''install a set of files'''
847 for f in TO_LIST(files):
848 install_file(bld, destdir, f, chmod=chmod, flat=flat,
849 python_fixup=python_fixup, perl_fixup=perl_fixup,
850 destname=destname, base_name=base_name)
851 Build.BuildContext.INSTALL_FILES = INSTALL_FILES
854 def INSTALL_WILDCARD(bld, destdir, pattern, chmod=MODE_644, flat=False,
855 python_fixup=False, exclude=None, trim_path=None):
856 '''install a set of files matching a wildcard pattern'''
857 files=TO_LIST(bld.path.ant_glob(pattern, flat=True))
861 files2.append(os_path_relpath(f, trim_path))
866 if fnmatch.fnmatch(f, exclude):
868 INSTALL_FILES(bld, destdir, files, chmod=chmod, flat=flat,
869 python_fixup=python_fixup, base_name=trim_path)
870 Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
872 def INSTALL_DIR(bld, path, chmod=0o755, env=None):
873 """Install a directory if it doesn't exist, always set permissions."""
878 destpath = bld.EXPAND_VARIABLES(path)
879 if Options.options.destdir:
880 destpath = os.path.join(Options.options.destdir, destpath.lstrip(os.sep))
882 if bld.is_install > 0:
883 if not os.path.isdir(destpath):
885 Logs.info('* create %s', destpath)
886 os.makedirs(destpath)
887 os.chmod(destpath, chmod)
889 if not os.path.isdir(destpath):
890 raise Errors.WafError("Cannot create the folder '%s' (error: %s)" % (path, e))
891 Build.BuildContext.INSTALL_DIR = INSTALL_DIR
893 def INSTALL_DIRS(bld, destdir, dirs, chmod=0o755, env=None):
894 '''install a set of directories'''
895 destdir = bld.EXPAND_VARIABLES(destdir)
896 dirs = bld.EXPAND_VARIABLES(dirs)
897 for d in TO_LIST(dirs):
898 INSTALL_DIR(bld, os.path.join(destdir, d), chmod, env)
899 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS
902 def MANPAGES(bld, manpages, install):
903 '''build and install manual pages'''
904 bld.env.MAN_XSL = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
905 for m in manpages.split():
907 bld.SAMBA_GENERATOR(m,
911 rule='${XSLTPROC} --xinclude -o ${TGT} --nonet ${MAN_XSL} ${SRC}'
914 bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
915 Build.BuildContext.MANPAGES = MANPAGES
917 def SAMBAMANPAGES(bld, manpages, extra_source=None):
918 '''build and install manual pages'''
919 bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
920 bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl'
921 bld.env.SAMBA_CATALOG = bld.bldnode.abspath() + '/docs-xml/build/catalog.xml'
922 bld.env.SAMBA_CATALOGS = 'file:///etc/xml/catalog file:///usr/local/share/xml/catalog file://' + bld.env.SAMBA_CATALOG
924 for m in manpages.split():
926 if extra_source is not None:
927 source = [source, extra_source]
928 bld.SAMBA_GENERATOR(m,
932 dep_vars=['SAMBA_MAN_XSL', 'SAMBA_EXPAND_XSL', 'SAMBA_CATALOG'],
933 rule='''XML_CATALOG_FILES="${SAMBA_CATALOGS}"
934 export XML_CATALOG_FILES
935 ${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC[0].abspath(env)}
936 ${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'''
938 bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
939 Build.BuildContext.SAMBAMANPAGES = SAMBAMANPAGES
943 def apply_bundle_remove_dynamiclib_patch(self):
944 if self.env['MACBUNDLE'] or getattr(self,'mac_bundle',False):
945 if not getattr(self,'vnum',None):
947 self.env['LINKFLAGS'].remove('-dynamiclib')
948 self.env['LINKFLAGS'].remove('-single_module')