murgatroid99 | c525de8 | 2015-06-22 11:17:33 -0700 | [diff] [blame] | 1 | # GRPC CocoaPods podspec |
| 2 | # This file has been automatically generated from a template file. |
| 3 | # Please look at the templates directory instead. |
| 4 | # This file can be regenerated from the template by running |
| 5 | # tools/buildgen/generate_projects.sh |
| 6 | |
| 7 | # Copyright 2015, Google Inc. |
| 8 | # All rights reserved. |
| 9 | # |
| 10 | # Redistribution and use in source and binary forms, with or without |
| 11 | # modification, are permitted provided that the following conditions are |
| 12 | # met: |
| 13 | # |
| 14 | # * Redistributions of source code must retain the above copyright |
| 15 | # notice, this list of conditions and the following disclaimer. |
| 16 | # * Redistributions in binary form must reproduce the above |
| 17 | # copyright notice, this list of conditions and the following disclaimer |
| 18 | # in the documentation and/or other materials provided with the |
| 19 | # distribution. |
| 20 | # * Neither the name of Google Inc. nor the names of its |
| 21 | # contributors may be used to endorse or promote products derived from |
| 22 | # this software without specific prior written permission. |
| 23 | # |
| 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 28 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 29 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 30 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 31 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 32 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 34 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 | |
murgatroid99 | f398d5c | 2015-06-16 14:07:36 -0700 | [diff] [blame] | 36 | <%! |
| 37 | bad_header_names = ('time.h', 'string.h') |
| 38 | def fix_header_name(name): |
| 39 | split_name = name.split('/') |
| 40 | if split_name[-1] in bad_header_names: |
murgatroid99 | df35577 | 2015-06-23 16:39:29 -0700 | [diff] [blame] | 41 | split_name[-1] = 'grpc_' + split_name[-1] |
| 42 | if split_name[0] == 'include': |
| 43 | split_name = split_name[1:] |
| 44 | return '/'.join(split_name) |
Craig Tiller | eb327fb | 2015-06-23 16:51:38 -0700 | [diff] [blame] | 45 | |
| 46 | def grpc_files(libs): |
| 47 | out = [] |
| 48 | for lib in libs: |
| 49 | if lib.name in ("grpc", "gpr"): |
| 50 | out.extend(fix_header_name(h) for h in lib.get('headers', [])) |
| 51 | out.extend(fix_header_name(h) for h in lib.get('public_headers', [])) |
| 52 | out.extend(lib.get('src', [])) |
| 53 | return out; |
| 54 | |
| 55 | def grpc_private_headers(libs): |
| 56 | out = [] |
| 57 | for lib in libs: |
| 58 | if lib.name in ("grpc", "gpr"): |
| 59 | out.extend(lib.get('headers', [])) |
| 60 | return out |
murgatroid99 | f398d5c | 2015-06-16 14:07:36 -0700 | [diff] [blame] | 61 | %> |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 62 | Pod::Spec.new do |s| |
| 63 | s.name = 'gRPC' |
| 64 | s.version = '0.6.0' |
| 65 | s.summary = 'gRPC client library for iOS/OSX' |
| 66 | s.homepage = 'http://www.grpc.io' |
| 67 | s.license = 'New BSD' |
| 68 | s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } |
| 69 | |
| 70 | # s.source = { :git => 'https://github.com/grpc/grpc.git', |
| 71 | # :tag => 'release-0_9_1-objectivec-0.5.1' } |
| 72 | |
| 73 | s.ios.deployment_target = '6.0' |
| 74 | s.osx.deployment_target = '10.8' |
| 75 | s.requires_arc = true |
| 76 | |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 77 | objc_dir = 'src/objective-c' |
| 78 | |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 79 | # Reactive Extensions library for iOS. |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 80 | s.subspec 'RxLibrary' do |ss| |
| 81 | src_dir = "#{objc_dir}/RxLibrary" |
| 82 | ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" |
| 83 | ss.private_header_files = "#{src_dir}/private/*.h" |
| 84 | ss.header_mappings_dir = "#{objc_dir}" |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 85 | end |
| 86 | |
| 87 | # Core cross-platform gRPC library, written in C. |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 88 | s.subspec 'C-Core' do |ss| |
Craig Tiller | 9f903da | 2015-06-24 08:59:27 -0700 | [diff] [blame] | 89 | ss.source_files = ${(',\n' + 22*' ').join('\'%s\'' % f for f in grpc_files(libs))} |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 90 | |
Craig Tiller | 9f903da | 2015-06-24 08:59:27 -0700 | [diff] [blame] | 91 | ss.private_header_files = ${(',\n' + 30*' ').join('\'%s\'' % f for f in grpc_private_headers(libs))} |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 92 | |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 93 | ss.header_mappings_dir = '.' |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 94 | |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 95 | ss.requires_arc = false |
| 96 | ss.libraries = 'z' |
| 97 | ss.dependency 'OpenSSL', '~> 1.0.200' |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 98 | end |
| 99 | |
| 100 | # This is a workaround for Cocoapods Issue #1437. |
| 101 | # It renames time.h and string.h to grpc_time.h and grpc_string.h. |
| 102 | # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run |
| 103 | # prepare_command's of subspecs. |
| 104 | # |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 105 | # TODO(jcanizales): Try out others' solutions at Issue #1437. |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 106 | s.prepare_command = <<-CMD |
murgatroid99 | df35577 | 2015-06-23 16:39:29 -0700 | [diff] [blame] | 107 | # Move contents of include up a level to avoid manually specifying include paths |
| 108 | cp -r "include/grpc" "." |
| 109 | |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 110 | DIR_TIME="grpc/support" |
| 111 | BAD_TIME="$DIR_TIME/time.h" |
| 112 | GOOD_TIME="$DIR_TIME/grpc_time.h" |
Jorge Canizales | 59bb9d7 | 2015-06-22 19:04:15 -0700 | [diff] [blame] | 113 | grep -rl "$BAD_TIME" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g |
Jorge Canizales | 951cd18 | 2015-07-02 20:48:50 -0700 | [diff] [blame] | 114 | if [ -f "$BAD_TIME" ]; |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 115 | then |
Jorge Canizales | 951cd18 | 2015-07-02 20:48:50 -0700 | [diff] [blame] | 116 | mv -f "$BAD_TIME" "$GOOD_TIME" |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 117 | fi |
| 118 | |
| 119 | DIR_STRING="src/core/support" |
| 120 | BAD_STRING="$DIR_STRING/string.h" |
| 121 | GOOD_STRING="$DIR_STRING/grpc_string.h" |
Jorge Canizales | 59bb9d7 | 2015-06-22 19:04:15 -0700 | [diff] [blame] | 122 | grep -rl "$BAD_STRING" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 123 | if [ -f "$BAD_STRING" ]; |
| 124 | then |
| 125 | mv -f "$BAD_STRING" "$GOOD_STRING" |
| 126 | fi |
| 127 | CMD |
| 128 | |
| 129 | # Objective-C wrapper around the core gRPC library. |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 130 | s.subspec 'GRPCClient' do |ss| |
| 131 | src_dir = "#{objc_dir}/GRPCClient" |
| 132 | ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" |
| 133 | ss.private_header_files = "#{src_dir}/private/*.h" |
| 134 | ss.header_mappings_dir = "#{objc_dir}" |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 135 | |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 136 | ss.dependency 'gRPC/C-Core' |
| 137 | ss.dependency 'gRPC/RxLibrary' |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 138 | |
| 139 | # Certificates, to be able to establish TLS connections: |
Jorge Canizales | bb54ae8 | 2015-06-28 06:50:58 -0700 | [diff] [blame] | 140 | ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 141 | end |
| 142 | |
| 143 | # RPC library for ProtocolBuffers, based on gRPC |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 144 | s.subspec 'ProtoRPC' do |ss| |
| 145 | src_dir = "#{objc_dir}/ProtoRPC" |
| 146 | ss.source_files = "#{src_dir}/*.{h,m}" |
| 147 | ss.header_mappings_dir = "#{objc_dir}" |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 148 | |
Jorge Canizales | ea9b4fd | 2015-06-21 13:37:28 -0700 | [diff] [blame] | 149 | ss.dependency 'gRPC/GRPCClient' |
| 150 | ss.dependency 'gRPC/RxLibrary' |
| 151 | ss.dependency 'Protobuf', '~> 3.0.0-alpha-3' |
Nicolas "Pixel" Noble | b4f35c0 | 2015-06-15 22:32:00 +0200 | [diff] [blame] | 152 | end |
| 153 | end |