]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
third_party: Update waf to version 2.0.27
authorAndreas Schneider <asn@samba.org>
Mon, 28 Apr 2025 11:28:56 +0000 (13:28 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 16 May 2025 08:48:22 +0000 (08:48 +0000)
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

16 files changed:
buildtools/bin/waf
buildtools/wafsamba/wafsamba.py
third_party/waf/waflib/Configure.py
third_party/waf/waflib/Context.py
third_party/waf/waflib/Options.py
third_party/waf/waflib/Tools/c_config.py
third_party/waf/waflib/Tools/glib2.py
third_party/waf/waflib/Tools/icc.py
third_party/waf/waflib/Tools/icpc.py
third_party/waf/waflib/Tools/ifort.py
third_party/waf/waflib/Tools/qt5.py
third_party/waf/waflib/Tools/tex.py
third_party/waf/waflib/extras/color_gcc.py
third_party/waf/waflib/extras/color_msvc.py
third_party/waf/waflib/extras/msvcdeps.py
third_party/waf/waflib/extras/stale.py

index c103979cc00e5b8c7990abe5bac6505390930c40..18ba6c4ec62699a0076ccecdfad0a95640659893 100755 (executable)
@@ -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"
index 1a4943d6c5cb2b5ff5d27ed7a66588002686ae65..6140c8c07252346b053f69ee0498767c452d4fcd 100644 (file)
@@ -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
index f6fdc4e94a79d724daefab889c250b2f2eb7c54f..a8080b6f429cf396802978c5a9e2c8a528ae89da 100644 (file)
@@ -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
 
index 369664819b6f894431be2233d6263e5b3dcdd11a..971a9e6b5c17c47bfa34a791fcf7f0be1beb4314 100644 (file)
@@ -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:
index d4104917c82456c6c78701a78f05873c483d198d..c1ee381a5e39e3f94e50b3c0ba032b3026e69365 100644 (file)
@@ -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)
-
index f5ab19bf6ce6be7bfb8d7e58dbf3ac71c37c5d78..82a1a0ae4554d71548873ccdf5fa385a510fe491 100644 (file)
@@ -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__'])
index 949fe37c3b6985beb68a04b2534c540a786314ea..1589a61c8762781cf8b76e76be16f42ff3558575 100644 (file)
@@ -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')
-
index b6492c8e1a0cdec7c4837e1b4ed44d007f43f8c3..1b41ffcf708ac4c1bac7df964a82a512f0b978aa 100644 (file)
@@ -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()
index 8a6cc6c40f9fb0872393f8c8c81b95d42fba18ab..04ec692177f6ba2e39a8e57f2c3aa91d7771e2c9 100644 (file)
@@ -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()
index 17d3052910f25ef8efb1a79a63c049dbb8920a9c..30230f5c382a6daa6bbfeffa7bfd0c026e89df61 100644 (file)
@@ -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'
 
index 0932e943ae646e50898d150fd960ac204f79fe9e..7f26ac5f76e2c4696f0f34f37f13a94b6c2d5e8b 100644 (file)
@@ -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 <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
@@ -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<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)
index b4792c3fe870100fc70b444133f44c9c0e62dd73..22f78d0ef8fb12b12943b88c21141c78554df6f6 100644 (file)
@@ -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:
index 09729035fecb44bf5e39969f49129561fddc2204..b580396c81846ea6e01ba0b5a527b343a7347912 100644 (file)
@@ -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 <cJ-waf@zougloub.eu>"
 __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))
-
index 60bacb7b24089921ca0d8b89d5e488be630de95c..3ea9ee635ac07c3b662e93f8cd9687c99b51f8f7 100644 (file)
@@ -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:
index e8985bde7c7bafcb4d91c4c202c138bc1fe69a12..263596a24f3691fee707851ed0e4e7a68631f67f 100644 (file)
@@ -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')
-
index cac3f469c941bbaea2e63341268af8831a7e148b..25e89059782c35c2a4925d77167d340677a739c3 100644 (file)
@@ -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