Merge pull request #82 from omochi/fix/code-appearance

[01] Fix/code appearance
This commit is contained in:
Felix Schulze 2016-01-11 10:02:24 +01:00
commit 2d4370f0f0
1 changed files with 102 additions and 85 deletions

View File

@ -19,35 +19,35 @@
# limitations under the License. # limitations under the License.
# #
########################################################################### ###########################################################################
# Change values here # # Change values here #
# # #
VERSION="1.0.2e" # VERSION="1.0.2e" #
IOS_SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` IOS_SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` #
TVOS_SDKVERSION=`xcrun -sdk appletvos --show-sdk-version` # TVOS_SDKVERSION=`xcrun -sdk appletvos --show-sdk-version` #
CONFIG_OPTIONS="" CONFIG_OPTIONS="" #
CURL_OPTIONS="" CURL_OPTIONS="" #
# To set "enable-ec_nistp_64_gcc_128" configuration for x64 archs set next variable to "true" # 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() spinner()
{ {
local pid=$! local pid=$!
local delay=0.75 local delay=0.75
local spinstr='|/-\' local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?} local temp=${spinstr#?}
printf " [%c] " "$spinstr" printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"} local spinstr=$temp${spinstr%"$temp"}
sleep $delay sleep $delay
printf "\b\b\b\b\b\b" printf "\b\b\b\b\b\b"
done done
printf " \b\b\b\b" printf " \b\b\b\b"
} }
CURRENTPATH=`pwd` CURRENTPATH=`pwd`
@ -66,25 +66,25 @@ if [ ! -d "$DEVELOPER" ]; then
fi fi
case $DEVELOPER in case $DEVELOPER in
*\ * ) *\ * )
echo "Your Xcode path contains whitespaces, which is not supported." echo "Your Xcode path contains whitespaces, which is not supported."
exit 1 exit 1
;; ;;
esac esac
case $CURRENTPATH in case $CURRENTPATH in
*\ * ) *\ * )
echo "Your path contains whitespaces, which is not supported by 'make install'." echo "Your path contains whitespaces, which is not supported by 'make install'."
exit 1 exit 1
;; ;;
esac esac
set -e set -e
if [ ! -e openssl-${VERSION}.tar.gz ]; then if [ ! -e openssl-${VERSION}.tar.gz ]; then
echo "Downloading openssl-${VERSION}.tar.gz" echo "Downloading openssl-${VERSION}.tar.gz"
curl ${CURL_OPTIONS} -O https://www.openssl.org/source/openssl-${VERSION}.tar.gz curl ${CURL_OPTIONS} -O https://www.openssl.org/source/openssl-${VERSION}.tar.gz
else else
echo "Using openssl-${VERSION}.tar.gz" echo "Using openssl-${VERSION}.tar.gz"
fi fi
mkdir -p "${CURRENTPATH}/src" mkdir -p "${CURRENTPATH}/src"
@ -94,7 +94,6 @@ mkdir -p "${CURRENTPATH}/lib"
tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src" tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src"
cd "${CURRENTPATH}/src/openssl-${VERSION}" cd "${CURRENTPATH}/src/openssl-${VERSION}"
for ARCH in ${ARCHS} for ARCH in ${ARCHS}
do do
if [[ "$ARCH" == tv* ]]; then if [[ "$ARCH" == tv* ]]; then
@ -108,8 +107,8 @@ do
MIN_SDK_VERSION=$IOS_MIN_SDK_VERSION MIN_SDK_VERSION=$IOS_MIN_SDK_VERSION
fi fi
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then
PLATFORM="iPhoneSimulator" PLATFORM="iPhoneSimulator"
elif [ "${ARCH}" == "tv_x86_64" ]; then elif [ "${ARCH}" == "tv_x86_64" ]; then
ARCH="x86_64" ARCH="x86_64"
PLATFORM="AppleTVSimulator" PLATFORM="AppleTVSimulator"
@ -117,51 +116,51 @@ do
ARCH="arm64" ARCH="arm64"
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
PLATFORM="AppleTVOS" PLATFORM="AppleTVOS"
else else
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
PLATFORM="iPhoneOS" PLATFORM="iPhoneOS"
fi fi
export $PLATFORM export $PLATFORM
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}" export BUILD_TOOLS="${DEVELOPER}"
mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"
LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" 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" echo " Logfile: $LOG"
LOCAL_CONFIG_OPTIONS="${CONFIG_OPTIONS}" LOCAL_CONFIG_OPTIONS="${CONFIG_OPTIONS}"
if [ "${ENABLE_EC_NISTP_64_GCC_128}" == "true" ]; then if [ "${ENABLE_EC_NISTP_64_GCC_128}" == "true" ]; then
case "$ARCH" in case "$ARCH" in
*64*) *64*)
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} enable-ec_nistp_64_gcc_128" LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} enable-ec_nistp_64_gcc_128"
;; ;;
esac esac
fi fi
if [[ $SDKVERSION == 9.* ]]; then if [[ $SDKVERSION == 9.* ]]; then
export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH} -fembed-bitcode" export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH} -fembed-bitcode"
else else
export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}" export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}"
fi fi
echo " Configure...\c" echo " Configure...\c"
set +e set +e
if [ "$1" == "verbose" ]; then if [ "$1" == "verbose" ]; then
if [ "${ARCH}" == "x86_64" ]; then if [ "${ARCH}" == "x86_64" ]; then
./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} ./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS}
else else
./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS}
fi fi
else else
if [ "${ARCH}" == "x86_64" ]; then 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 (./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner
else else
(./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner (./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1) & spinner
fi fi
fi fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
@ -179,20 +178,20 @@ do
echo " Make...\c" echo " Make...\c"
if [ "$1" == "verbose" ]; then if [ "$1" == "verbose" ]; then
if [[ ! -z $CONFIG_OPTIONS ]]; then if [[ ! -z $CONFIG_OPTIONS ]]; then
make depend make depend
fi fi
make make
else else
if [[ ! -z $CONFIG_OPTIONS ]]; then if [[ ! -z $CONFIG_OPTIONS ]]; then
make depend >> "${LOG}" 2>&1 make depend >> "${LOG}" 2>&1
fi fi
(make >> "${LOG}" 2>&1) & spinner (make >> "${LOG}" 2>&1) & spinner
fi fi
echo "\n" echo "\n"
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Problem while make - Please check ${LOG}" echo "Problem while make - Please check ${LOG}"
exit 1 exit 1
fi fi
@ -202,18 +201,36 @@ do
make install_sw make install_sw
make clean make clean
else else
make install_sw >> "${LOG}" 2>&1 make install_sw >> "${LOG}" 2>&1
make clean >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1
fi fi
done done
echo "Build library for iOS..." 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 \
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 ${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..." 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 \
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 ${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 mkdir -p ${CURRENTPATH}/include
cp -R ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/include/openssl ${CURRENTPATH}/include/ cp -R ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/include/openssl ${CURRENTPATH}/include/