diff options
author | Leif Lindholm <leif.lindholm@linaro.org> | 2017-06-07 17:54:49 +0100 |
---|---|---|
committer | Leif Lindholm <leif.lindholm@linaro.org> | 2017-06-07 17:54:49 +0100 |
commit | 9629677fccded567075db34db4934c7ecc476526 (patch) | |
tree | a6c7cf086aafb41493de718a8e101de97d975159 | |
parent | abbe1c0a2dbeadde0e3c5f3a183f6c595b70158e (diff) |
common-functions: update openssl import
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
-rw-r--r-- | common-functions | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/common-functions b/common-functions index 671be5a..821cbdb 100644 --- a/common-functions +++ b/common-functions @@ -102,20 +102,17 @@ function get_clang_version esac } -function import_openssl +function download_patch_openssl { - cd CryptoPkg/Library/OpensslLib/ OPENSSL_VER=`ls EDKII_openssl-*.patch | sed 's/^.*-\([0-9.a-z]*\).patch/\1/'` OPENSSL_TAR=openssl-${OPENSSL_VER}.tar.gz OPENSSL_URL=http://www.openssl.org/source/${OPENSSL_TAR} OPENSSL_DIR=openssl-${OPENSSL_VER} OPENSSL_PATCH=EDKII_openssl-${OPENSSL_VER}.patch - # Don't re-import if already done - if [ "$OPENSSL_CONFIGURED" = "TRUE" -o -e "$WORKSPACE"/CryptoPkg/Include/openssl/opensslconf.h ]; then - echo "Using existing OpenSSL $OPENSSL_VER" - cd - - return 0 + if [ -e "$WORKSPACE"/CryptoPkg/Include/openssl/opensslconf.h ]; then + echo "OpenSSL already imported!" + return 0 fi # Use cached copy if available @@ -134,9 +131,49 @@ function import_openssl else echo "OpenSSL $OPENSSL_VER import failed!" >&2 rm -rf $OPENSSL_TAR $OPENSSL_DIR - cd - return 1 fi +} +function clone_process_openssl +{ + if [ -e openssl/include/openssl/opensslconf.h ]; then + echo "OpenSSL already imported!" + return 0 + fi + + OPENSSL_VER=`git ls-remote --tags git://github.com/openssl/openssl.git | awk '{print $2;}' | sed 's-^refs/tags/--g' | grep -v '\^{}$' | grep '^OpenSSL' | grep -v '^OpenSSL_FIPS' | tail -1 | sed -n 's/^OpenSSL_\([0-9]*\)_\([0-9]*\)_\([0-9.a-z]*\)$/openssl-\1.\2.\3\n/p'` + OPENSSL_TAR="$OPENSSL_VER.tar.gz" + if [ -z "$OPENSSL_TAR" ]; then + return 1 + fi + OPENSSL_URL=http://www.openssl.org/source/${OPENSSL_TAR} + if [ ! -f "$OPENSSL_TAR" ]; then + wget -q ${OPENSSL_URL} + else + rm -rf openssl + fi + tar xzf "$OPENSSL_TAR" + mv "$OPENSSL_VER" openssl + # perl process_files.pl # not needed and not currently working + return $? +} + +function import_openssl +{ + # Don't re-import if already done + if [ "$OPENSSL_CONFIGURED" = "TRUE" ]; then + echo "Using existing OpenSSL $OPENSSL_VER" + return 0 + fi + + cd CryptoPkg/Library/OpensslLib/ + if [ -f EDKII_openssl-*.patch ]; then + download_patch_openssl + else + clone_process_openssl + fi + RET=$? cd - >/dev/null + return $RET } |