Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated the build.sh script for SDK 5.1

  • Loading branch information...
commit dcca9f1caaff5598da630ac7d13cf8c1a8eb6ac0 1 parent 8d2b466
@st3fan authored
Showing with 57 additions and 62 deletions.
  1. +57 −62 build.sh
View
119 build.sh
@@ -1,79 +1,74 @@
-#!/bin/sh
+#!/bin/bash
# Yay shell scripting! This script builds a static version of
-# OpenSSL 1.0.0a for iOS 4.2 that contains code for armv6, armv7 and i386.
+# OpenSSL ${OPENSSL_VERSION} for iOS 5.1 that contains code for armv6, armv7 and i386.
set -x
-OPENSSL_CONFIGURE_OPTIONS=
-
-rm -rf include lib *.log
-
-rm -rf /tmp/openssl-1.0.0a-*
-rm -rf /tmp/openssl-1.0.0a-*.log
-
-# ARMv6
-
-rm -rf openssl-1.0.0a
-tar xfz openssl-1.0.0a.tar.gz
-pushd .
-cd openssl-1.0.0a
-./configure BSD-generic32 --openssldir=/tmp/openssl-1.0.0a-armv6 $OPENSSL_CONFIGURE_OPTIONS &> /tmp/openssl-1.0.0a-armv6.log
-perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
-perl -i -pe 's|^CC= gcc|CC= /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6|g' Makefile
-perl -i -pe 's|^CFLAG= (.*)|CFLAG= -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk $1|g' Makefile
-make &> /tmp/openssl-1.0.0a-armv6.log
-make install &> /tmp/openssl-1.0.0a-armv6.log
-popd
-rm -rf openssl-1.0.0a
-
-# ARMv7
-
-rm -rf openssl-1.0.0a
-tar xfz openssl-1.0.0a.tar.gz
-pushd .
-cd openssl-1.0.0a
-./configure BSD-generic32 --openssldir=/tmp/openssl-1.0.0a-armv7 $OPENSSL_CONFIGURE_OPTIONS >> /tmp/openssl-1.0.0a-armv7.log
-perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
-perl -i -pe 's|^CC= gcc|CC= /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7|g' Makefile
-perl -i -pe 's|^CFLAG= (.*)|CFLAG= -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk $1|g' Makefile
-make &> /tmp/openssl-1.0.0a-armv7.log
-make install &> /tmp/openssl-1.0.0a-armv7.log
-popd
-rm -rf openssl-1.0.0a
-
-# i386
-
-rm -rf openssl-1.0.0a
-tar xfz openssl-1.0.0a.tar.gz
-pushd .
-cd openssl-1.0.0a
-./configure BSD-generic32 --openssldir=/tmp/openssl-1.0.0a-i386 $OPENSSL_CONFIGURE_OPTIONS >> /tmp/openssl-1.0.0a-i386.log
-perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
-perl -i -pe 's|^CC= gcc|CC= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386|g' Makefile
-perl -i -pe 's|^CFLAG= (.*)|CFLAG= -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk $1|g' Makefile
-make &> /tmp/openssl-1.0.0a-i386.log
-make install &> /tmp/openssl-1.0.0a-i386.log
-popd
-rm -rf openssl-1.0.0a
+# Setup paths to stuff we need
+
+OPENSSL_VERSION="1.0.1b"
+
+DEVELOPER="/Applications/Xcode.app/Contents/Developer"
+
+SDK_VERSION="5.1"
+
+IPHONEOS_PLATFORM="${DEVELOPER}/Platforms/iPhoneOS.platform"
+IPHONEOS_SDK="${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk"
+IPHONEOS_GCC="${IPHONEOS_PLATFORM}/Developer/usr/bin/gcc"
+
+IPHONESIMULATOR_PLATFORM="${DEVELOPER}/Platforms/iPhoneSimulator.platform"
+IPHONESIMULATOR_SDK="${IPHONESIMULATOR_PLATFORM}/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk"
+IPHONESIMULATOR_GCC="${IPHONESIMULATOR_PLATFORM}/Developer/usr/bin/gcc"
+
+# Clean up whatever was left from our previous build
+
+rm -rf include lib
+rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
+rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.log"
+
+# Build for ARMv6
+
+build()
+{
+ ARCH=$1
+ GCC=$2
+ SDK=$3
+ rm -rf "openssl-${OPENSSL_VERSION}"
+ tar xfz "openssl-${OPENSSL_VERSION}.tar.gz"
+ pushd .
+ cd "openssl-${OPENSSL_VERSION}"
+ ./Configure BSD-generic32 --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
+ perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
+ perl -i -pe "s|^CC= gcc|CC= ${GCC} -arch ${ARCH}|g" Makefile
+ perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDK} \$1|g" Makefile
+ make &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
+ make install &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
+ popd
+ rm -rf "openssl-${OPENSSL_VERSION}"
+}
+
+build "armv6" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}"
+build "armv7" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}"
+build "i386" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}"
#
mkdir include
-cp -r /tmp/openssl-1.0.0a-i386/include/openssl include/
+cp -r /tmp/openssl-${OPENSSL_VERSION}-i386/include/openssl include/
mkdir lib
lipo \
- /tmp/openssl-1.0.0a-armv6/lib/libcrypto.a \
- /tmp/openssl-1.0.0a-armv7/lib/libcrypto.a \
- /tmp/openssl-1.0.0a-i386/lib/libcrypto.a \
+ "/tmp/openssl-${OPENSSL_VERSION}-armv6/lib/libcrypto.a" \
+ "/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libcrypto.a" \
+ "/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libcrypto.a" \
-create -output lib/libcrypto.a
lipo \
- /tmp/openssl-1.0.0a-armv6/lib/libssl.a \
- /tmp/openssl-1.0.0a-armv7/lib/libssl.a \
- /tmp/openssl-1.0.0a-i386/lib/libssl.a \
+ "/tmp/openssl-${OPENSSL_VERSION}-armv6/lib/libssl.a" \
+ "/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libssl.a" \
+ "/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libssl.a" \
-create -output lib/libssl.a
-#rm -rf /tmp/openssl-1.0.0a-*
-#rm -rf /tmp/openssl-1.0.0a-*.log
+rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
+rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.log"
Please sign in to comment.
Something went wrong with that request. Please try again.