| 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_0_2.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 | |
| 33 | mkdir -p $BUILD_DIR |
| 34 | cd "$BUILD_DIR" |
| 35 | curl --retry 3 -L https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip --output openssl-OpenSSL_1_0_2-stable.zip |
| 36 | unzip openssl-OpenSSL_1_0_2-stable.zip |
| 37 | cd openssl-OpenSSL_1_0_2-stable |
| 38 | |
| 39 | if [ "$OS_NAME" == "linux" ]; then |
| 40 | CONFIGURE="./config -d" |
| 41 | elif [ "$OS_NAME" == "osx" ]; then |
| 42 | CONFIGURE="./Configure darwin64-x86_64-cc" |
| 43 | else |
| 44 | echo "Invalid platform! $OS_NAME" |
| 45 | usage |
| 46 | fi |
| 47 | |
| 48 | mkdir -p $INSTALL_DIR |
| 49 | $CONFIGURE shared -g3 -fPIC no-libunbound no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-ssl-trace \ |
| 50 | no-store no-zlib no-hw no-mdc2 no-seed no-idea enable-ec_nistp_64_gcc_128 no-camellia no-bf no-ripemd \ |
| 51 | no-dsa no-ssl2 no-capieng -DSSL_FORBID_ENULL -DOPENSSL_NO_DTLS1 -DOPENSSL_NO_HEARTBEATS \ |
| 52 | --prefix="$INSTALL_DIR" |
| 53 | |
| 54 | make -j $JOBS depend |
| 55 | make -j $JOBS |
| 56 | make -j $JOBS install_sw |
| 57 | |
| 58 | popd |
| 59 | |
| 60 | exit 0 |
| 61 |