|
| 1 | +#!/usr/bin/env ksh |
| 2 | +# |
| 3 | +# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License 2.0 (the "License"). You may not use |
| 6 | +# this file except in compliance with the License. You can obtain a copy |
| 7 | +# in the file LICENSE in the source distribution or at |
| 8 | +# https://www.openssl.org/source/license.html |
| 9 | +# |
| 10 | + |
| 11 | +set -x |
| 12 | + |
| 13 | +. ./common_util.sh |
| 14 | + |
| 15 | +INSTALL_ROOT=${BENCH_INSTALL_ROOT:-"/tmp/bench.binaries"} |
| 16 | +RESULT_DIR=${BENCH_RESULTS:-"${INSTALL_ROOT}/results"} |
| 17 | +WORKSPACE_ROOT=${BENCH_WORKSPACE_ROOT:-"/tmp/bench.workspace"} |
| 18 | +MAKE_OPTS=${BENCH_MAKE_OPTS} |
| 19 | +CFLAGS_SAVE=${CFLAGS} |
| 20 | + |
| 21 | +WOLFSSL_VERSION=5.8.2 |
| 22 | +LIBRESSL_VERSION=4.2.1 |
| 23 | +OPENSSL_VERSION=master |
| 24 | + |
| 25 | +function build_perftools { |
| 26 | + # |
| 27 | + # when testing changes for C-code or CMakeFileList.txt |
| 28 | + # you must change link to repository, so script pulls |
| 29 | + # modified sources |
| 30 | + # |
| 31 | + typeset PERFTOOLS='https://github.com/openssl/perftools' |
| 32 | + |
| 33 | + cd ${WORKSPACE_ROOT} || exit 1 |
| 34 | + # |
| 35 | + # you may also need to change clone command to |
| 36 | + # checkout correct branch. |
| 37 | + # |
| 38 | + git clone ${PERFTOOLS} || exit 1 |
| 39 | + cd perftools/source || exit 1 |
| 40 | + |
| 41 | + cmake -S ${WORKSPACE_ROOT}/perftools/source \ |
| 42 | + -B ${INSTALL_ROOT}/build.openssl-${OPENSSL_VERSION} \ |
| 43 | + -DOPENSSL_CONFIG_MODE=1 \ |
| 44 | + -DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/openssl-${OPENSSL_VERSION} \ |
| 45 | + -DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/openssl-${OPENSSL_VERSION} || exit 1 |
| 46 | + cmake --build ${INSTALL_ROOT}/build.openssl-${OPENSSL_VERSION} || exit 1 |
| 47 | + |
| 48 | + cmake -S ${WORKSPACE_ROOT}/perftools/source \ |
| 49 | + -B ${INSTALL_ROOT}/build.wolfssl-${WOLFSSL_VERSION} \ |
| 50 | + -DWITH_OPENSSL_FORK=1 \ |
| 51 | + -DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/wolfssl-${WOLFSSL_VERSION} || exit 1 |
| 52 | + cmake --build ${INSTALL_ROOT}/build.wolfssl-${WOLFSSL_VERSION} || exit 1 |
| 53 | + |
| 54 | + cmake -S ${WORKSPACE_ROOT}/perftools/source \ |
| 55 | + -B ${INSTALL_ROOT}/build.libressl-${LIBRESSL_VERSION} \ |
| 56 | + -DWITH_OPENSSL_FORK=1 \ |
| 57 | + -DCMAKE_PREFIX_PATH=${INSTALL_ROOT}/libressl-${LIBRESSL_VERSION} || exit 1 |
| 58 | + cmake --build ${INSTALL_ROOT}/build.libressl-${LIBRESSL_VERSION} || exit 1 |
| 59 | + |
| 60 | + cmake -S . -B $BENCH_INSTALL_ROOT/build.boringssl/ \ |
| 61 | + -DCMAKE_PREFIX_PATH=$BENCH_INSTALL_ROOT/boringssl \ |
| 62 | + -DWITH_OPENSSL_FORK=1 || exit 1 |
| 63 | + cmake --build ${INSTALL_ROOT}/build.boringssl || exit 1 |
| 64 | + |
| 65 | + cmake -S . -B $BENCH_INSTALL_ROOT/build.aws-lc/ \ |
| 66 | + -DCMAKE_PREFIX_PATH=$BENCH_INSTALL_ROOT/aws-lc \ |
| 67 | + -DWITH_OPENSSL_FORK=1 || exit 1 |
| 68 | + cmake --build ${INSTALL_ROOT}/build.aws-lc || exit 1 |
| 69 | +} |
| 70 | + |
| 71 | +install_openssl ${OPENSSL_VERSION} |
| 72 | + |
| 73 | +# |
| 74 | +# enable WolfSSL's compatibility layer with OpenSSL. |
| 75 | +# another option is to use ./configure --enable-opensslextra |
| 76 | +# see: https://www.wolfssl.com/documentation/manuals/wolfssl/chapter13.html |
| 77 | +# |
| 78 | +CFLAGS="${CFLAGS} -DOPENSSL_EXTRA -DOPENSSL_ALL" |
| 79 | +install_wolfssl ${WOLFSSL_VERSION} |
| 80 | +CFLAGS=${CFLAGS_SAVE} |
| 81 | + |
| 82 | +install_libressl ${LIBRESSL_VERSION} |
| 83 | + |
| 84 | +install_boringssl |
| 85 | + |
| 86 | +install_aws_lc |
| 87 | + |
| 88 | +build_perftools |
0 commit comments