diff --git a/config/functions b/config/functions index e77c5a59eb..fa14e0e8e6 100644 --- a/config/functions +++ b/config/functions @@ -1063,6 +1063,20 @@ python_remove_source() { fi } +# arg1: directory to process recursively +# strip incorrect build-host ABI from native Python3 modules (see PEP3149) +python_fix_abi() { + local pymodule pyname + + for pymodule in $(find ${1} -type f -name '*.cpython-*.so' 2>/dev/null); do + pyname=${pymodule##*/} + pyname=${pyname%.so} # strip extension + pyname=${pyname%.*} # strip incorrect ABI + echo "python_fix_abi: Removing ABI from ${pymodule} -> ${pyname}.so" + mv ${pymodule} ${pymodule%/*}/${pyname}.so + done +} + ### KERNEL HELPERS ### kernel_path() { get_build_dir linux @@ -1264,6 +1278,7 @@ install_addon_files() { install_addon_source "$1" install_addon_images "$1" create_addon_xml "$1" + python_fix_abi "$1" } install_driver_addon_files() { diff --git a/scripts/build b/scripts/build index 41c4f65759..cd75277be5 100755 --- a/scripts/build +++ b/scripts/build @@ -474,6 +474,8 @@ if [ "${TARGET}" = "target" -o "${TARGET}" = "init" ]; then -exec rm -f {} \; 2>/dev/null || : find ${INSTALL} -type d -exec rmdir -p {} \; 2>/dev/null || : + python_fix_abi "${INSTALL}" + if [ ! "${BUILD_WITH_DEBUG}" = "yes" ]; then ${STRIP} $(find ${INSTALL} \ -type f -name "*.so*" \