|
| 1 | +Pod::Spec.new do |s| |
| 2 | + s.name = "OpenSSL" |
| 3 | + s.version = "1.0.210" |
| 4 | + s.summary = "OpenSSL is an SSL/TLS and Crypto toolkit. Deprecated in Mac OS and gone in iOS, this spec gives your project non-deprecated OpenSSL support." |
| 5 | + s.author = "OpenSSL Project <[email protected]>" |
| 6 | + |
| 7 | + s.homepage = "https://github.com/FredericJacobs/OpenSSL-Pod" |
| 8 | + s.source = { :http => "https://openssl.org/source/openssl-1.0.2l.tar.gz", :sha1 => "b58d5d0e9cea20e571d903aafa853e2ccd914138"} |
| 9 | + s.source_files = "opensslIncludes/openssl/*.h" |
| 10 | + s.header_dir = "openssl" |
| 11 | + s.license = { :type => 'OpenSSL (OpenSSL/SSLeay)', :file => 'LICENSE' } |
| 12 | + |
| 13 | + s.prepare_command = <<-CMD |
| 14 | + VERSION="1.0.2l" |
| 15 | + SDKVERSION=`xcrun --sdk iphoneos --show-sdk-version 2> /dev/null` |
| 16 | + MIN_SDK_VERSION_FLAG="-miphoneos-version-min=7.0" |
| 17 | +
|
| 18 | + BASEPATH="${PWD}" |
| 19 | + CURRENTPATH="/tmp/openssl" |
| 20 | + ARCHS="i386 x86_64 armv7 armv7s arm64" |
| 21 | + DEVELOPER=`xcode-select -print-path` |
| 22 | +
|
| 23 | + mkdir -p "${CURRENTPATH}" |
| 24 | + mkdir -p "${CURRENTPATH}/bin" |
| 25 | +
|
| 26 | + cp "file.tgz" "${CURRENTPATH}/file.tgz" |
| 27 | + cd "${CURRENTPATH}" |
| 28 | + tar -xzf file.tgz |
| 29 | + cd "openssl-${VERSION}" |
| 30 | +
|
| 31 | + for ARCH in ${ARCHS} |
| 32 | + do |
| 33 | + CONFIGURE_FOR="iphoneos-cross" |
| 34 | +
|
| 35 | + if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] ; |
| 36 | + then |
| 37 | + PLATFORM="iPhoneSimulator" |
| 38 | + if [ "${ARCH}" == "x86_64" ] ; |
| 39 | + then |
| 40 | + CONFIGURE_FOR="darwin64-x86_64-cc" |
| 41 | + fi |
| 42 | + else |
| 43 | + sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" |
| 44 | + PLATFORM="iPhoneOS" |
| 45 | + fi |
| 46 | +
|
| 47 | + export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" |
| 48 | + export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" |
| 49 | +
|
| 50 | + echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" |
| 51 | + echo "Please stand by..." |
| 52 | +
|
| 53 | + export CC="${DEVELOPER}/usr/bin/gcc -arch ${ARCH} ${MIN_SDK_VERSION_FLAG}" |
| 54 | + mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" |
| 55 | + LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" |
| 56 | +
|
| 57 | + LIPO_LIBSSL="${LIPO_LIBSSL} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libssl.a" |
| 58 | + LIPO_LIBCRYPTO="${LIPO_LIBCRYPTO} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libcrypto.a" |
| 59 | +
|
| 60 | + ./Configure ${CONFIGURE_FOR} --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 |
| 61 | + sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile" |
| 62 | +
|
| 63 | + make >> "${LOG}" 2>&1 |
| 64 | + make all install_sw >> "${LOG}" 2>&1 |
| 65 | + make clean >> "${LOG}" 2>&1 |
| 66 | + done |
| 67 | +
|
| 68 | +
|
| 69 | + echo "Build library..." |
| 70 | + rm -rf "${BASEPATH}/lib/" |
| 71 | + mkdir -p "${BASEPATH}/lib/" |
| 72 | + lipo -create ${LIPO_LIBSSL} -output "${BASEPATH}/lib/libssl.a" |
| 73 | + lipo -create ${LIPO_LIBCRYPTO} -output "${BASEPATH}/lib/libcrypto.a" |
| 74 | +
|
| 75 | + echo "Copying headers..." |
| 76 | + rm -rf "${BASEPATH}/opensslIncludes/" |
| 77 | + mkdir -p "${BASEPATH}/opensslIncludes/" |
| 78 | + cp -RL "${CURRENTPATH}/openssl-${VERSION}/include/openssl" "${BASEPATH}/opensslIncludes/" |
| 79 | +
|
| 80 | + cd "${BASEPATH}" |
| 81 | + echo "Building done." |
| 82 | +
|
| 83 | + echo "Cleaning up..." |
| 84 | + rm -rf "${CURRENTPATH}" |
| 85 | + echo "Done." |
| 86 | + CMD |
| 87 | + |
| 88 | + s.ios.deployment_target = "8.0" |
| 89 | + s.ios.public_header_files = "opensslIncludes/openssl/*.h" |
| 90 | + s.ios.vendored_libraries = "lib/libcrypto.a", "lib/libssl.a" |
| 91 | + |
| 92 | + s.libraries = 'crypto', 'ssl' |
| 93 | + s.requires_arc = false |
| 94 | + |
| 95 | +end |
0 commit comments