diff options
author | hiddenpath <hiddenpath@yandex-team.com> | 2023-08-22 11:29:21 +0300 |
---|---|---|
committer | hiddenpath <hiddenpath@yandex-team.com> | 2023-08-22 12:10:26 +0300 |
commit | b83892f362596c907029f97068a54d1c8b8c0fb4 (patch) | |
tree | bf006f929fd6e2b6136877817d7e2bed0f990e66 /build/scripts/copy_clang_profile_rt.py | |
parent | f10bc4e5bd07c8e5293d63f09e50e0d5f8e2902f (diff) | |
download | ydb-b83892f362596c907029f97068a54d1c8b8c0fb4.tar.gz |
Make libclang.rt_profile depends on sources again
Diffstat (limited to 'build/scripts/copy_clang_profile_rt.py')
-rw-r--r-- | build/scripts/copy_clang_profile_rt.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/build/scripts/copy_clang_profile_rt.py b/build/scripts/copy_clang_profile_rt.py new file mode 100644 index 0000000000..1e5cd9c56a --- /dev/null +++ b/build/scripts/copy_clang_profile_rt.py @@ -0,0 +1,38 @@ +import optparse +import os +import shutil + +import process_command_files as pcf + +CLANG_RT_VERSION = 14 + +def copy_clang_rt_profile(cmd, build_root, arch) -> None: + profile_rt_lib = None + resource_dir = None + + for arg in cmd: + if arg.startswith(f'contrib/libs/clang{CLANG_RT_VERSION}-rt/lib/profile/libclang_rt.profile'): + profile_rt_lib = arg + if arg.startswith('-resource-dir='): + resource_dir = arg[len('-resource-dir='):] + + profile_rt_path = os.path.join(build_root, profile_rt_lib) + profile_name = os.path.basename(profile_rt_path) + + dst_dir = os.path.join(build_root, resource_dir, 'lib/{}'.format(arch.lower())) + os.makedirs(dst_dir, exist_ok=True) + shutil.copy(profile_rt_path, os.path.join(dst_dir, profile_name)) + + +def parse_args(): + parser = optparse.OptionParser() + parser.disable_interspersed_args() + parser.add_option('--build-root') + parser.add_option('--arch') + return parser.parse_args() + + +if __name__ == '__main__': + opts, args = parse_args() + args = pcf.skip_markers(args) + copy_clang_rt_profile(args, opts.build_root, opts.arch) |