diff options
author | 2016-04-25 11:08:19 -0700 | |
---|---|---|
committer | 2016-06-08 19:21:49 -0700 | |
commit | 5842277ecbbbe694a828bd51934a28673f2f0a7f (patch) | |
tree | d3aeeac5d661f4124c6b95f5c930ecdff34f930d /src/objective-c/BoringSSL.podspec | |
parent | 39650266cb6335764a7b21a3a9093e146f41cfa8 (diff) |
Make BoringSSL work with frameworks
Cocoapods 1.0 keeps the directory structure of the public headers when
creating a dynamic framework, so if we keep the header_mappings_dir as it
was, includes would need to be of the form #include <openssl/openssl/ssl.h>
This means our header_mappings_dir has to be ‘include/openssl’ instead of
‘include’. Which in turn means that, for static libraries, we have to tell
Cocoapods to prepend an ‘openssl’ directory to the headers. We do that
with the ‘header_dir’ attribute of the podspec.
Diffstat (limited to 'src/objective-c/BoringSSL.podspec')
-rw-r--r-- | src/objective-c/BoringSSL.podspec | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index 4a6df910a7..3cd067e5d1 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - s.version = '2.0' + s.version = '3.0' s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: s.description = <<-DESC @@ -69,15 +69,19 @@ Pod::Spec.new do |s| s.source = { :git => 'https://boringssl.googlesource.com/boringssl', :tag => 'version_for_cocoapods_2.0' } + name = 'openssl' + s.module_name = name + s.header_dir = name + s.source_files = 'ssl/*.{h,c}', 'ssl/**/*.{h,c}', '*.{h,c}', 'crypto/*.{h,c}', 'crypto/**/*.{h,c}', 'include/openssl/*.h' - s.public_header_files = 'include/openssl/*.h' - s.header_mappings_dir = 'include' + s.header_mappings_dir = 'include/openssl' + s.module_map = 'include/openssl/module.modulemap' s.exclude_files = "**/*_test.*" @@ -92,6 +96,25 @@ Pod::Spec.new do |s| # included it in every bridged header). sed -E -i '.back' 's/\\*I,/*i,/g' include/openssl/rsa.h + # Replace `#include "../crypto/internal.h"` in e_tls.c with `#include "../internal.h"`. The + # former assumes crypto/ is in the headers search path, which is hard to enforce when using + # dynamic frameworks. The latters always works, being relative to the current file. + sed -E -i '.back' 's/crypto\\///g' crypto/cipher/e_tls.c + + # Add a module map and an umbrella header + cat > include/openssl/umbrella.h <<EOF + #include "ssl.h" + #include "crypto.h" + + EOF + cat > include/openssl/module.modulemap <<EOF + framework module openssl { + umbrella header "umbrella.h" + export * + module * { export * } + } + EOF + # This is a bit ridiculous, but requiring people to install Go in order to build is slightly # more ridiculous IMO. To save you from scrolling, this is the last part of the podspec. # TODO(jcanizales): Translate err_data_generate.go into a Bash or Ruby script. |