| 1 | #!/usr/bin/env bash |
| 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | # You may not use this file except in compliance with the License. |
| 6 | # A copy of the License is located at |
| 7 | # |
| 8 | # http://aws.amazon.com/apache2.0 |
| 9 | # |
| 10 | # or in the "license" file accompanying this file. This file is distributed |
| 11 | # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | # express or implied. See the License for the specific language governing |
| 13 | # permissions and limitations under the License. |
| 14 | # |
| 15 | |
| 16 | set -ex |
| 17 | pushd "$(pwd)" |
| 18 | |
| 19 | usage() { |
| 20 | echo "install_openssl_1_1_1.sh build_dir install_dir os_name" |
| 21 | exit 1 |
| 22 | } |
| 23 | |
| 24 | if [ "$#" -ne "3" ]; then |
| 25 | usage |
| 26 | fi |
| 27 | |
| 28 | BUILD_DIR=$1 |
| 29 | INSTALL_DIR=$2 |
| 30 | OS_NAME=$3 |
| 31 | source codebuild/bin/jobs.sh |
| 32 | RELEASE=1_1_1-stable |
| 33 | |
| 34 | mkdir -p $BUILD_DIR |
| 35 | cd "$BUILD_DIR" |
| 36 | curl --retry 3 -L https://github.com/openssl/openssl/archive/OpenSSL_${RELEASE}.zip --output OpenSSL_${RELEASE}.zip |
| 37 | unzip OpenSSL_${RELEASE}.zip |
| 38 | cd openssl-OpenSSL_${RELEASE} |
| 39 | |
| 40 | if [ "$OS_NAME" == "linux" ]; then |
| 41 | CONFIGURE="./config -d" |
| 42 | elif [[ "$OS_NAME" == "osx" || "$OS_NAME" == "darwin" ]]; then |
| 43 | CONFIGURE="./Configure darwin64-x86_64-cc" |
| 44 | else |
| 45 | echo "Invalid platform! $OS_NAME" |
| 46 | usage |
| 47 | fi |
| 48 | |
| 49 | mkdir -p $INSTALL_DIR |
| 50 | # Use g3 to get debug symbols in libcrypto to chase memory leaks |
| 51 | $CONFIGURE shared -g3 -fPIC \ |
| 52 | no-md2 no-rc5 no-rfc3779 no-sctp no-ssl-trace no-zlib \ |
| 53 | no-hw no-mdc2 no-seed no-idea enable-ec_nistp_64_gcc_128 no-camellia\ |
| 54 | no-bf no-ripemd no-dsa no-ssl2 no-ssl3 no-capieng \ |
| 55 | -DSSL_FORBID_ENULL -DOPENSSL_NO_DTLS1 -DOPENSSL_NO_HEARTBEATS \ |
| 56 | --prefix="$INSTALL_DIR" |
| 57 | |
| 58 | make -j $JOBS depend |
| 59 | make -j $JOBS |
| 60 | make -j $JOBS install_sw |
| 61 | |
| 62 | popd |
| 63 | |
| 64 | exit 0 |