SwiftGit2/script/update_libssl_ios
Matt Rubin 30c6452d99 Update scripts from Objective-Git, including commits:
commit fbc6bb0c42c3f35725fbe98db4e537e22c9a3aed
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Apr 11 09:40:00 2016 -0600

    Add clean_externals script

commit f250c3dd8330732d27b49af93a7defae6df0629e
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Apr 4 22:32:04 2016 -0600

    Enable pipefail

commit 7813f12c75381d87d5ab345c591d00f7184ab150
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Apr 4 22:19:42 2016 -0600

    Configure cibuild to echo commands and fail on first error

commit 6f802a4b82c634f115b7f941d697ccee3f557a8b
Author: Ben Chatelain <ben@octop.ad>
Date:   Sun Apr 3 13:01:45 2016 -0600

    Overhaul cibuild

    - Replaced xctool with xcodebuild + xcpretty
    - Removed unused cruft and awk scripts

commit 5978a65d53def353ab34d63f02553d7ff7622d1f
Merge: 41d4e28 de7f644
Author: Ben Chatelain <ben@octop.ad>
Date:   Sun Feb 28 21:06:56 2016 -0700

    Merge pull request #554 from libgit2/piet/travis-matrix

    Add matrix build for iOS and Mac

commit 1e3f6c5bdf38c1da26c7cc2b5bd4f6b3098bca2e
Author: Piet Brauer <piet@nerdishbynature.com>
Date:   Wed Feb 24 17:40:52 2016 +0800

    Add matrix build for iOS and Mac

commit 9c13681d06decdb8de327633dc80d9b742a54423
Author: Piet Brauer <piet@nerdishbynature.com>
Date:   Wed Feb 24 16:23:11 2016 +0800

    Enable Bitcode
2016-12-09 13:26:57 -08:00

76 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# source the common build functions
SCRIPT_DIR=$(dirname "$0")
source "${SCRIPT_DIR}/ios_build_functions.sh"
function setup ()
{
if [ -f "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" ] && [ -f "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" ] && [ -d "${ROOT_PATH}/External/ios-openssl/include" ]
then
echo "No update needed."
exit 0
fi
LIBRARY_NAME="OpenSSL"
rm -rf "${ROOT_PATH}/External/ios-openssl/include" "External/ios-openssl/lib"
}
function cleanup ()
{
rm -rf "/tmp/openssl"
rm -rf "/tmp/openssl-*.log"
}
function build_ssl ()
{
rm -rf "/tmp/openssl"
cp -r "${ROOT_PATH}/External/openssl" "/tmp/"
pushd "/tmp/openssl" > /dev/null
LOG="/tmp/openssl-${ARCH}.log"
if [ "${ARCH}" == "arm64" ] || [ "${ARCH}" == "x86_64" ]
then
HOST="BSD-generic64"
CONFIG="no-gost no-asm enable-ec_nistp_64_gcc_128"
else
HOST="BSD-generic32"
CONFIG="no-gost no-asm"
perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
fi
echo "$LOG"
./Configure ${HOST} ${CONFIG} --openssldir="/tmp/openssl-${ARCH}" >> "${LOG}" 2>&1
perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> "${LOG}" 2>&1
perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$1|g" Makefile >> "${LOG}" 2>&1
make >> "${LOG}" 2>&1
make install_sw >> "${LOG}" 2>&1
popd > /dev/null
rm -rf "/tmp/openssl"
BUILT_CRYPTO_PATHS+=("/tmp/openssl-${ARCH}/lib/libcrypto.a")
BUILT_SSL_PATHS+=("/tmp/openssl-${ARCH}/lib/libssl.a")
}
function fat_binary ()
{
echo "Building fat binary..."
mkdir -p "${ROOT_PATH}/External/ios-openssl/include"
cp -r /tmp/openssl-i386/include/openssl "${ROOT_PATH}/External/ios-openssl/include/"
mkdir -p "${ROOT_PATH}/External/ios-openssl/lib"
lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a"
lipo -create "${BUILT_SSL_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libssl.a"
echo "Building done."
}
cleanup
build_all_archs setup build_ssl fat_binary
cleanup