gRPC.podspec.template 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Pod::Spec.new do |s|
  2. s.name = 'gRPC'
  3. s.version = '0.6.0'
  4. s.summary = 'gRPC client library for iOS/OSX'
  5. s.homepage = 'http://www.grpc.io'
  6. s.license = 'New BSD'
  7. s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' }
  8. # s.source = { :git => 'https://github.com/grpc/grpc.git',
  9. # :tag => 'release-0_9_1-objectivec-0.5.1' }
  10. s.ios.deployment_target = '6.0'
  11. s.osx.deployment_target = '10.8'
  12. s.requires_arc = true
  13. # Reactive Extensions library for iOS.
  14. s.subspec 'RxLibrary' do |rs|
  15. rs.source_files = 'src/objective-c/RxLibrary/*.{h,m}',
  16. 'src/objective-c/RxLibrary/transformations/*.{h,m}',
  17. 'src/objective-c/RxLibrary/private/*.{h,m}'
  18. rs.private_header_files = 'src/objective-c/RxLibrary/private/*.h'
  19. end
  20. # Core cross-platform gRPC library, written in C.
  21. s.subspec 'C-Core' do |cs|
  22. cs.source_files = \
  23. % for lib in libs:
  24. % if lib.build in ("all"):
  25. % for hdr in lib.get("headers", []):
  26. '${hdr}', \
  27. % endfor
  28. % for hdr in lib.get("public_headers", []):
  29. '${hdr}', \
  30. % endfor
  31. % for src in lib.src:
  32. '${src}', \
  33. % endfor
  34. % endif
  35. % endfor
  36. cs.private_header_files = \
  37. % for lib in libs:
  38. % if lib.build in ("all"):
  39. % for hdr in lib.get("headers", []):
  40. '${hdr}', \
  41. % endfor
  42. % endif
  43. % endfor
  44. cs.header_mappings_dir = '.'
  45. # The core library includes its headers as either "src/core/..." or "grpc/...", meaning we have
  46. # to tell XCode to look for headers under the "include" subdirectory too.
  47. #
  48. # TODO(jcanizales): Instead of doing this, during installation move everything under
  49. # "include/grpc" one directory up. The directory names under PODS_ROOT are implementation
  50. # details of Cocoapods, and have changed in the past, breaking this podspec.
  51. cs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Private/gRPC" ' +
  52. '"$(PODS_ROOT)/Headers/Private/gRPC/include"' }
  53. cs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w'
  54. cs.requires_arc = false
  55. cs.libraries = 'z'
  56. cs.dependency 'OpenSSL', '~> 1.0.200'
  57. end
  58. # This is a workaround for Cocoapods Issue #1437.
  59. # It renames time.h and string.h to grpc_time.h and grpc_string.h.
  60. # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run
  61. # prepare_command's of subspecs.
  62. #
  63. # TODO(jcanizales): Try out Todd Reed's solution at Issue #1437.
  64. s.prepare_command = <<-CMD
  65. DIR_TIME="grpc/support"
  66. BAD_TIME="$DIR_TIME/time.h"
  67. GOOD_TIME="$DIR_TIME/grpc_time.h"
  68. grep -rl "$BAD_TIME" include/grpc src/core | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g
  69. if [ -f "include/$BAD_TIME" ];
  70. then
  71. mv -f "include/$BAD_TIME" "include/$GOOD_TIME"
  72. fi
  73. DIR_STRING="src/core/support"
  74. BAD_STRING="$DIR_STRING/string.h"
  75. GOOD_STRING="$DIR_STRING/grpc_string.h"
  76. grep -rl "$BAD_STRING" include/grpc src/core | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g
  77. if [ -f "$BAD_STRING" ];
  78. then
  79. mv -f "$BAD_STRING" "$GOOD_STRING"
  80. fi
  81. CMD
  82. # Objective-C wrapper around the core gRPC library.
  83. s.subspec 'GRPCClient' do |gs|
  84. gs.source_files = 'src/objective-c/GRPCClient/*.{h,m}',
  85. 'src/objective-c/GRPCClient/private/*.{h,m}'
  86. gs.private_header_files = 'src/objective-c/GRPCClient/private/*.h'
  87. gs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w'
  88. gs.dependency 'gRPC/C-Core'
  89. # TODO(jcanizales): Remove this when the prepare_command moves everything under "include/grpc"
  90. # one directory up.
  91. gs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Public/gRPC/include"' }
  92. gs.dependency 'gRPC/RxLibrary'
  93. # Certificates, to be able to establish TLS connections:
  94. gs.resource_bundles = { 'gRPC' => ['etc/roots.pem'] }
  95. end
  96. # RPC library for ProtocolBuffers, based on gRPC
  97. s.subspec 'ProtoRPC' do |ps|
  98. ps.source_files = 'src/objective-c/ProtoRPC/*.{h,m}'
  99. ps.dependency 'gRPC/GRPCClient'
  100. ps.dependency 'gRPC/RxLibrary'
  101. ps.dependency 'Protobuf', '~> 3.0.0-alpha-3'
  102. end
  103. end