#!/usr/bin/env python
-import string, Logs, Utils, Options, sys, Build, os, intltool, optparse, textwrap
+import string
+import os
+import optparse
+import textwrap
+from waflib import Logs, Errors, Options, Build, Context
from samba_utils import EXPAND_VARIABLES, os_path_relpath
class SambaIndentedHelpFormatter (optparse.IndentedHelpFormatter):
result.append(opts)
if option.help:
help_text = self.expand_default(option)
- if string.find(help_text, '\n') == -1:
+ if help_text.find('\n') == -1:
help_lines = textwrap.wrap(help_text, self.help_width)
else:
help_lines = help_text.splitlines()
'FHS-PATH': '${PYTHONARCHDIR}',
'OVERWRITE': True,
},
- 'MODULESDIR' : {
- 'STD-PATH': '${MODULESDIR}',
- 'FHS-PATH': '${MODULESDIR}/samba',
+ 'PERL_LIB_INSTALL_DIR' : {
+ 'STD-PATH': '${PERL_LIB_INSTALL_DIR}',
+ 'FHS-PATH': '${PERL_LIB_INSTALL_DIR}',
+ 'OVERWRITE': True,
+ },
+ 'PERL_ARCH_INSTALL_DIR' : {
+ 'STD-PATH': '${PERL_ARCH_INSTALL_DIR}',
+ 'FHS-PATH': '${PERL_ARCH_INSTALL_DIR}',
'OVERWRITE': True,
},
'INCLUDEDIR' : {
'STD-PATH': '${LIBDIR}/pkgconfig',
'FHS-PATH': '${LIBDIR}/pkgconfig',
},
- 'SWATDIR' : {
- 'STD-PATH': '${DATADIR}/swat',
- 'FHS-PATH': '${DATADIR}/samba/swat',
- },
'CODEPAGEDIR' : {
'STD-PATH': '${DATADIR}/codepages',
'FHS-PATH': '${DATADIR}/samba/codepages',
},
+ 'PRIVATELIBDIR' : {
+ 'STD-PATH': '${LIBDIR}/private',
+ 'FHS-PATH': '${LIBDIR}/samba',
+ 'OPTION': '--with-privatelibdir',
+ 'HELPTEXT': 'Which directory to use for private Samba libraries',
+ 'OVERWRITE': True,
+ },
+ 'MODULESDIR' : {
+ 'STD-PATH': '${LIBDIR}',
+ 'FHS-PATH': '${LIBDIR}/samba',
+ 'OPTION': '--with-modulesdir',
+ 'HELPTEXT': 'Which directory to use for Samba modules',
+ 'OVERWRITE': True,
+ },
'PAMMODULESDIR' : {
'STD-PATH': '${LIBDIR}/security',
'FHS-PATH': '${LIBDIR}/security',
'OPTION': '--with-privatedir',
'HELPTEXT': 'Where to put sam.ldb and other private files',
},
+ 'BINDDNS_DIR' : {
+ 'STD-PATH': '${PREFIX}/bind-dns',
+ 'FHS-PATH': '${LOCALSTATEDIR}/lib/samba/bind-dns',
+ 'OPTION': '--with-bind-dns-dir',
+ 'HELPTEXT': 'bind-dns config directory',
+ },
'LOCKDIR' : {
'STD-PATH': '${LOCALSTATEDIR}/lock',
'FHS-PATH': '${LOCALSTATEDIR}/lock/samba',
'FHS-PATH': '${SOCKET_DIR}/winbindd',
'DELAY': True,
},
- 'WINBINDD_PRIVILEGED_SOCKET_DIR' : {
- 'STD-PATH': '${PRIVILEGED_SOCKET_DIR}/winbindd_privileged',
- 'FHS-PATH': '${PRIVILEGED_SOCKET_DIR}/winbindd_privileged',
- 'DELAY': True,
- },
'NMBDSOCKETDIR' : {
'STD-PATH': '${SOCKET_DIR}/nmbd',
'FHS-PATH': '${SOCKET_DIR}/nmbd',
'DELAY': True,
},
'NTP_SIGND_SOCKET_DIR' : {
- 'STD-PATH': '${SOCKET_DIR}/ntp_signd',
- 'FHS-PATH': '${SOCKET_DIR}/ntp_signd',
+ 'STD-PATH': '${PRIVILEGED_SOCKET_DIR}/ntp_signd',
+ 'FHS-PATH': '${PRIVILEGED_SOCKET_DIR}/ntp_signd',
'DELAY': True,
},
'NCALRPCDIR' : {
'SMB_PASSWD_FILE' : {
'STD-PATH': '${PRIVATE_DIR}/smbpasswd',
'FHS-PATH': '${PRIVATE_DIR}/smbpasswd',
+ 'OPTION': '--with-smbpasswd-file',
+ 'HELPTEXT': 'Where to put the smbpasswd file',
'DELAY': True,
},
}
-def set_options(opt):
+def options(opt):
opt.parser.formatter = SambaIndentedHelpFormatter()
- opt.parser.formatter.width=Utils.get_term_cols()
+ opt.parser.formatter.width=Logs.get_term_cols()
+
+ for k in ('--with-privatelibdir', '--with-modulesdir'):
+ option = opt.parser.get_option(k)
+ if option:
+ opt.parser.remove_option(k)
+ del opt.parser.defaults['PRIVATELIBDIR']
+ del opt.parser.defaults['MODULESDIR']
# get all the basic GNU options from the gnu_dirs tool
fhs_help = "Use FHS-compliant paths (default no)\n"
fhs_help += "You should consider using this together with:\n"
- fhs_help += "--prefix=/usr --sysconfdir=/etc --locatestatedir=/var"
+ fhs_help += "--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
opt_group.add_option('--enable-fhs', help=fhs_help,
action="store_true", dest='ENABLE_FHS', default=False)
flavor = 'STD-PATH'
if conf.env.PREFIX == '/usr' or conf.env.PREFIX == '/usr/local':
Logs.error("Don't install directly under /usr or /usr/local without using the FHS option (--enable-fhs)")
- raise Utils.WafError("ERROR: invalid --prefix=%s value" % (conf.env.PREFIX))
+ raise Errors.WafError("ERROR: invalid --prefix=%s value" % (conf.env.PREFIX))
explicit_set ={}
conf.start_msg("Dynconfig[%s]: " % (varname))
conf.end_msg("'%s'" % (value), 'GREEN')
-def dynconfig_cflags(bld, list=None):
- '''work out the extra CFLAGS for dynconfig.c'''
- cflags = []
- # override some paths when running from the build directory
+def get_override(bld):
override = { 'MODULESDIR' : 'bin/modules',
'PYTHONDIR' : 'bin/python',
'PYTHONARCHDIR' : 'bin/python',
'BINDIR' : 'bin',
'SBINDIR' : 'bin',
- 'CODEPAGEDIR' : os.path.join(bld.env.srcdir, 'codepages'),
- 'SCRIPTSBINDIR' : os.path.join(bld.env.srcdir, 'source4/scripting/bin'),
- 'SETUPDIR' : os.path.join(bld.env.srcdir, 'source4/setup') }
+ 'CODEPAGEDIR' : 'codepages',
+ 'SCRIPTSBINDIR' : 'source4/scripting/bin',
+ 'SETUPDIR' : 'source4/setup'
+ }
+ return override
+
+def dynconfig_cflags(bld, list=None):
+ '''work out the extra CFLAGS for dynconfig.c'''
+ cflags = []
for varname in dynconfig.keys():
if list and not varname in list:
continue
value = bld.env[varname]
- if not Options.is_install:
+ if not bld.is_install:
+ override = get_override(bld)
if varname in override:
- value = os.path.join(os.getcwd(), override[varname])
+ value = os.path.join(bld.env.srcdir, override[varname])
cflags.append('-D%s="%s"' % (varname, value))
return cflags
Build.BuildContext.dynconfig_cflags = dynconfig_cflags
+def dynconfig_varnames(bld, list=None):
+ '''work out the dynconfig variables'''
+ varnames = []
+ for varname in dynconfig.keys():
+ if list and not varname in list:
+ continue
+ varnames.append(varname)
+ return varnames
+Build.BuildContext.dynconfig_varnames = dynconfig_varnames
+
+def pathconfig_entities(bld, list=None):
+ '''work out the extra entities for the docs'''
+ entities = []
+ for varname in dynconfig.keys():
+ if list and not varname in list:
+ continue
+ value = bld.env[varname]
+ if not bld.is_install:
+ override = get_override(bld)
+ if varname in override:
+ value = os.path.join(bld.env.srcdir, override[varname])
+ entities.append("<!ENTITY pathconfig.%s '%s'>" % (varname, value))
+ return entities
+Build.BuildContext.pathconfig_entities = pathconfig_entities
+
def build(bld):
cflags = bld.dynconfig_cflags()
version_header = 'version.h'
bld.SAMBA_SUBSYSTEM('DYNCONFIG',
'dynconfig.c',
- deps='replace talloc',
- public_headers=os_path_relpath(os.path.join(Options.launch_dir, version_header), bld.curdir),
+ deps='replace',
+ public_headers=os_path_relpath(os.path.join(Context.launch_dir, version_header), bld.path.abspath()),
header_path='samba',
cflags=cflags)
# install some extra empty directories
- bld.INSTALL_DIRS("", "${CONFIGDIR} ${PRIVATE_DIR} ${LOGFILEBASE}");
- bld.INSTALL_DIRS("", "${PRIVATE_DIR} ${PRIVILEGED_SOCKET_DIR}")
- bld.INSTALL_DIRS("", "${STATEDIR} ${CACHEDIR}");
+ bld.INSTALL_DIR("${CONFIGDIR}")
+ bld.INSTALL_DIR("${LOGFILEBASE}")
+ bld.INSTALL_DIR("${PRIVILEGED_SOCKET_DIR}")
+ bld.INSTALL_DIR("${PRIVATE_DIR}", 0o700)
+ bld.INSTALL_DIR("${BINDDNS_DIR}", 0o770)
+ bld.INSTALL_DIR("${STATEDIR}")
+ bld.INSTALL_DIR("${CACHEDIR}")
# these might be on non persistent storage
bld.INSTALL_DIRS("", "${LOCKDIR} ${PIDDIR} ${SOCKET_DIR}")