From ae252f2d30223ea14b010936520616a6a1321fe1 Mon Sep 17 00:00:00 2001 From: Felix Schulze Date: Mon, 7 Dec 2015 18:51:50 +0100 Subject: [PATCH] Add spinner for progress --- build-libssl.sh | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index 693415d..10d773c 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -35,7 +35,20 @@ ENABLE_EC_NISTP_64_GCC_128="" # 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" +} CURRENTPATH=`pwd` ARCHS="i386 x86_64 armv7 armv7s arm64 tv_x86_64 tv_arm64" @@ -135,12 +148,12 @@ do export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}" fi - echo " Configure..." + echo " Configure...\c" set +e 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 - else - ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1 + (./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 [ $? != 0 ]; then @@ -148,7 +161,7 @@ do exit 1 fi - echo " Patch..." + echo "\n Patch..." # add -isysroot to CC= if [[ "${PLATFORM}" == "AppleTVSimulator" || "${PLATFORM}" == "AppleTVOS" ]]; then sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -mtvos-version-min=${TVOS_MIN_SDK_VERSION} !" "Makefile" @@ -156,8 +169,7 @@ do sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${MIN_SDK_VERSION} !" "Makefile" fi - echo " Make..." - echo " Please stand by..." + echo " Make...\c" if [ "$1" == "verbose" ]; then if [[ ! -z $CONFIG_OPTIONS ]]; then @@ -168,8 +180,9 @@ do if [[ ! -z $CONFIG_OPTIONS ]]; then make depend >> "${LOG}" 2>&1 fi - make >> "${LOG}" 2>&1 + (make >> "${LOG}" 2>&1) & spinner fi + echo "\n" if [ $? != 0 ]; then echo "Problem while make - Please check ${LOG}"