@@ -4,7 +4,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library")
4
4
load ("@rules_pkg//:mappings.bzl" , "pkg_files" , "strip_prefix" )
5
5
load ("@rules_proto//proto:defs.bzl" , "proto_lang_toolchain" , "proto_library" )
6
6
load ("@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" )
8
8
load (":protobuf.bzl" , "internal_objc_proto_library" , "internal_php_proto_library" , "internal_py_proto_library" , "internal_ruby_proto_library" )
9
9
10
10
licenses (["notice" ])
@@ -168,7 +168,21 @@ alias(
168
168
cc_binary (
169
169
name = "protoc" ,
170
170
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
+ }),
172
186
visibility = ["//visibility:public" ],
173
187
deps = ["//src/google/protobuf/compiler:protoc_lib" ],
174
188
)
0 commit comments