diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-09-25 21:21:13 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2021-10-03 19:48:29 +0300 |
commit | 7c5cd5ef10208dbbe2181da7bf3195540f6dcfbc (patch) | |
tree | b928f351d22f3b25d711ff73704e4f8b735ddb1b /waftools | |
parent | 5304e9fe31d5c1059199fea0655e6e3eabb93b3e (diff) | |
download | mpv-7c5cd5ef10208dbbe2181da7bf3195540f6dcfbc.tar.bz2 mpv-7c5cd5ef10208dbbe2181da7bf3195540f6dcfbc.tar.xz |
build: lua version: sanitize id before storage (no-op)
The lua version names which are autodetected/chosen (such as "51deb")
are used for two things:
- as key for storing the pkg-config compile/link flags.
- as ID for config.h and elsewhere - they're sanitized to use "_".
Due to some inconsistensies, if the sanitized ID is different than
the original name, then the compile/link flags are stored with the
original name as key, while the retrieval happens with the sanitized
ID - and therefore fails to find the correct flags.
The solution is to use the original name only for display purpose at
the output of configure, while using the sanitized version for
everything else, so that storage and retrieval use the same key.
Currently there's no issue and the patch has no effect, because the
sanitizer considers all the current names as valid IDs.
However, the next commit will add names which the sanitizer modifies,
such as "lua-5.1", so this commit makes such names work too.
Diffstat (limited to 'waftools')
-rw-r--r-- | waftools/checks/custom.py | 4 | ||||
-rw-r--r-- | waftools/inflector.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py index 964546977b..017b503e52 100644 --- a/waftools/checks/custom.py +++ b/waftools/checks/custom.py @@ -75,13 +75,15 @@ def check_lua(ctx, dependency_identifier): [lv for lv in lua_versions if lv[0] == ctx.options.LUA_VER] for lua_version, pkgconfig_query in lua_versions: + display_version = lua_version + lua_version = inflector.sanitize_id(lua_version) if check_pkg_config(pkgconfig_query, uselib_store=lua_version) \ (ctx, dependency_identifier): # XXX: this is a bit of a hack, ask waf developers if I can copy # the uselib_store to 'lua' ctx.mark_satisfied(lua_version) ctx.add_optional_message(dependency_identifier, - 'version found: ' + lua_version) + 'version found: ' + display_version) return True return False diff --git a/waftools/inflector.py b/waftools/inflector.py index 184c74a3bf..3aa1bc1f99 100644 --- a/waftools/inflector.py +++ b/waftools/inflector.py @@ -1,6 +1,6 @@ import re -def _underscore(word): +def sanitize_id(word): """ Converts a word "into_it_s_underscored_version" Convert any "CamelCased" or "ordinary Word" into an "underscored_word".""" @@ -10,7 +10,7 @@ def _underscore(word): re.sub('([A-Z]+)([A-Z][a-z])', '\\1_\\2', re.sub('::', '/', word)))).lower() def storage_key(dep): - return _underscore(dep) + return sanitize_id(dep) def define_key(dep): return ("have_" + storage_key(dep)).upper() |