xref: /aosp_15_r20/external/grpc-grpc/templates/src/objective-c/!ProtoCompiler.podspec.template (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1%YAML 1.2
2--- |
3  # Proto Compiler CocoaPods podspec
4
5  # Copyright 2016, Google Inc.
6  # All rights reserved.
7  #
8  # Redistribution and use in source and binary forms, with or without
9  # modification, are permitted provided that the following conditions are
10  # met:
11  #
12  #     * Redistributions of source code must retain the above copyright
13  # notice, this list of conditions and the following disclaimer.
14  #     * Redistributions in binary form must reproduce the above
15  # copyright notice, this list of conditions and the following disclaimer
16  # in the documentation and/or other materials provided with the
17  # distribution.
18  #     * Neither the name of Google Inc. nor the names of its
19  # contributors may be used to endorse or promote products derived from
20  # this software without specific prior written permission.
21  #
22  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34  Pod::Spec.new do |s|
35    # This pod is only a utility that will be used by other pods _at install time_ (not at compile
36    # time). Other pods can access it in their `prepare_command` script, under <pods_root>/<pod name>.
37    # Because CocoaPods installs pods in alphabetical order, beginning this pod's name with an
38    # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
39    # before them.
40    s.name     = '!ProtoCompiler'
41    v = '${settings.protobuf_version}'
42    s.version  = v
43    s.summary  = 'The Protobuf Compiler (protoc) generates Objective-C files from .proto files'
44    s.description = <<-DESC
45      This podspec only downloads protoc so that local pods generating protos can execute it as part
46      of their prepare_command.
47      The generated code will have a dependency on the Protobuf Objective-C runtime of the same
48      version. The runtime can be obtained as the "Protobuf" pod.
49    DESC
50    s.homepage = 'https://github.com/protocolbuffers/protobuf'
51    s.license  = {
52      :type => 'New BSD',
53      :text => <<-LICENSE
54        This license applies to all parts of Protocol Buffers except the following:
55
56        - Atomicops support for generic gcc, located in
57          src/google/protobuf/stubs/atomicops_internals_generic_gcc.h.
58          This file is copyrighted by Red Hat Inc.
59
60        - Atomicops support for AIX/POWER, located in
61          src/google/protobuf/stubs/atomicops_internals_power.h.
62          This file is copyrighted by Bloomberg Finance LP.
63
64        Copyright 2014, Google Inc.  All rights reserved.
65
66        Redistribution and use in source and binary forms, with or without
67        modification, are permitted provided that the following conditions are
68        met:
69
70            * Redistributions of source code must retain the above copyright
71        notice, this list of conditions and the following disclaimer.
72            * Redistributions in binary form must reproduce the above
73        copyright notice, this list of conditions and the following disclaimer
74        in the documentation and/or other materials provided with the
75        distribution.
76            * Neither the name of Google Inc. nor the names of its
77        contributors may be used to endorse or promote products derived from
78        this software without specific prior written permission.
79
80        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
81        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
82        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
83        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
84        OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
85        SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
86        LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
87        DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
88        THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
89        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
90        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
91
92        Code generated by the Protocol Buffer compiler is owned by the owner
93        of the input file used when generating it.  This code is not
94        standalone and requires a support library to be linked with it.  This
95        support library is itself covered by the above license.
96      LICENSE
97    }
98    # "The name and email addresses of the library maintainers, not the Podspec maintainer."
99    s.authors  = { 'The Protocol Buffers contributors' => '[email protected]' }
100
101    repo = 'google/protobuf'
102    file = "protoc-#{v}-osx-x86_64.zip"
103    s.source = {
104      :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}",
105      # TODO(jcanizales): Add sha1 or sha256
106      # :sha1 => '??',
107    }
108
109    s.preserve_paths = 'protoc',
110                       'google/**/*.proto' # Well-known protobuf types
111
112    # Restrict the protobuf runtime version to the one supported by this version of protoc.
113    s.dependency 'Protobuf', '~> 3.0'
114    # For the Protobuf dependency not to complain:
115    s.ios.deployment_target = '10.0'
116    s.osx.deployment_target = '10.12'
117    s.tvos.deployment_target = '12.0'
118    s.watchos.deployment_target = '6.0'
119
120    # This is only for local development of protoc: If the Podfile brings this pod from a local
121    # directory using `:path`, CocoaPods won't download the zip file and so the compiler won't be
122    # present in this pod's directory. We use that knowledge to check for the existence of the file
123    # and, if absent, build it from the local sources.
124    repo_root = '../..'
125    bazel = "#{repo_root}/tools/bazel"
126
127    s.prepare_command = <<-CMD
128      set -e
129      if [ ! -f bin/protoc ]; then
130        #{bazel} build @com_google_protobuf//:protoc
131      else
132        mv bin/protoc .
133        mv include/google .
134      fi
135    CMD
136  end
137