gRPC.podspec.template 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. %YAML 1.2
  2. --- |
  3. # GRPC CocoaPods podspec
  4. # This file has been automatically generated from a template file.
  5. # Please look at the templates directory instead.
  6. # This file can be regenerated from the template by running
  7. # tools/buildgen/generate_projects.sh
  8. # Copyright 2015, Google Inc.
  9. # All rights reserved.
  10. #
  11. # Redistribution and use in source and binary forms, with or without
  12. # modification, are permitted provided that the following conditions are
  13. # met:
  14. #
  15. # * Redistributions of source code must retain the above copyright
  16. # notice, this list of conditions and the following disclaimer.
  17. # * Redistributions in binary form must reproduce the above
  18. # copyright notice, this list of conditions and the following disclaimer
  19. # in the documentation and/or other materials provided with the
  20. # distribution.
  21. # * Neither the name of Google Inc. nor the names of its
  22. # contributors may be used to endorse or promote products derived from
  23. # this software without specific prior written permission.
  24. #
  25. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. <%!
  37. def fix_header_name(name):
  38. split_name = name.split('/')
  39. if split_name[0] == 'include':
  40. split_name = split_name[1:]
  41. return '/'.join(split_name)
  42. def grpc_files(libs):
  43. out = []
  44. for lib in libs:
  45. if lib.name in ("grpc", "gpr"):
  46. out.extend(fix_header_name(h) for h in lib.get('headers', []))
  47. out.extend(fix_header_name(h) for h in lib.get('public_headers', []))
  48. out.extend(lib.get('src', []))
  49. return out;
  50. def grpc_private_headers(libs):
  51. out = []
  52. for lib in libs:
  53. if lib.name in ("grpc", "gpr"):
  54. out.extend(lib.get('headers', []))
  55. return out
  56. %>
  57. Pod::Spec.new do |s|
  58. s.name = 'gRPC'
  59. version = '0.11.2'
  60. s.version = version
  61. s.summary = 'gRPC client library for iOS/OSX'
  62. s.homepage = 'http://www.grpc.io'
  63. s.license = 'New BSD'
  64. s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' }
  65. s.source = { :git => 'https://github.com/grpc/grpc.git',
  66. :tag => "release-#{version.gsub(/\./, '_')}-objectivec-#{version}" }
  67. s.ios.deployment_target = '7.1'
  68. s.osx.deployment_target = '10.9'
  69. s.requires_arc = true
  70. objc_dir = 'src/objective-c'
  71. # Reactive Extensions library for iOS.
  72. s.subspec 'RxLibrary' do |ss|
  73. src_dir = "#{objc_dir}/RxLibrary"
  74. ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
  75. ss.private_header_files = "#{src_dir}/private/*.h"
  76. ss.header_mappings_dir = "#{objc_dir}"
  77. end
  78. # Core cross-platform gRPC library, written in C.
  79. s.subspec 'C-Core' do |ss|
  80. ss.source_files = ${(',\n' + 22*' ').join('\'%s\'' % f for f in grpc_files(libs))}
  81. ss.private_header_files = ${(',\n' + 30*' ').join('\'%s\'' % f for f in grpc_private_headers(libs))}
  82. ss.header_mappings_dir = '.'
  83. ss.requires_arc = false
  84. ss.libraries = 'z'
  85. ss.dependency 'OpenSSL', '~> 1.0.200'
  86. # ss.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w'
  87. end
  88. # Move contents of include/ up a level to avoid manually specifying include paths.
  89. # This needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run
  90. # prepare_command's of subspecs.
  91. s.prepare_command = 'cp -r "include/grpc" "."'
  92. # Objective-C wrapper around the core gRPC library.
  93. s.subspec 'GRPCClient' do |ss|
  94. src_dir = "#{objc_dir}/GRPCClient"
  95. ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
  96. ss.private_header_files = "#{src_dir}/private/*.h"
  97. ss.header_mappings_dir = "#{objc_dir}"
  98. ss.dependency 'gRPC/C-Core'
  99. ss.dependency 'gRPC/RxLibrary'
  100. # Certificates, to be able to establish TLS connections:
  101. ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] }
  102. end
  103. # RPC library for ProtocolBuffers, based on gRPC
  104. s.subspec 'ProtoRPC' do |ss|
  105. src_dir = "#{objc_dir}/ProtoRPC"
  106. ss.source_files = "#{src_dir}/*.{h,m}"
  107. ss.header_mappings_dir = "#{objc_dir}"
  108. ss.dependency 'gRPC/GRPCClient'
  109. ss.dependency 'gRPC/RxLibrary'
  110. ss.dependency 'Protobuf', '~> 3.0.0-alpha-4'
  111. end
  112. end