diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 9bebbdf4097..bad6e190c36 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -175,7 +175,7 @@ ss.libraries = 'z' ss.dependency "#{s.name}/Interface", version ss.dependency 'BoringSSL-GRPC', '0.0.5' - ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' + ss.compiler_flags = '-DBORINGSSL_PREFIX=GRPC' ss.source_files = ${ruby_multiline_list(grpc_private_files(libs), 22)} diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 94c07657d4d..39b52eed146 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -1,8 +1,6 @@ %YAML 1.2 --- | <%! - def expand_symbol_list(symbol_list): - return ',\n '.join("'#define %s GRPC_SHADOW_%s'" % (symbol, symbol) for symbol in symbol_list) import subprocess boringssl_commit = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd='third_party/boringssl').decode().strip() %> @@ -119,7 +117,7 @@ # We don't need to inhibit all warnings; only -Wno-shorten-64-to-32. But Cocoapods' linter doesn't # want that for some reason. - s.compiler_flags = '-DOPENSSL_NO_ASM', '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' + s.compiler_flags = '-DOPENSSL_NO_ASM', '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w', '-DBORINGSSL_PREFIX=GRPC' s.requires_arc = false # Like many other C libraries, BoringSSL has its public headers under `include//` and its @@ -225,25 +223,14 @@ % endfor EOF - # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with "#define - # SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are - # already redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL - # SOME_BORINGSSL_SYMBOL" Such type of redefinition will cause "SOME_BORINGSSL_SYMBOL redefined" - # error when using together with our prefix header. So the workaround in the below lines removes - # all such type of #define directives. - sed -i'.back' '/^#define \\([A-Za-z0-9_]*\\) \\1/d' include/openssl/*.h - # Remove lines of the format below for the same reason above - # #define SOME_BORINGSSL_SYMBOL ${"\\"} - # SOME_BORINGSSL_SYMBOL - sed -i'.back' '/^#define.*\\\\$/{N;/^#define \\([A-Za-z0-9_]*\\) *\\\\\\n *\\1/d;}' include/openssl/*.h + # Grab prefix header from GCS + curl -o include/openssl/boringssl_prefix_symbols.h https://storage.googleapis.com/grpc_boringssl_prefix_headers/boringssl_prefix_symbols-${boringssl_commit}.h # We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include ;#include ;g' + END_OF_COMMAND end