diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2015-01-03 04:17:33 +0100 |
---|---|---|
committer | Anders Roxell <anders.roxell@linaro.org> | 2015-01-03 04:20:12 +0100 |
commit | 7c7487f5570b6331a88b036a8db938badc103221 (patch) | |
tree | 253a437290832bfa109e748a894ca90be9763467 | |
parent | f40a7174a6516ef03df819a8b8f84f6f2c9b1de8 (diff) |
helper: openssl: separete fetch and build logic
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rw-r--r-- | helper/openssl | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/helper/openssl b/helper/openssl index 5adc080..f2c6837 100644 --- a/helper/openssl +++ b/helper/openssl @@ -4,7 +4,8 @@ OPENSSL_BUILD_FAILED=0 OPENSSL_GIT=${OPENSSL_GIT:-git://git.openssl.org/openssl.git} BASE_ARCH=${ARCH:-$(uname -m)} -export OPENSSL_SRCDIR=${ROOT_DIR}/openssl +export OPENSSL_SRCDIR=${SRCDIR}/openssl +export OPENSSL_BUILDDIR=${BUILDDIR}/openssl export OPENSSL_INSTALLDIR=${OPENSSL_INSTALLDIR:-${ROOT_DIR}/installed/${BASE_ARCH}/openssl-${OPENSSL_BRANCH}} OPENSSL_BRANCH=${OPENSSL_BRANCH:-OpenSSL_1_0_1h} export OPENSSL_BUILD=${OPENSSL_BUILD:-0} @@ -38,10 +39,10 @@ build_openssl() fi fi - git clone ${OPENSSL_GIT} ${OPENSSL_SRCDIR} >> ${ROOT_DIR}/log-openssl_clone.log 2>&1 - pushd ${OPENSSL_SRCDIR} > /dev/null - git checkout -b latest-tag ${OPENSSL_BRANCH} >> ${OPENSSL_SRCDIR}/log-build.log 2>&1 + openssl_fetch + openssl_new_builddir + pushd ${OPENSSL_BUILDDIR} > /dev/null if [[ -n ${ARCH} ]]; then CROSS_OPTS="--cross-compile-prefix=${compiler_prefix}-" ./Configure ${openssl_build_arch} ${CROSS_OPTS} --prefix="${OPENSSL_INSTALLDIR}" shared >> ${OPENSSL_SRCDIR}/log-build.log 2>&1 @@ -56,8 +57,23 @@ build_openssl() openssl_cleanup(){ [[ ${OPENSSL_BUILD_FAILED} -eq 1 ]] && return - rm -rf ${OPENSSL_SRCDIR} + rm -rf ${OPENSSL_BUILDDIR} rm -f ${ROOT_DIR}/log-openssl_clone.log } +openssl_fetch() { + if [[ -d ${OPENSSL_SRCDIR} ]]; then + pushd ${OPENSSL_SRCDIR} > /dev/null + git remote update + popd > /dev/null + else + git clone ${OPENSSL_GIT} ${OPENSSL_SRCDIR} >> ${ROOT_DIR}/log-openssl_clone.log 2>&1 + fi +} + +openssl_new_builddir() { + rm -rf ${OPENSSL_BUILDDIR} + git clone --quiet --depth=1 -b ${OPENSSL_BRANCH} file:///${OPENSSL_SRCDIR} ${OPENSSL_BUILDDIR} >> ${ROOT_DIR}/log-openssl_clone.log 2>&1 +} + ## vim: set ft=sh sw=4 sts=4 et foldmethod=syntax : ## |