forked from gost-engine/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gost-build-3.sh
executable file
·70 lines (56 loc) · 1.91 KB
/
gost-build-3.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash -x
#
# Input taken via environment variables:
#
# OPENSSL_DIR: where binary OpenSSL installation is
# if empty, assume $HOME/openssl-3
#
# ENGINESDIR: where this OpenSSL version places engines
# if empty, assume ${OPENSSL_DIR}/lib/engines-3
#
# THREE: sub-suffix for the output log files (default - empty/none)
#
# NOTE: You *must* set OPENSSL_DIR env var if you want to build the GOST engine
# for OpenSSL-1.1.1+ or Macports-installed OpenSSL (3.x or 1.1.1x).
#
if [ -z ${OPENSSL_DIR} ]; then
# Assume we are building for OpenSSL-3 (current master)
LDFLAGS=""
OPENSSL_DIR="$HOME/openssl-3"
THREE="-3-"
fi
if [ -z ${ENGINESDIR} ]; then
ENGINESDIR="${OPENSSL_DIR}/lib/engines-3"
fi
OPENSSL_ENGINES_DIR=${ENGINESDIR}
if [ -z ${CC} ]; then
CC="clang"
fi
export OPENSSL_ROOT_DIR=${OPENSSL_DIR}
if [ -z ${DEBUG} ]; then
# DEBUG not set, building Release
CMAKE_BUILD_TYPE=Release
else
# Since env var DEBUG was set, build type is Debug
CMAKE_BUILD_TYPE=Debug
fi
OPENSSL_INCLUDE_DIR="${OPENSSL_DIR}/include"
OPENSSL_CRYPTO_LIBRARY="${OPENSSL_DIR}/lib/libcrypto.dylib"
OPENSSL_SSL_LIBRARY="${OPENSSL_DIR}/lib/libssl.dylib"
PKG_CONFIG_PATH="${OPENSSL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
OPENSSL_CFLAGS="-march=native -std=gnu17"
OPENSSL_LIB_DIR="${OPENSSL_DIR}/lib"
OPENSSL_CONF="${OPENSSL_DIR}/etc/openssl/openssl.cnf"
echo ""
echo "OPENSSL_DIR=\"${OPENSSL_DIR}\""
echo "ENGINESDIR=\"${ENGINESDIR}\""
echo "OPENSSL_ROOT_DIR=\"${OPENSSL_ROOT_DIR}\""
echo ""
rm -rf build
mkdir -p build
cd build
cmake .. -DCMAKE_C_COMPILER=${CC} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DOPENSSL_ENGINES_DIR=${OPENSSL_ENGINES_DIR} 2>&1 | tee ../cmake${THREE}out.txt
make VERBOSE=1 2>&1 | tee ../make${THREE}out.txt
make test 2>&1 | tee ../test${THREE}out.txt
make test ARGS='-V' 2>&1 | tee ../test${THREE}long-out.txt
#