From: Andreas Schneider Date: Mon, 28 Apr 2025 11:28:56 +0000 (+0200) Subject: third_party: Update waf to version 2.0.27 X-Git-Tag: tevent-0.17.0~172 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6733ff6843ab89361daaf789329eedb4e73ca19;p=thirdparty%2Fsamba.git third_party: Update waf to version 2.0.27 This is the last 2.0.x version. Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri May 16 08:48:22 UTC 2025 on atb-devel-224 --- diff --git a/buildtools/bin/waf b/buildtools/bin/waf index c103979cc00..18ba6c4ec62 100755 --- a/buildtools/bin/waf +++ b/buildtools/bin/waf @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. import os, sys, inspect -VERSION="2.0.26" +VERSION="2.0.27" REVISION="x" GIT="x" INSTALL="x" diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 1a4943d6c5c..6140c8c0725 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -40,7 +40,7 @@ LIB_PATH="shared" 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 diff --git a/third_party/waf/waflib/Configure.py b/third_party/waf/waflib/Configure.py index f6fdc4e94a7..a8080b6f429 100644 --- a/third_party/waf/waflib/Configure.py +++ b/third_party/waf/waflib/Configure.py @@ -496,12 +496,12 @@ def find_binary(self, filenames, exts, paths): 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 diff --git a/third_party/waf/waflib/Context.py b/third_party/waf/waflib/Context.py index 369664819b6..971a9e6b5c1 100644 --- a/third_party/waf/waflib/Context.py +++ b/third_party/waf/waflib/Context.py @@ -18,13 +18,13 @@ else: 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" @@ -347,8 +347,11 @@ class Context(ctx): 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: @@ -422,8 +425,11 @@ class Context(ctx): 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: diff --git a/third_party/waf/waflib/Options.py b/third_party/waf/waflib/Options.py index d4104917c82..c1ee381a5e3 100644 --- a/third_party/waf/waflib/Options.py +++ b/third_party/waf/waflib/Options.py @@ -345,7 +345,7 @@ class OptionsContext(Context.Context): :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) @@ -356,4 +356,3 @@ class OptionsContext(Context.Context): super(OptionsContext, self).execute() self.parse_args() Utils.alloc_process_pool(options.jobs) - diff --git a/third_party/waf/waflib/Tools/c_config.py b/third_party/waf/waflib/Tools/c_config.py index f5ab19bf6ce..82a1a0ae455 100644 --- a/third_party/waf/waflib/Tools/c_config.py +++ b/third_party/waf/waflib/Tools/c_config.py @@ -1038,12 +1038,12 @@ def get_cc_version(conf, cc, gcc=False, icc=False, clang=False): 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 = {} @@ -1094,8 +1094,14 @@ def get_cc_version(conf, cc, gcc=False, icc=False, clang=False): 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__']) diff --git a/third_party/waf/waflib/Tools/glib2.py b/third_party/waf/waflib/Tools/glib2.py index 949fe37c3b6..1589a61c876 100644 --- a/third_party/waf/waflib/Tools/glib2.py +++ b/third_party/waf/waflib/Tools/glib2.py @@ -439,9 +439,7 @@ def find_glib_genmarshal(conf): @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): @@ -486,4 +484,3 @@ def options(opt): """ gr = opt.add_option_group('Installation directories') gr.add_option('--gsettingsschemadir', help='GSettings schema location [DATADIR/glib-2.0/schemas]', default='', dest='GSETTINGSSCHEMADIR') - diff --git a/third_party/waf/waflib/Tools/icc.py b/third_party/waf/waflib/Tools/icc.py index b6492c8e1a0..1b41ffcf708 100644 --- a/third_party/waf/waflib/Tools/icc.py +++ b/third_party/waf/waflib/Tools/icc.py @@ -7,24 +7,50 @@ 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() diff --git a/third_party/waf/waflib/Tools/icpc.py b/third_party/waf/waflib/Tools/icpc.py index 8a6cc6c40f9..04ec692177f 100644 --- a/third_party/waf/waflib/Tools/icpc.py +++ b/third_party/waf/waflib/Tools/icpc.py @@ -6,25 +6,50 @@ 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() diff --git a/third_party/waf/waflib/Tools/ifort.py b/third_party/waf/waflib/Tools/ifort.py index 17d3052910f..30230f5c382 100644 --- a/third_party/waf/waflib/Tools/ifort.py +++ b/third_party/waf/waflib/Tools/ifort.py @@ -11,7 +11,7 @@ from waflib.TaskGen import after_method, feature @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' diff --git a/third_party/waf/waflib/Tools/qt5.py b/third_party/waf/waflib/Tools/qt5.py index 0932e943ae6..7f26ac5f76e 100644 --- a/third_party/waf/waflib/Tools/qt5.py +++ b/third_party/waf/waflib/Tools/qt5.py @@ -530,13 +530,20 @@ def configure(self): 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 \nint main(int argc, char **argv) {QMap 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 @@ -846,14 +853,13 @@ def set_qt5_libs_to_check(self): 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\\w+)' + '$') + # match Qt6Name or QtName but not Qt5Name + mid_pattern = pat % 'Qt6?(?P[^5]\\w+)' else: - re_qt = re.compile(pat % 'Qt5?(?!\\d)(?P\\w+)' + '$') + # match Qt5Name or QtName but not Qt6Name + mid_pattern = pat % 'Qt5?(?P[^6]\\w+)' + re_qt = re.compile('^%s$' % mid_pattern) for x in sorted(dirlst): m = re_qt.match(x) diff --git a/third_party/waf/waflib/Tools/tex.py b/third_party/waf/waflib/Tools/tex.py index b4792c3fe87..22f78d0ef8f 100644 --- a/third_party/waf/waflib/Tools/tex.py +++ b/third_party/waf/waflib/Tools/tex.py @@ -355,9 +355,9 @@ class tex(Task.Task): 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() @@ -458,7 +458,7 @@ def apply_tex(self): 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: diff --git a/third_party/waf/waflib/extras/color_gcc.py b/third_party/waf/waflib/extras/color_gcc.py index 09729035fec..b580396c818 100644 --- a/third_party/waf/waflib/extras/color_gcc.py +++ b/third_party/waf/waflib/extras/color_gcc.py @@ -2,6 +2,9 @@ # 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 " __copyright__ = "Jérôme Carretero, 2012" @@ -36,4 +39,3 @@ class ColorGCCFormatter(Logs.formatter): def options(opt): Logs.log.handlers[0].setFormatter(ColorGCCFormatter(Logs.colors)) - diff --git a/third_party/waf/waflib/extras/color_msvc.py b/third_party/waf/waflib/extras/color_msvc.py index 60bacb7b240..3ea9ee635ac 100644 --- a/third_party/waf/waflib/extras/color_msvc.py +++ b/third_party/waf/waflib/extras/color_msvc.py @@ -14,18 +14,18 @@ class ColorMSVCFormatter(Logs.formatter): 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: diff --git a/third_party/waf/waflib/extras/msvcdeps.py b/third_party/waf/waflib/extras/msvcdeps.py index e8985bde7c7..263596a24f3 100644 --- a/third_party/waf/waflib/extras/msvcdeps.py +++ b/third_party/waf/waflib/extras/msvcdeps.py @@ -265,8 +265,11 @@ def exec_command(self, cmd, **kw): # 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: @@ -291,4 +294,3 @@ for k in ('c', 'cxx'): def options(opt): raise ValueError('Do not load msvcdeps options') - diff --git a/third_party/waf/waflib/extras/stale.py b/third_party/waf/waflib/extras/stale.py index cac3f469c94..25e89059782 100644 --- a/third_party/waf/waflib/extras/stale.py +++ b/third_party/waf/waflib/extras/stale.py @@ -14,9 +14,16 @@ Of course, it will only work if there are no dynamically generated 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 @@ -26,7 +33,7 @@ MOC_H_EXTS = '.cpp .cxx .hpp .hxx .h'.split() 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() @@ -51,7 +58,7 @@ def stale_rec(node, nodes): 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: @@ -75,21 +82,26 @@ def refill_task_list(self): 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