Skip to content

Instantly share code, notes, and snippets.

@palmerc
Created October 25, 2017 14:13
Show Gist options
  • Save palmerc/c6a6d06dc15d6516a6943031508dd9a1 to your computer and use it in GitHub Desktop.
Save palmerc/c6a6d06dc15d6516a6943031508dd9a1 to your computer and use it in GitHub Desktop.
openssl compile for iOS
#!/bin/bash
ARCHS=( "arm" )
OPENSSL_OPTIONS=( "no-deprecated" "no-dtls1" "no-experimental" "no-hw" "no-ssl2" "no-ssl3" "no-camellia" "no-cast" "no-comp" "no-dso" "no-engine" "no-idea" "no-jpake" "no-krb5" "no-md2" "no-md4" "no-mdc2" "no-rc2" "no-rc5" "no-ripemd" "no-seed" "no-srp" "no-store" "no-whirlpool" )
MIN_IOS_VERSION=8.0
for ARCH in "${ARCHS[@]}"; do
SDK=""
CONFIGURE_SWITCH=""
if [ "${ARCH}" == "arm" ]; then
SDK="iphoneos"
CONFIGURE_SWITCH="iphoneos-cross"
elif [ "${ARCH}" == "x86" ]; then
SDK="iphonesimulator"
CONFIGURE_SWITCH="darwin-i386-cc"
elif [ "${ARCH}" == "x86_64" ]; then
SDK="iphonesimulator"
CONFIGURE_SWITCH="darwin64-x86_64-cc"
fi
SDK_VERSION=$( xcrun --sdk "${SDK}" --show-sdk-version )
if [ "${SDK}" == "iphoneos" ]; then
SDK_LONG="iPhoneOS${SDK_VERSION}.sdk"
elif [ "${SDK}" == "iphonesimulator" ]; then
SDK_LONG="iPhoneSimulator${SDK_VERSION}.sdk"
fi
export CC
CC=$( xcrun --sdk "${SDK}" -f gcc )
export CROSS_TOP
CROSS_TOP="$(xcrun --sdk ${SDK} --show-sdk-platform-path )/Developer"
export CROSS_SDK
CROSS_SDK="${SDK_LONG}"
export CFLAGS
CFLAGS="-fembed-bitcode -isysroot $( xcrun --sdk ${SDK} --show-sdk-path ) -mios-version-min=${MIN_IOS_VERSION}"
echo ./Configure "${CONFIGURE_SWITCH}" "${OPENSSL_OPTIONS[@]}"
exit
make clean
make depend
make -j8
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment