This is the last 2.0.x version.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May 16 08:48:22 UTC 2025 on atb-devel-224
import os, sys, inspect
-VERSION="2.0.26"
+VERSION="2.0.27"
REVISION="x"
GIT="x"
INSTALL="x"
os.environ['PYTHONUNBUFFERED'] = '1'
-if Context.HEXVERSION not in (0x2001a00,):
+if Context.HEXVERSION not in (0x2001b00,):
Logs.error('''
Please use the version of waf that comes with Samba, not
a system installed version. See http://wiki.samba.org/index.php/Waf
for ext in exts:
exe_name = f + ext
if os.path.isabs(exe_name):
- if os.path.isfile(exe_name):
+ if os.path.isfile(exe_name) and os.access(exe_name, os.X_OK):
return exe_name
else:
for path in paths:
x = os.path.expanduser(os.path.join(path, exe_name))
- if os.path.isfile(x):
+ if os.path.isfile(x) and os.access(x, os.X_OK):
return x
return None
import imp
# the following 3 constants are updated on each new release (do not touch)
-HEXVERSION=0x2001a00
+HEXVERSION=0x2001b00
"""Constant updated on new releases"""
-WAFVERSION="2.0.26"
+WAFVERSION="2.0.27"
"""Constant updated on new releases"""
-WAFREVISION="0fb985ce1932c6f3e7533f435e4ee209d673776e"
+WAFREVISION="c3e645e395505cb5faa115172b1fc9abdaeaf146"
"""Git revision when the waf version is updated"""
WAFNAME="waf"
if 'stderr' not in kw:
kw['stderr'] = subprocess.PIPE
- if Logs.verbose and not kw['shell'] and not Utils.check_exe(cmd[0]):
- raise Errors.WafError('Program %s not found!' % cmd[0])
+ if Logs.verbose and not kw['shell'] and not Utils.check_exe(cmd[0], env=kw.get('env', os.environ)):
+ # This call isn't a shell command, and if the specified exe doesn't exist, check for a relative path being set
+ # with cwd and if so assume the caller knows what they're doing and don't pre-emptively fail
+ if not (cmd[0][0] == '.' and 'cwd' in kw):
+ raise Errors.WafError('Program %s not found!' % cmd[0])
cargs = {}
if 'timeout' in kw:
quiet = kw.pop('quiet', None)
to_ret = kw.pop('output', STDOUT)
- if Logs.verbose and not kw['shell'] and not Utils.check_exe(cmd[0]):
- raise Errors.WafError('Program %r not found!' % cmd[0])
+ if Logs.verbose and not kw['shell'] and not Utils.check_exe(cmd[0], env=kw.get('env', os.environ)):
+ # This call isn't a shell command, and if the specified exe doesn't exist, check for a relative path being set
+ # with cwd and if so assume the caller knows what they're doing and don't pre-emptively fail
+ if not (cmd[0][0] == '.' and 'cwd' in kw):
+ raise Errors.WafError('Program %s not found!' % cmd[0])
kw['stdout'] = kw['stderr'] = subprocess.PIPE
if quiet is None:
:param _args: arguments
:type _args: list of strings
"""
- options, commands, envvars = self.parse_cmd_args()
+ options, commands, envvars = self.parse_cmd_args(_args)
self.init_logs(options, commands, envvars)
self.init_module_vars(options, commands, envvars)
super(OptionsContext, self).execute()
self.parse_args()
Utils.alloc_process_pool(options.jobs)
-
if out.find('__GNUC__') < 0 and out.find('__clang__') < 0:
conf.fatal('Could not determine the compiler type')
- if icc and out.find('__INTEL_COMPILER') < 0:
- conf.fatal('Not icc/icpc')
+ if icc and out.find('__INTEL_COMPILER') < 0 and out.find('__INTEL_CLANG_COMPILER') < 0:
+ conf.fatal('Not icc/icx/icpc/icpx')
if clang and out.find('__clang__') < 0:
conf.fatal('Not clang/clang++')
- if not clang and out.find('__clang__') >= 0:
+ if not clang and not icc and out.find('__clang__') >= 0:
conf.fatal('Could not find gcc/g++ (only Clang), if renamed try eg: CC=gcc48 CXX=g++48 waf configure')
k = {}
Logs.debug('ccroot: dest platform: ' + ' '.join([conf.env[x] or '?' for x in ('DEST_OS', 'DEST_BINFMT', 'DEST_CPU')]))
if icc:
- ver = k['__INTEL_COMPILER']
- conf.env.CC_VERSION = (ver[:-2], ver[-2], ver[-1])
+ if isD('__INTEL_CLANG_COMPILER'):
+ # 20230100
+ ver = k['__INTEL_CLANG_COMPILER']
+ conf.env.CC_VERSION = (ver[:4], ver[4:6], ver[-2:])
+ conf.env.INTEL_CLANG_COMPILER = 1
+ else:
+ ver = k['__INTEL_COMPILER']
+ conf.env.CC_VERSION = (ver[:-2], ver[-2], ver[-1])
else:
if isD('__clang__') and isD('__clang_major__'):
conf.env.CC_VERSION = (k['__clang_major__'], k['__clang_minor__'], k['__clang_patchlevel__'])
@conf
def find_glib_mkenums(conf):
- if not conf.env.PERL:
- conf.find_program('perl', var='PERL')
- conf.find_program('glib-mkenums', interpreter='PERL', var='GLIB_MKENUMS')
+ conf.find_program('glib-mkenums', var='GLIB_MKENUMS')
@conf
def find_glib_compile_schemas(conf):
"""
gr = opt.add_option_group('Installation directories')
gr.add_option('--gsettingsschemadir', help='GSettings schema location [DATADIR/glib-2.0/schemas]', default='', dest='GSETTINGSSCHEMADIR')
-
Detects the Intel C compiler
"""
-import sys
+from waflib import Utils
from waflib.Tools import ccroot, ar, gcc
from waflib.Configure import conf
+from waflib.Tools import msvc
@conf
def find_icc(conf):
"""
Finds the program icc and execute it to ensure it really is icc
"""
- cc = conf.find_program(['icc', 'ICL'], var='CC')
- conf.get_cc_version(cc, icc=True)
+ if Utils.is_win32:
+ conf.find_program(['icx-cl'], var='ICXCL', mandatory=False)
+ if conf.env.ICXCL:
+ conf.env.INTEL_CLANG_COMPILER = True
+ conf.env.CC = conf.env.ICXCL
+
+ if not conf.env.ICXCL:
+ cc = conf.find_program(['icx', 'icc', 'ICL'], var='CC')
+ conf.get_cc_version(cc, icc=True)
+
conf.env.CC_NAME = 'icc'
def configure(conf):
conf.find_icc()
- conf.find_ar()
- conf.gcc_common_flags()
- conf.gcc_modifier_platform()
- conf.cc_load_tools()
- conf.cc_add_flags()
- conf.link_add_flags()
+ if conf.env.ICXCL and Utils.is_win32:
+ conf.find_msvc()
+ conf.find_program('MT', var='MT')
+ conf.env.MTFLAGS = ['/nologo']
+ conf.env.MSVC_MANIFEST = True
+
+ conf.msvc_common_flags()
+
+ conf.env.CFLAGS = []
+ conf.cc_load_tools()
+ conf.cc_add_flags()
+ conf.link_add_flags()
+
+ conf.visual_studio_add_flags()
+ conf.env.CC_TGT_F = ['/FC', '/c', '/Fo']
+ conf.env.CPPPATH_ST = '/I%s'
+ else:
+ conf.find_ar()
+ conf.gcc_common_flags()
+ conf.gcc_modifier_platform()
+ conf.cc_load_tools()
+ conf.cc_add_flags()
+ conf.link_add_flags()
Detects the Intel C++ compiler
"""
-import sys
+from waflib import Utils
from waflib.Tools import ccroot, ar, gxx
from waflib.Configure import conf
+from waflib.Tools import msvc
@conf
def find_icpc(conf):
"""
Finds the program icpc, and execute it to ensure it really is icpc
"""
- cxx = conf.find_program('icpc', var='CXX')
- conf.get_cc_version(cxx, icc=True)
+ if Utils.is_win32:
+ conf.find_program(['icx-cl'], var='ICPXCL', mandatory=False)
+ if conf.env.ICPXCL:
+ conf.env.INTEL_CLANG_COMPILER = True
+ conf.env.CXX = conf.env.ICPXCL
+
+ if not conf.env.ICPXCL:
+ cc = conf.find_program(['icpx', 'icpc', 'ICL'], var='CXX')
+ conf.get_cc_version(cc, icc=True)
+
conf.env.CXX_NAME = 'icc'
def configure(conf):
conf.find_icpc()
- conf.find_ar()
- conf.gxx_common_flags()
- conf.gxx_modifier_platform()
- conf.cxx_load_tools()
- conf.cxx_add_flags()
- conf.link_add_flags()
+ if conf.env.ICPXCL and Utils.is_win32:
+ conf.find_msvc()
+ conf.find_program('MT', var='MT')
+ conf.env.MTFLAGS = ['/nologo']
+ conf.env.MSVC_MANIFEST = True
+
+ conf.msvc_common_flags()
+
+ conf.env.CXXFLAGS = []
+ conf.cc_load_tools()
+ conf.cc_add_flags()
+ conf.link_add_flags()
+ conf.visual_studio_add_flags()
+ conf.env.CXX_TGT_F = ['/c', '/Fo']
+ conf.env.CPPPATH_ST = '/I%s'
+ else:
+ conf.find_ar()
+ conf.gxx_common_flags()
+ conf.gxx_modifier_platform()
+ conf.cc_load_tools()
+ conf.cc_add_flags()
+ conf.link_add_flags()
@conf
def find_ifort(conf):
- fc = conf.find_program('ifort', var='FC')
+ fc = conf.find_program(['ifx', 'ifort'], var='FC')
conf.get_ifort_version(fc)
conf.env.FC_NAME = 'IFORT'
Logs.error('No xml.sax support was found, rcc dependencies will be incomplete!')
feature = 'qt6' if self.want_qt6 else 'qt5'
- # Qt6 requires C++17 (https://www.qt.io/blog/qt-6.0-released)
- stdflag = '-std=c++17' if self.want_qt6 else '-std=c++11'
# Qt5 may be compiled with '-reduce-relocations' which requires dependent programs to have -fPIE or -fPIC?
frag = '#include <QMap>\nint main(int argc, char **argv) {QMap<int,int> m;return m.keys().size();}\n'
uses = 'QT6CORE' if self.want_qt6 else 'QT5CORE'
- for flag in [[], '-fPIE', '-fPIC', stdflag, [stdflag, '-fPIE'], [stdflag, '-fPIC']]:
+
+ # Qt6 requires C++17 (https://www.qt.io/blog/qt-6.0-released)
+ flag_list = []
+ if self.env.CXX_NAME == 'msvc':
+ stdflag = '/std:c++17' if self.want_qt6 else '/std:c++11'
+ flag_list = [[], ['/Zc:__cplusplus', '/permissive-', stdflag]]
+ else:
+ stdflag = '-std=c++17' if self.want_qt6 else '-std=c++11'
+ flag_list = [[], '-fPIE', '-fPIC', stdflag, [stdflag, '-fPIE'], [stdflag, '-fPIC']]
+ for flag in flag_list:
msg = 'See if Qt files compile '
if flag:
msg += 'with %s' % flag
if Utils.unversioned_sys_platform() == 'darwin':
pat = r"%s\.framework"
- # We only want to match Qt5 or Qt in the case of Qt5, in the case
- # of Qt6 we want to match Qt6 or Qt. This speeds up configuration
- # and reduces the chattiness of the configuration. Should also prevent
- # possible misconfiguration.
if self.want_qt6:
- re_qt = re.compile(pat % 'Qt6?(?!\\d)(?P<name>\\w+)' + '$')
+ # match Qt6Name or QtName but not Qt5Name
+ mid_pattern = pat % 'Qt6?(?P<name>[^5]\\w+)'
else:
- re_qt = re.compile(pat % 'Qt5?(?!\\d)(?P<name>\\w+)' + '$')
+ # match Qt5Name or QtName but not Qt6Name
+ mid_pattern = pat % 'Qt5?(?P<name>[^6]\\w+)'
+ re_qt = re.compile('^%s$' % mid_pattern)
for x in sorted(dirlst):
m = re_qt.match(x)
env = self.env
if not env.PROMPT_LATEX:
- env.append_value('LATEXFLAGS', '-interaction=batchmode')
- env.append_value('PDFLATEXFLAGS', '-interaction=batchmode')
- env.append_value('XELATEXFLAGS', '-interaction=batchmode')
+ env.append_value('LATEXFLAGS', '-interaction=nonstopmode')
+ env.append_value('PDFLATEXFLAGS', '-interaction=nonstopmode')
+ env.append_value('XELATEXFLAGS', '-interaction=nonstopmode')
# important, set the cwd for everybody
self.cwd = self.inputs[0].parent.get_bld()
outs = Utils.to_list(getattr(self, 'outs', []))
- # prompt for incomplete files (else the batchmode is used)
+ # prompt for incomplete files (else the nonstopmode is used)
try:
self.generator.bld.conf
except AttributeError:
# encoding: utf-8
# Replaces the default formatter by one which understands GCC output and colorizes it.
+#
+# This is mostly obsolete as gcc/g++ provide colored outputs by default:
+# CFLAGS="-fdiagnostics-color=always" CXXFLAGS="-fdiagnostics-color=always" waf configure clean build
__author__ = __maintainer__ = "Jérôme Carretero <cJ-waf@zougloub.eu>"
__copyright__ = "Jérôme Carretero, 2012"
def options(opt):
Logs.log.handlers[0].setFormatter(ColorGCCFormatter(Logs.colors))
-
def __init__(self, colors):
self.colors = colors
Logs.formatter.__init__(self)
-
+
def parseMessage(self, line, color):
# Split messaage from 'disk:filepath: type: message'
arr = line.split(':', 3)
if len(arr) < 4:
return line
-
+
colored = self.colors.BOLD + arr[0] + ':' + arr[1] + ':' + self.colors.NORMAL
colored += color + arr[2] + ':' + self.colors.NORMAL
colored += arr[3]
return colored
-
+
def format(self, rec):
frame = sys._getframe()
while frame:
# Pipe through the remaining stdout content (not related to /showIncludes)
if self.generator.bld.logger:
self.generator.bld.logger.debug('out: %s' % os.linesep.join(out))
- else:
- sys.stdout.write(os.linesep.join(out) + os.linesep)
+ elif len(out) > 1:
+ # msvc will output the input file name by default, which is not useful
+ # in the single-file case as waf will already print task. For multi-file
+ # inputs or other messages, allow the full message to be forwarded.
+ Logs.info(os.linesep.join(out), extra={'stream':sys.stdout, 'c1': ''})
return ret
finally:
def options(opt):
raise ValueError('Do not load msvcdeps options')
-
nodes/tasks, in which case the method will have to be modified
to exclude some folders for example.
-Make sure to set bld.post_mode = waflib.Build.POST_AT_ONCE
+Make sure to specify bld.post_mode = waflib.Build.POST_AT_ONCE::
+
+ def build(bld):
+ bld.load('stale')
+ import waflib.Build
+ bld.post_mode = waflib.Build.POST_AT_ONCE
+
"""
+import os
from waflib import Logs, Build
from waflib.Runner import Parallel
def can_delete(node):
"""Imperfect moc cleanup which does not look for a Q_OBJECT macro in the files"""
if not node.name.endswith('.moc'):
- return True
+ return os.path.isfile(node.abspath())
base = node.name[:-4]
p1 = node.parent.get_src()
p2 = node.parent.get_bld()
return
if getattr(node, 'children', []):
- for x in node.children.values():
+ for x in list(node.children.values()):
if x.name != "c4che":
stale_rec(x, nodes)
else:
self.stale_done = True
# this does not work in partial builds
- if bld.targets != '*':
+ if bld.targets not in ('', '*'):
return iit
# this does not work in dynamic builds
- if getattr(bld, 'post_mode') == Build.POST_AT_ONCE:
+ if getattr(bld, 'post_mode') != Build.POST_AT_ONCE:
+ Logs.warn('waflib.extras.stale is incompatible with dynamic builds')
return iit
# obtain the nodes to use during the build
nodes = []
- for tasks in bld.groups:
- for x in tasks:
+ for group in bld.groups:
+ for tg in group:
try:
- nodes.extend(x.outputs)
+ nodes.extend(tg.outputs)
except AttributeError:
- pass
+ for task in tg.tasks:
+ try:
+ nodes.extend(task.outputs)
+ except AttributeError:
+ pass
stale_rec(bld.bldnode, nodes)
return iit