From 9f71eb48552f2fb10b733f9677d437d790e90c56 Mon Sep 17 00:00:00 2001 From: omochimetaru Date: Wed, 6 Jan 2016 12:08:17 +0900 Subject: [PATCH 1/2] fix indent replace all tabs to 2 spaces apply same indent rule (e.g. case statement) --- build-libssl.sh | 161 ++++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 81 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index 44d1bca..81a62e3 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -19,35 +19,35 @@ # limitations under the License. # ########################################################################### -# Change values here # -# -VERSION="1.0.2e" # -IOS_SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` -TVOS_SDKVERSION=`xcrun -sdk appletvos --show-sdk-version` # -CONFIG_OPTIONS="" -CURL_OPTIONS="" +# Change values here # +# # +VERSION="1.0.2e" # +IOS_SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` # +TVOS_SDKVERSION=`xcrun -sdk appletvos --show-sdk-version` # +CONFIG_OPTIONS="" # +CURL_OPTIONS="" # # To set "enable-ec_nistp_64_gcc_128" configuration for x64 archs set next variable to "true" -ENABLE_EC_NISTP_64_GCC_128="" -# # +ENABLE_EC_NISTP_64_GCC_128="" # +# # ########################################################################### -# # -# Don't change anything under this line! # -# # +# # +# Don't change anything under this line! # +# # ########################################################################### spinner() { - local pid=$! - local delay=0.75 - local spinstr='|/-\' - while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do - local temp=${spinstr#?} - printf " [%c] " "$spinstr" - local spinstr=$temp${spinstr%"$temp"} - sleep $delay - printf "\b\b\b\b\b\b" - done - printf " \b\b\b\b" + local pid=$! + local delay=0.75 + local spinstr='|/-\' + while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do + local temp=${spinstr#?} + printf " [%c] " "$spinstr" + local spinstr=$temp${spinstr%"$temp"} + sleep $delay + printf "\b\b\b\b\b\b" + done + printf " \b\b\b\b" } CURRENTPATH=`pwd` @@ -66,25 +66,25 @@ if [ ! -d "$DEVELOPER" ]; then fi case $DEVELOPER in - *\ * ) - echo "Your Xcode path contains whitespaces, which is not supported." - exit 1 - ;; + *\ * ) + echo "Your Xcode path contains whitespaces, which is not supported." + exit 1 + ;; esac case $CURRENTPATH in - *\ * ) - echo "Your path contains whitespaces, which is not supported by 'make install'." - exit 1 - ;; + *\ * ) + echo "Your path contains whitespaces, which is not supported by 'make install'." + exit 1 + ;; esac set -e if [ ! -e openssl-${VERSION}.tar.gz ]; then - echo "Downloading openssl-${VERSION}.tar.gz" - curl ${CURL_OPTIONS} -O https://www.openssl.org/source/openssl-${VERSION}.tar.gz + echo "Downloading openssl-${VERSION}.tar.gz" + curl ${CURL_OPTIONS} -O https://www.openssl.org/source/openssl-${VERSION}.tar.gz else - echo "Using openssl-${VERSION}.tar.gz" + echo "Using openssl-${VERSION}.tar.gz" fi mkdir -p "${CURRENTPATH}/src" @@ -94,7 +94,6 @@ mkdir -p "${CURRENTPATH}/lib" tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src" cd "${CURRENTPATH}/src/openssl-${VERSION}" - for ARCH in ${ARCHS} do if [[ "$ARCH" == tv* ]]; then @@ -108,8 +107,8 @@ do MIN_SDK_VERSION=$IOS_MIN_SDK_VERSION fi - if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then - PLATFORM="iPhoneSimulator" + if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then + PLATFORM="iPhoneSimulator" elif [ "${ARCH}" == "tv_x86_64" ]; then ARCH="x86_64" PLATFORM="AppleTVSimulator" @@ -117,51 +116,51 @@ do ARCH="arm64" sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="AppleTVOS" - else - sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" + else + sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="iPhoneOS" - fi + fi export $PLATFORM - export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" - export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" - export BUILD_TOOLS="${DEVELOPER}" + export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" + export BUILD_TOOLS="${DEVELOPER}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" - echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" + echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo " Logfile: $LOG" - LOCAL_CONFIG_OPTIONS="${CONFIG_OPTIONS}" - if [ "${ENABLE_EC_NISTP_64_GCC_128}" == "true" ]; then - case "$ARCH" in - *64*) - LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} enable-ec_nistp_64_gcc_128" - ;; - esac - fi + LOCAL_CONFIG_OPTIONS="${CONFIG_OPTIONS}" + if [ "${ENABLE_EC_NISTP_64_GCC_128}" == "true" ]; then + case "$ARCH" in + *64*) + LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} enable-ec_nistp_64_gcc_128" + ;; + esac + fi - if [[ $SDKVERSION == 9.* ]]; then - export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH} -fembed-bitcode" - else - export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}" - fi + if [[ $SDKVERSION == 9.* ]]; then + export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH} -fembed-bitcode" + else + export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}" + fi echo " Configure...\c" - set +e + set +e if [ "$1" == "verbose" ]; then if [ "${ARCH}" == "x86_64" ]; then - ./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} - else - ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} - fi + ./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} + else + ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} + fi else - if [ "${ARCH}" == "x86_64" ]; then - (./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner - else - (./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner - fi + if [ "${ARCH}" == "x86_64" ]; then + (./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner + else + (./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner + fi fi if [ $? != 0 ]; then @@ -179,20 +178,20 @@ do echo " Make...\c" - if [ "$1" == "verbose" ]; then - if [[ ! -z $CONFIG_OPTIONS ]]; then - make depend - fi - make - else - if [[ ! -z $CONFIG_OPTIONS ]]; then - make depend >> "${LOG}" 2>&1 - fi - (make >> "${LOG}" 2>&1) & spinner - fi + if [ "$1" == "verbose" ]; then + if [[ ! -z $CONFIG_OPTIONS ]]; then + make depend + fi + make + else + if [[ ! -z $CONFIG_OPTIONS ]]; then + make depend >> "${LOG}" 2>&1 + fi + (make >> "${LOG}" 2>&1) & spinner + fi echo "\n" - if [ $? != 0 ]; then + if [ $? != 0 ]; then echo "Problem while make - Please check ${LOG}" exit 1 fi @@ -202,8 +201,8 @@ do make install_sw make clean else - make install_sw >> "${LOG}" 2>&1 - make clean >> "${LOG}" 2>&1 + make install_sw >> "${LOG}" 2>&1 + make clean >> "${LOG}" 2>&1 fi done From e265fb2b9110089fd21557d009f8cb1adaeed9e8 Mon Sep 17 00:00:00 2001 From: omochimetaru Date: Wed, 6 Jan 2016 12:29:06 +0900 Subject: [PATCH 2/2] wrap too long lines --- build-libssl.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index 81a62e3..706d99e 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -207,12 +207,30 @@ do done echo "Build library for iOS..." -lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-i386.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7s.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-arm64.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl.a -lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-i386.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7s.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-arm64.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto.a +lipo -create \ + ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-i386.sdk/lib/libssl.a \ + ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/lib/libssl.a \ + ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7.sdk/lib/libssl.a \ + ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7s.sdk/lib/libssl.a \ + ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-arm64.sdk/lib/libssl.a \ + -output ${CURRENTPATH}/lib/libssl.a +lipo -create \ + ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-i386.sdk/lib/libcrypto.a \ + ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/lib/libcrypto.a \ + ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7.sdk/lib/libcrypto.a \ + ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7s.sdk/lib/libcrypto.a \ + ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-arm64.sdk/lib/libcrypto.a \ + -output ${CURRENTPATH}/lib/libcrypto.a echo "Build library for tvOS..." -lipo -create ${CURRENTPATH}/bin/AppleTVSimulator${TVOS_SDKVERSION}-x86_64.sdk/lib/libssl.a ${CURRENTPATH}/bin/AppleTVOS${TVOS_SDKVERSION}-arm64.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl-tvOS.a -lipo -create ${CURRENTPATH}/bin/AppleTVSimulator${TVOS_SDKVERSION}-x86_64.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/AppleTVOS${TVOS_SDKVERSION}-arm64.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto-tvOS.a +lipo -create \ + ${CURRENTPATH}/bin/AppleTVSimulator${TVOS_SDKVERSION}-x86_64.sdk/lib/libssl.a \ + ${CURRENTPATH}/bin/AppleTVOS${TVOS_SDKVERSION}-arm64.sdk/lib/libssl.a \ + -output ${CURRENTPATH}/lib/libssl-tvOS.a +lipo -create \ + ${CURRENTPATH}/bin/AppleTVSimulator${TVOS_SDKVERSION}-x86_64.sdk/lib/libcrypto.a \ + ${CURRENTPATH}/bin/AppleTVOS${TVOS_SDKVERSION}-arm64.sdk/lib/libcrypto.a \ + -output ${CURRENTPATH}/lib/libcrypto-tvOS.a mkdir -p ${CURRENTPATH}/include cp -R ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/include/openssl ${CURRENTPATH}/include/