diff options
author | Zach Yu <zachyu@google.com> | 2022-08-22 17:42:15 -0700 |
---|---|---|
committer | Zach Yu <zachyu@google.com> | 2022-09-28 19:12:41 -0700 |
commit | d37763a38599d32a1e9db3bd823e30937100f62f (patch) | |
tree | c019b4fa8973c24e71015f22fe460724c300e221 /toolchains/cc/clang.BUILD | |
parent | a0f4a4b6996131c180258a40ae26a4e33e2876d8 (diff) | |
download | bazel-d37763a38599d32a1e9db3bd823e30937100f62f.tar.gz |
Add local repositories clang and gcc_lib
These repositories exports the tools / files needed by the toolchain in
their BUILD files.
A `selective_local_repository` rule is added to ignore the pre-existing
BUILD files in the repository tree so the added BUILD files can take
sole control.
Bug: 242091931
Change-Id: I6ffda4731bc8ef62becd589295cbfbd009e427bd
Diffstat (limited to 'toolchains/cc/clang.BUILD')
-rw-r--r-- | toolchains/cc/clang.BUILD | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/toolchains/cc/clang.BUILD b/toolchains/cc/clang.BUILD new file mode 100644 index 00000000..b8dba917 --- /dev/null +++ b/toolchains/cc/clang.BUILD @@ -0,0 +1,91 @@ +load("@//build/bazel/toolchains/cc:cc_toolchain_config.bzl", "cc_tools") + +package(default_visibility = ["@//build/bazel/toolchains/cc:__subpackages__"]) + +# The clang path definition for each platform +CLANG_LINUX_X64 = "linux-x86/clang-r450784d" + +target_linux_x64 = ":" + CLANG_LINUX_X64 + +cc_tools( + name = "linux_x64", + ar = target_linux_x64 + "/bin/llvm-ar", + ar_features = [ + "archiver_flags", + ], + cxx = target_linux_x64 + "/bin/clang++", + gcc = target_linux_x64 + "/bin/clang", + ld = target_linux_x64 + "/bin/clang++", + ld_features = [ + "shared_flag", + "linkstamps", + "output_execpath_flags", + "runtime_library_search_directories", + "library_search_directories", + "libraries_to_link", + "force_pic_flags", + "user_link_flags", + "strip_debug_symbols", + "linker_param_file", + ], + strip = target_linux_x64 + "/bin/llvm-strip", +) + +filegroup( + name = "linux_x64_binaries", + srcs = glob( + [CLANG_LINUX_X64 + "/bin/*"], + allow_empty = False, + ), +) + +filegroup( + name = "linux_x64_includes", + srcs = glob( + [ + CLANG_LINUX_X64 + "/lib64/clang/*/include/**", + CLANG_LINUX_X64 + "/include/c++/v1/**", + ], + allow_empty = False, + ), +) + +filegroup( + name = "linux_x64_libs", + srcs = glob( + [ + CLANG_LINUX_X64 + "/lib64/*", + CLANG_LINUX_X64 + "/lib64/clang/*/lib/linux/**", + ], + allow_empty = False, + ), +) + +filegroup( + name = "linux_x64_include_paths", + srcs = glob( + [CLANG_LINUX_X64 + "/lib64/clang/*/include"], + allow_empty = False, + exclude_directories = 0, + ) + [CLANG_LINUX_X64 + "/include/c++/v1"], +) + +filegroup( + name = "linux_x64_lib_paths", + srcs = glob( + [CLANG_LINUX_X64 + "/lib64/clang/*/lib/linux"], + allow_empty = False, + exclude_directories = 0, + ) + [target_linux_x64 + "/lib64"], +) + +cc_library( + name = "linux_x64_runtime_libs", + srcs = glob( + [ + CLANG_LINUX_X64 + "/lib64/*.so", + CLANG_LINUX_X64 + "/lib64/*.so.*", + ], + ), + visibility = ["//visibility:public"], +) |