Review comments

- Maintain fixed default version in script
- Add --cleanup option for concious cleanup before building and remove directory-check
- Remove (for now) option to build latest version
This commit is contained in:
Anton Tieleman 2016-09-18 17:34:44 +02:00
parent 98738414bb
commit 1d9c392864
1 changed files with 24 additions and 34 deletions

View File

@ -22,7 +22,7 @@
# -u Attempt to use undefined variable outputs error message, and forces an exit # -u Attempt to use undefined variable outputs error message, and forces an exit
set -u set -u
DEFAULTBRANCH="1.0.2" # Default branch in case no version or branch is specified DEFAULTVERSION="1.0.2h" # Default version in case no version is specified
IOS_MIN_SDK_VERSION="7.0" # Minimum iOS SDK version to build for IOS_MIN_SDK_VERSION="7.0" # Minimum iOS SDK version to build for
TVOS_MIN_SDK_VERSION="9.0" # Minimum tvOS SDK version to build for TVOS_MIN_SDK_VERSION="9.0" # Minimum tvOS SDK version to build for
@ -36,6 +36,7 @@ echo_help()
echo " --archs=\"ARCH ARCH ...\" Space-separated list of architectures to build" echo " --archs=\"ARCH ARCH ...\" Space-separated list of architectures to build"
echo " Options: x86_64 i386 arm64 armv7s armv7 tv_x86_64 tv_arm64" echo " Options: x86_64 i386 arm64 armv7s armv7 tv_x86_64 tv_arm64"
echo " Note: The framework will contain include files from the architecture listed first" echo " Note: The framework will contain include files from the architecture listed first"
echo " --cleanup Clean up build directories (bin, include/openssl, lib, src) before starting build"
echo " --ec-nistp-64-gcc-128 Enable config option enable-ec_nistp_64_gcc_128 for 64 bit builds" echo " --ec-nistp-64-gcc-128 Enable config option enable-ec_nistp_64_gcc_128 for 64 bit builds"
echo " -h, --help Print help (this message)" echo " -h, --help Print help (this message)"
echo " --ios-sdk=SDKVERSION Override iOS SDK version" echo " --ios-sdk=SDKVERSION Override iOS SDK version"
@ -43,7 +44,8 @@ echo_help()
echo " --tvos-sdk=SDKVERSION Override tvOS SDK version" echo " --tvos-sdk=SDKVERSION Override tvOS SDK version"
echo " -v, --verbose Enable verbose logging" echo " -v, --verbose Enable verbose logging"
echo " --verbose-on-error Dump last 500 lines from log file if an error occurs (for Travis builds)" echo " --verbose-on-error Dump last 500 lines from log file if an error occurs (for Travis builds)"
echo " --version=VERSION OpenSSL version to build (defaults to latest version in branch ${DEFAULTBRANCH}" echo " --version=VERSION OpenSSL version to build (defaults to ${DEFAULTVERSION})"
echo " Note: This script does not yet work with OpenSSL 1.1.0"
echo echo
echo "For custom configure options, set variable CONFIG_OPTIONS" echo "For custom configure options, set variable CONFIG_OPTIONS"
echo "For custom cURL options, set variable CURL_OPTIONS" echo "For custom cURL options, set variable CURL_OPTIONS"
@ -93,6 +95,7 @@ check_status()
# Init optional command line vars # Init optional command line vars
ARCHS="" ARCHS=""
CLEANUP=""
CONFIG_ENABLE_EC_NISTP_64_GCC_128="" CONFIG_ENABLE_EC_NISTP_64_GCC_128=""
IOS_SDKVERSION="" IOS_SDKVERSION=""
PARALLEL="" PARALLEL=""
@ -108,6 +111,9 @@ case $i in
ARCHS="${i#*=}" ARCHS="${i#*=}"
shift shift
;; ;;
--cleanup)
CLEANUP="true"
;;
--ec-nistp-64-gcc-128) --ec-nistp-64-gcc-128)
CONFIG_ENABLE_EC_NISTP_64_GCC_128="true" CONFIG_ENABLE_EC_NISTP_64_GCC_128="true"
;; ;;
@ -153,21 +159,7 @@ if [ -n "${VERSION}" ]; then
# Default OpenSSL version # Default OpenSSL version
else else
# Default branch or user provided (in latter case verify number format) VERSION="${DEFAULTVERSION}"
# For future use (when adding 1.1.0), so the user can select a default branch
BRANCH="${DEFAULTBRANCH}"
# Determine latest version of selected branch
echo "Checking latest version of ${BRANCH} branch on GitHub..."
GITHUB_VERSION=$(curl ${CURL_OPTIONS} -Ls https://github.com/openssl/openssl/releases.atom | grep "<title>OpenSSL_${BRANCH//./_}" | head -1 | sed -E "s|^.*title>OpenSSL_(${BRANCH//./_}[a-z]*)</title.*$|\1|g")
# Verify result
if [ -z "${GITHUB_VERSION}" ]; then
echo "Could not determine latest version, please check https://github.com/openssl/openssl/releases and use --version option"
exit 1
fi
VERSION="${GITHUB_VERSION//_/.}"
fi fi
# Set GITHUB_VERSION (version with underscores instead of dots) # Set GITHUB_VERSION (version with underscores instead of dots)
@ -193,17 +185,13 @@ if [ "${PARALLEL}" != "false" ]; then
fi fi
# Write files relative to script location and validate directory # Write files relative to script location and validate directory
CURRENTPATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) CURRENTPATH=$(pwd)
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
if [[ "${CURRENTPATH}" == "/" || "${CURRENTPATH}" == "/usr" || "${CURRENTPATH}" == "/usr/local" ]]; then
echo "This script should not be executed from directory ${CURRENTPATH}"
exit 1
fi
cd "${CURRENTPATH}" cd "${CURRENTPATH}"
# Validate Xcode Developer path # Validate Xcode Developer path
@ -252,18 +240,20 @@ else
echo "Using ${OPENSSL_ARCHIVE_FILE_NAME}" echo "Using ${OPENSSL_ARCHIVE_FILE_NAME}"
fi fi
# Clean up target directories if present # Clean up target directories if requested and present
if [ -d "${CURRENTPATH}/bin" ]; then if [ "${CLEANUP}" == "true" ]; then
rm -r "${CURRENTPATH}/bin" if [ -d "${CURRENTPATH}/bin" ]; then
fi rm -r "${CURRENTPATH}/bin"
if [ -d "${CURRENTPATH}/include/openssl" ]; then fi
rm -r "${CURRENTPATH}/include/openssl" if [ -d "${CURRENTPATH}/include/openssl" ]; then
fi rm -r "${CURRENTPATH}/include/openssl"
if [ -d "${CURRENTPATH}/lib" ]; then fi
rm -r "${CURRENTPATH}/lib" if [ -d "${CURRENTPATH}/lib" ]; then
fi rm -r "${CURRENTPATH}/lib"
if [ -d "${CURRENTPATH}/src" ]; then fi
rm -r "${CURRENTPATH}/src" if [ -d "${CURRENTPATH}/src" ]; then
rm -r "${CURRENTPATH}/src"
fi
fi fi
# (Re-)create target directories # (Re-)create target directories