@@ -4,7 +4,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library")
44load ("@rules_pkg//:mappings.bzl" , "pkg_files" , "strip_prefix" )
55load ("@rules_proto//proto:defs.bzl" , "proto_lang_toolchain" , "proto_library" )
66load ("@rules_java//java:defs.bzl" , "java_lite_proto_library" , "java_proto_library" )
7- load ("//build_defs:cpp_opts.bzl" , "COPTS" , "LINK_OPTS" , "PROTOC_LINK_OPTS" )
7+ load ("//build_defs:cpp_opts.bzl" , "COPTS" , "LINK_OPTS" )
88load (":protobuf.bzl" , "internal_objc_proto_library" , "internal_php_proto_library" , "internal_py_proto_library" , "internal_ruby_proto_library" )
99
1010licenses (["notice" ])
@@ -168,7 +168,21 @@ alias(
168168cc_binary (
169169 name = "protoc" ,
170170 copts = COPTS ,
171- linkopts = LINK_OPTS + PROTOC_LINK_OPTS ,
171+ linkopts = LINK_OPTS ,
172+ visibility = ["//visibility:public" ],
173+ deps = ["//src/google/protobuf/compiler:protoc_lib" ],
174+ )
175+
176+ cc_binary (
177+ name = "protoc_static" ,
178+ copts = COPTS ,
179+ linkopts = LINK_OPTS ,
180+ features = select ({
181+ # This isn't possible on mac because there is no static library for lcrt0.o
182+ "@platforms//os:osx" : [],
183+ # When cross-compiling we need to statically link all C++ libraries.
184+ "//conditions:default" : ["fully_static_link" ],
185+ }),
172186 visibility = ["//visibility:public" ],
173187 deps = ["//src/google/protobuf/compiler:protoc_lib" ],
174188)
0 commit comments