From 3eda2881eb20d529967eaf16cbb6d82e7c9f247c Mon Sep 17 00:00:00 2001 From: Lighting Artist Date: Sat, 17 May 2025 14:48:24 +0800 Subject: [PATCH] [BUILD]Used to adapt to the Upgrade of libxml from 2.9.14 to 2.14.0 Change-Id: Idc246244af2b0fcd71d70dee7bba9e2e4a196946 Signed-off-by: Lighting Artist --- llvm-build/build.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/llvm-build/build.py b/llvm-build/build.py index d8c72488c7c4..6c23c8f8add1 100755 --- a/llvm-build/build.py +++ b/llvm-build/build.py @@ -692,14 +692,14 @@ class BuildUtils(object): return ncurses_libs def get_libxml2_version(self): - version_file = os.path.join(self.build_config.REPOROOT_DIR, 'third_party', 'libxml2', 'libxml2.spec') + version_file = os.path.join(self.build_config.REPOROOT_DIR, 'third_party', 'libxml2', 'README.OpenSource') if os.path.isfile(version_file): - pattern = r'Version:\s+(\d+\.\d+\.\d+)' + pattern = r'"Version Number"\s*:\s*"(\d+\.\d+\.\d+)"' with open(version_file, 'r') as file: lines = file.readlines() VERSION = '' for line in lines: - if 'Version: ' in line: + if 'Version Number' in line: VERSION = re.search(pattern, line).group(1) if VERSION != '': return VERSION @@ -2868,6 +2868,19 @@ class LlvmPackage(BuildUtils): self.check_copy_file(libxml2_src, lib_dst_path) + find_symbolic_links = lambda target, lib_path: next( + (item for item in os.listdir(lib_path) + if os.path.islink(os.path.join(lib_path, item)) + and os.readlink(os.path.join(lib_path, item)) == target), + None + ) + libxml2_link = find_symbolic_links('libxml2%s' % shlib_ext, lib_path) + if libxml2_link is not None: + libxml2_link_dst = os.path.join(lib_dst_path, libxml2_link) + if os.path.isfile(libxml2_link_dst): + os.remove(libxml2_link_dst) + os.symlink('libxml2%s' % shlib_ext, libxml2_link_dst) + def copy_lzma_to_llvm(self, platform_triple, install_dir): self.logger().info('copy_lzma_to_llvm install_dir is %s', install_dir) @@ -3026,7 +3039,7 @@ def main(): build_config.LIBXML2_VERSION = build_utils.get_libxml2_version() if build_config.LIBXML2_VERSION is None: - raise Exception('LIBXML2 version information not found, please check if the libxml2.spec file exists') + raise Exception('LIBXML2 version information not found, please check if the file README.OpenSource exists') if build_config.build_libxml2: llvm_libs.build_libxml2(build_utils.use_platform(), llvm_make, llvm_install) -- Gitee