|
| 1 | +Pod::Spec.new do |s| |
| 2 | + # These parts of the spec are filled in by the template generator. |
| 3 | + openssl_version = "%%OPENSSL_VERSION%%" |
| 4 | + min_target_ios = "%%MIN_IOS_SDK%%" |
| 5 | + min_target_osx = "%%MIN_OSX_SDK%%" |
| 6 | + |
| 7 | + github_repo = "%%GITHUB_REPO%%" |
| 8 | + iPhone_archive_name = "%%IPHONE_ARCHIVE_NAME%%" |
| 9 | + iPhone_archive_hash = "%%IPHONE_ARCHIVE_HASH%%" |
| 10 | + macOSX_archive_name = "%%MACOSX_ARCHIVE_NAME%%" |
| 11 | + macOSX_archive_hash = "%%MACOSX_ARCHIVE_HASH%%" |
| 12 | + |
| 13 | + # Project metadata |
| 14 | + s.name = "CLOpenSSL" |
| 15 | + s.version = "#{openssl_version}" |
| 16 | + s.summary = "Pre-built OpenSSL framework for iOS and macOS: full-featured toolkit for the TLS and SSL protocols as well as a general-purpose cryptography library." |
| 17 | + s.homepage = "https://www.openssl.org/" |
| 18 | + s.authors = [ |
| 19 | + "Andy Polyakov", |
| 20 | + "Ben Laurie", |
| 21 | + "Ben Kaduk", |
| 22 | + "Bernd Edlinger", |
| 23 | + "Bodo Möller", |
| 24 | + "David Benjamin", |
| 25 | + "Emilia Käsper", |
| 26 | + "Eric Young", |
| 27 | + "Geoff Thorpe", |
| 28 | + "Holger Reif", |
| 29 | + "Kurt Roeckx", |
| 30 | + "Lutz Jänicke", |
| 31 | + "Mark J. Cox", |
| 32 | + "Matt Caswell", |
| 33 | + "Matthias St. Pierre", |
| 34 | + "Nils Larsch", |
| 35 | + "Paul Dale", |
| 36 | + "Paul C. Sutton", |
| 37 | + "Ralf S. Engelschall", |
| 38 | + "Rich Salz", |
| 39 | + "Richard Levitte", |
| 40 | + "Stephen Henson", |
| 41 | + "Steve Marquess", |
| 42 | + "Tim Hudson", |
| 43 | + "Ulf Möller", |
| 44 | + "Viktor Dukhovni", |
| 45 | + ] |
| 46 | + |
| 47 | + # Source code location. Actually, this is the script that builds OpenSSL |
| 48 | + # after downloading its source tarball from the official site. |
| 49 | + s.source = { :git => "#{github_repo}.git", :tag => "v#{openssl_version}" } |
| 50 | + s.license = { |
| 51 | + :type => "OpenSSL/SSLeay", |
| 52 | + :text => <<~EOF |
| 53 | + |
| 54 | + LICENSE ISSUES |
| 55 | + ============== |
| 56 | + |
| 57 | + The OpenSSL toolkit stays under a double license, i.e. both the conditions of |
| 58 | + the OpenSSL License and the original SSLeay license apply to the toolkit. |
| 59 | + See below for the actual license texts. |
| 60 | + |
| 61 | + OpenSSL License |
| 62 | + --------------- |
| 63 | + |
| 64 | + /* ==================================================================== |
| 65 | + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. |
| 66 | + * |
| 67 | + * Redistribution and use in source and binary forms, with or without |
| 68 | + * modification, are permitted provided that the following conditions |
| 69 | + * are met: |
| 70 | + * |
| 71 | + * 1. Redistributions of source code must retain the above copyright |
| 72 | + * notice, this list of conditions and the following disclaimer. |
| 73 | + * |
| 74 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 75 | + * notice, this list of conditions and the following disclaimer in |
| 76 | + * the documentation and/or other materials provided with the |
| 77 | + * distribution. |
| 78 | + * |
| 79 | + * 3. All advertising materials mentioning features or use of this |
| 80 | + * software must display the following acknowledgment: |
| 81 | + * "This product includes software developed by the OpenSSL Project |
| 82 | + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" |
| 83 | + * |
| 84 | + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
| 85 | + * endorse or promote products derived from this software without |
| 86 | + * prior written permission. For written permission, please contact |
| 87 | + |
| 88 | + * |
| 89 | + * 5. Products derived from this software may not be called "OpenSSL" |
| 90 | + * nor may "OpenSSL" appear in their names without prior written |
| 91 | + * permission of the OpenSSL Project. |
| 92 | + * |
| 93 | + * 6. Redistributions of any form whatsoever must retain the following |
| 94 | + * acknowledgment: |
| 95 | + * "This product includes software developed by the OpenSSL Project |
| 96 | + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" |
| 97 | + * |
| 98 | + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
| 99 | + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 100 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 101 | + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR |
| 102 | + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 103 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 104 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 105 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 106 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 107 | + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 108 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 109 | + * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 110 | + * ==================================================================== |
| 111 | + * |
| 112 | + * This product includes cryptographic software written by Eric Young |
| 113 | + * ( [email protected]). This product includes software written by Tim |
| 114 | + |
| 115 | + * |
| 116 | + */ |
| 117 | + |
| 118 | + Original SSLeay License |
| 119 | + ----------------------- |
| 120 | + |
| 121 | + /* Copyright (C) 1995-1998 Eric Young ( [email protected]) |
| 122 | + * All rights reserved. |
| 123 | + * |
| 124 | + * This package is an SSL implementation written |
| 125 | + * by Eric Young ( [email protected]). |
| 126 | + * The implementation was written so as to conform with Netscapes SSL. |
| 127 | + * |
| 128 | + * This library is free for commercial and non-commercial use as long as |
| 129 | + * the following conditions are aheared to. The following conditions |
| 130 | + * apply to all code found in this distribution, be it the RC4, RSA, |
| 131 | + * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
| 132 | + * included with this distribution is covered by the same copyright terms |
| 133 | + * except that the holder is Tim Hudson ( [email protected]). |
| 134 | + * |
| 135 | + * Copyright remains Eric Young's, and as such any Copyright notices in |
| 136 | + * the code are not to be removed. |
| 137 | + * If this package is used in a product, Eric Young should be given attribution |
| 138 | + * as the author of the parts of the library used. |
| 139 | + * This can be in the form of a textual message at program startup or |
| 140 | + * in documentation (online or textual) provided with the package. |
| 141 | + * |
| 142 | + * Redistribution and use in source and binary forms, with or without |
| 143 | + * modification, are permitted provided that the following conditions |
| 144 | + * are met: |
| 145 | + * 1. Redistributions of source code must retain the copyright |
| 146 | + * notice, this list of conditions and the following disclaimer. |
| 147 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 148 | + * notice, this list of conditions and the following disclaimer in the |
| 149 | + * documentation and/or other materials provided with the distribution. |
| 150 | + * 3. All advertising materials mentioning features or use of this software |
| 151 | + * must display the following acknowledgement: |
| 152 | + * "This product includes cryptographic software written by |
| 153 | + |
| 154 | + * The word 'cryptographic' can be left out if the rouines from the library |
| 155 | + * being used are not cryptographic related :-). |
| 156 | + * 4. If you include any Windows specific code (or a derivative thereof) from |
| 157 | + * the apps directory (application code) you must include an acknowledgement: |
| 158 | + * "This product includes software written by Tim Hudson ( [email protected])" |
| 159 | + * |
| 160 | + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 161 | + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 162 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 163 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 164 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 165 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 166 | + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 167 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 168 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 169 | + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 170 | + * SUCH DAMAGE. |
| 171 | + * |
| 172 | + * The licence and distribution terms for any publically available version or |
| 173 | + * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 174 | + * copied and put under another distribution licence |
| 175 | + * [including the GNU Public Licence.] |
| 176 | + */ |
| 177 | +EOF |
| 178 | + } |
| 179 | + |
| 180 | + # This is where all the action happens. Since OpenSSL is so huge and building it |
| 181 | + # properly is so painful to setup, "pod install" will download prebuilt binaries |
| 182 | + # that we publish elsewhere (not in the git repo with the build script code). |
| 183 | + s.prepare_command = <<-EOF |
| 184 | + ( |
| 185 | + echo "#{iPhone_archive_name} #{iPhone_archive_hash}" |
| 186 | + echo "#{macOSX_archive_name} #{macOSX_archive_hash}" |
| 187 | + ) | while read name hash |
| 188 | + do |
| 189 | + echo "Downloading $name..." |
| 190 | + curl --location --output "$name" \ |
| 191 | + "#{github_repo}/releases/download/v#{openssl_version}/$name" |
| 192 | + echo "Verifying $name..." |
| 193 | + if [[ "$(shasum -a 256 "$name" | awk '{print $1}')" != "$hash" ]] |
| 194 | + then |
| 195 | + echo "Checksum mismatch for $name" |
| 196 | + exit 1 |
| 197 | + fi |
| 198 | + echo "Unpacking $name..." |
| 199 | + unzip "$name" |
| 200 | + rm "$name" |
| 201 | + mkdir -p "$name" |
| 202 | + mv openssl.framework "$name" |
| 203 | + done |
| 204 | + EOF |
| 205 | + |
| 206 | + # Set the minimum platform versions. We just know the right ones from the |
| 207 | + # prebuilt frameworks we download. |
| 208 | + s.ios.deployment_target = min_target_ios |
| 209 | + s.osx.deployment_target = min_target_osx |
| 210 | + |
| 211 | + # These are prebuilt frameworks that will be vendored into the final app. |
| 212 | + s.ios.vendored_frameworks = "#{iPhone_archive_name}/openssl.framework" |
| 213 | + s.osx.vendored_frameworks = "#{macOSX_archive_name}/openssl.framework" |
| 214 | +end |
0 commit comments