diff --git a/doc/updating_waf.txt b/doc/updating_waf.txt index 69c1225d63..0c192d4489 100644 --- a/doc/updating_waf.txt +++ b/doc/updating_waf.txt @@ -1,15 +1,20 @@ -Download waf (https://waf.io/) - -autowaf.py is present in the tools directory of the Ardour source code. -a patch for C++11/clang can be found in tools/waflib.patch (needed for waf 1.8.19) - -Current waf is build as follows; +# Download waf (https://waf.io/) +# +# autowaf.py and misc.py are present in the tools directory of the Ardour source code. +# - waf-str.patch is needed for py2/py3 compatible install_dir: +# * in py2 paths are byte-arrays and would need to be converted using .encode("utf-8") +# (otherwise waf expands them /t/o/p/a/t/h/s/l/i/k/e/t/h/i/s) +# * however py3 cannot handled encoded arrays: +# (TypeError: cannot use a string pattern on a bytes-like object) +# +# Current waf is build as follows: ARDOURSRC=`pwd` cd /tmp -curl https://waf.io/waf-1.6.11.tar.bz2 | tar xj -cd waf-1.6.11 +curl https://waf.io/waf-2.0.19.tar.bz2 | tar xj +cd waf-2.0.19 -patch -p1 < $ARDOURSRC/tools/waflib.patch -./waf-light -v --make-waf --tools=misc,doxygen,$ARDOURSRC/tools/autowaf.py --prelude='' +patch -p1 < $ARDOURSRC/tools/waf-str.patch + +./waf-light -v --make-waf --tools=misc,doxygen,$ARDOURSRC/tools/autowaf.py,$ARDOURSRC/tools/misc.py --prelude='' cp ./waf $ARDOURSRC/waf diff --git a/tools/autowaf.py b/tools/autowaf.py index f82b80a83f..375dc5909a 100644 --- a/tools/autowaf.py +++ b/tools/autowaf.py @@ -140,14 +140,13 @@ def check_pkg(conf, name, **args): found = None pkg_var_name = 'PKG_' + name.replace('-', '_') pkg_name = name - if conf.env.PARDEBUG: - args['mandatory'] = False # Smash mandatory arg - found = conf.check_cfg(package=pkg_name + 'D', args="--cflags --libs", **args) - if found: - pkg_name += 'D' if mandatory: args['mandatory'] = True # Unsmash mandatory arg - if not found: + if 'atleast_version' in args: + if not 'msg' in args: + args['msg'] = 'Checking for %r >= %s' %(pkg_name, args['atleast_version']) + found = conf.check_cfg(package=pkg_name, args=[pkg_name + " >= " + args['atleast_version'], '--cflags', '--libs'], **args) + else: found = conf.check_cfg(package=pkg_name, args="--cflags --libs", **args) if found: conf.env[pkg_var_name] = pkg_name diff --git a/tools/misc.py b/tools/misc.py index e8620fb14a..b82cdb63ba 100644 --- a/tools/misc.py +++ b/tools/misc.py @@ -80,67 +80,6 @@ def apply_copy(self): tsk.debug() raise Errors.WafError('task without an environment') -def subst_func(tsk): - "Substitutes variables in a .in file" - - m4_re = re.compile('@(\w+)@', re.M) - - code = tsk.inputs[0].read() #Utils.readf(infile) - - # replace all % by %% to prevent errors by % signs in the input file while string formatting - code = code.replace('%', '%%') - - s = m4_re.sub(r'%(\1)s', code) - - env = tsk.env - di = getattr(tsk, 'dict', {}) or getattr(tsk.generator, 'dict', {}) - if not di: - names = m4_re.findall(code) - for i in names: - di[i] = env.get_flat(i) or env.get_flat(i.upper()) - - tsk.outputs[0].write(s % di) - -@feature('subst') -@before_method('process_source') -def apply_subst(self): - Utils.def_attrs(self, fun=subst_func) - lst = self.to_list(self.source) - self.meths.remove('process_source') - - self.dict = getattr(self, 'dict', {}) - - for filename in lst: - node = self.path.find_resource(filename) - if not node: raise Errors.WafError('cannot find input file %s for processing' % filename) - - if self.target: - newnode = self.path.find_or_declare(self.target) - else: - newnode = node.change_ext('') - - try: - self.dict = self.dict.get_merged_dict() - except AttributeError: - pass - - if self.dict and not self.env['DICT_HASH']: - self.env = self.env.derive() - keys = list(self.dict.keys()) - keys.sort() - lst = [self.dict[x] for x in keys] - self.env['DICT_HASH'] = str(Utils.h_list(lst)) - - tsk = self.create_task('copy', node, newnode) - tsk.fun = self.fun - tsk.dict = self.dict - tsk.dep_vars = ['DICT_HASH'] - tsk.chmod = getattr(self, 'chmod', Utils.O644) - - if not tsk.env: - tsk.debug() - raise Errors.WafError('task without an environment') - #################### ## command-output #### #################### diff --git a/tools/waf-str.patch b/tools/waf-str.patch new file mode 100644 index 0000000000..8d37f68d32 --- /dev/null +++ b/tools/waf-str.patch @@ -0,0 +1,11 @@ +--- a/waflib/Build.py 2020-01-21 15:01:13.864899388 +0100 ++++ b/waflib/Build.py 2020-01-21 15:01:59.573030630 +0100 +@@ -953,7 +953,7 @@ + tsk.link = kw.get('link', '') or kw.get('install_from', '') + tsk.relative_trick = kw.get('relative_trick', False) + tsk.type = kw['type'] +- tsk.install_to = tsk.dest = kw['install_to'] ++ tsk.install_to = tsk.dest = str(kw['install_to']) + tsk.install_from = kw['install_from'] + tsk.relative_base = kw.get('cwd') or kw.get('relative_base', self.path) + tsk.install_user = kw.get('install_user') diff --git a/waf b/waf index 7363144d4b..da7d3440ed 100755 Binary files a/waf and b/waf differ