1load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library") 2load("@rules_rust//rust:defs.bzl", "rust_shared_library") 3 4# A rust_shared_library (forcing the use of pic) that depends on a native 5# linker library with only a static_library member. 6rust_shared_library( 7 name = "rust_shared_lib_with_static_dep", 8 srcs = ["rust_shared_lib_with_static_dep.rs"], 9 deps = [":static_cclib"], 10) 11 12cc_library( 13 name = "nonstandard_name_cc_lib", 14 srcs = ["cc_library_with_func.cc"], 15) 16 17genrule( 18 name = "nonstandard_name_gen", 19 srcs = [":nonstandard_name_cc_lib"], 20 outs = ["nonstandard_name_gen.a"], 21 # Copy the first member (libnonstandard_name_cc_lib.a) from the srcs to the 22 # output nonstandard_name_gen.a. 23 cmd = "cp $$(awk '{print $$1}' <<< '$(SRCS)') $@", 24) 25 26cc_import( 27 name = "static_cclib", 28 static_library = "nonstandard_name_gen.a", 29) 30