|  | @@ -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/<libname>/` 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 <openssl/;#include <openssl_grpc/;g'
 | 
	
		
			
				|  |  | -    END_OF_COMMAND
 | 
	
		
			
				|  |  | +      # BoringSSL include boringssl_prefix_symbols.h without any prefix, which does not match the
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    # Redefine symbols to avoid conflict when the same app also depends on OpenSSL. The list of
 | 
	
		
			
				|  |  | -    # symbols are src/objective-c/grpc_shadow_boringssl_symbol_list.
 | 
	
		
			
				|  |  | -    # This is the last part of this file.
 | 
	
		
			
				|  |  | -    s.prefix_header_contents = 
 | 
	
		
			
				|  |  | -      ${expand_symbol_list(settings.grpc_shadow_boringssl_symbols)}
 | 
	
		
			
				|  |  | +      # Xcode import style. We add it here so that Xcode knows where to find it.
 | 
	
		
			
				|  |  | +      find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <boringssl_prefix_symbols.h>;#include <openssl_grpc/boringssl_prefix_symbols.h>;g'
 | 
	
		
			
				|  |  | +    END_OF_COMMAND
 | 
	
		
			
				|  |  |    end
 |