Skip to content

Commit ed295d6

Browse files
addendum to build script updates
added more flags and improved formatting
1 parent a95551c commit ed295d6

4 files changed

Lines changed: 84 additions & 19 deletions

File tree

scripts/build-wolfprovider.sh

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,32 @@ show_help() {
66
echo "Usage: $0"
77
echo ""
88
echo "Script Arguments:"
9-
echo " --help, -help, -h Display this help menu and exit"
10-
echo " --debug Builds OpenSSL, wolfSSL, and WolfProvider with debugging enabled"
11-
echo " --openssl-ver=VER Which version of OpenSSL to clone"
12-
echo " --wolfssl-ver=VER Which version of wolfSSL to clone"
13-
echo " --enable-fips Build wolfProvider with a cloned FIPS bundle. Cloned FIPS bundle can be changed with --fips-check"
14-
echo " --fips-bundle=DIR Build wolfProvider with a directory containing a wolfSSL FIPS bundle instead of cloning from GitHub. Requires a FIPS version to be given by --fips-version"
15-
echo " --fips-check=TAG Choose a FIPS tag to clone. May require a version to be given by --fips-version"
16-
echo " --fips-version=VER Choose the wolfSSL FIPS version"
17-
echo " --quicktest Disable some tests for a faster testing suite"
9+
echo " --help, -help, -h Display this help menu and exit"
10+
echo " --clean Run make clean in OpenSSL, wolfSSL, and wolfProvider"
11+
echo " --distclean Remove source directories of OpenSSL and wolfSSL. If using wolfProvider it must be disabled or cloning will fail"
12+
echo " --debug Builds OpenSSL, wolfSSL, and WolfProvider with debugging enabled. This is the same as setting WOLFPROV_DEBUG=1"
13+
echo " --debug-asn-template Enable debug information for asn within wolfSSL"
14+
echo " --disable-err-trace No debug trace messages from library errors in wolfSSL"
15+
echo " --openssl-ver=VER Which version of OpenSSL to clone"
16+
echo " --wolfssl-ver=VER Which version of wolfSSL to clone"
17+
echo " --enable-fips Build wolfProvider with a cloned FIPS bundle. Cloned FIPS bundle can be changed with --fips-check"
18+
echo " --fips-bundle=DIR Build wolfProvider with a directory containing a wolfSSL FIPS bundle instead of cloning from GitHub. Requires a FIPS version to be given by --fips-version"
19+
echo " --fips-check=TAG Choose a FIPS tag to clone. May require a version to be given by --fips-version"
20+
echo " --fips-version=VER Choose the wolfSSL FIPS version"
21+
echo " --quicktest Disable some tests for a faster testing suite"
1822
echo ""
1923
echo "Environment Variables:"
20-
echo " OPENSSL_TAG OpenSSL tag to use (e.g., openssl-3.5.0)"
21-
echo " WOLFSSL_TAG wolfSSL tag to use (e.g., v5.8.0-stable)"
22-
echo " WOLFPROV_DEBUG If set to 1, builds OpenSSL, wolfSSL, and wolfProvider with debug options enabled"
23-
echo " WOLFSSL_ISFIPS If set to 1, clones a wolfSSL FIPS bundle from GitHub"
24-
echo " WOLFSSL_FIPS_BUNDLE Directory containing the wolfSSL FIPS bundle to use instead of cloning from GitHub"
25-
echo " WOLFSSL_FIPS_VERSION Version of wolfSSL FIPS bundle (v5, v6, ready), used as an argument for --enable-fips when configuring wolfSSL"
26-
echo " WOLFSSL_FIPS_CHECK_TAG Tag for wolfSSL FIPS bundle (linuxv5.2.1, v6.0.0, etc), used as an argument for fips-check.sh when cloning a wolfSSL FIPS version"
27-
echo " WOLFPROV_QUICKTEST If set to 1, disables some tests in the test suite to increase test speed"
24+
echo " OPENSSL_TAG OpenSSL tag to use (e.g., openssl-3.5.0)"
25+
echo " WOLFSSL_TAG wolfSSL tag to use (e.g., v5.8.0-stable)"
26+
echo " WOLFSSL_ISFIPS If set to 1, clones a wolfSSL FIPS bundle from GitHub"
27+
echo " WOLFSSL_FIPS_BUNDLE Directory containing the wolfSSL FIPS bundle to use instead of cloning from GitHub"
28+
echo " WOLFSSL_FIPS_VERSION Version of wolfSSL FIPS bundle (v5, v6, ready), used as an argument for --enable-fips when configuring wolfSSL"
29+
echo " WOLFSSL_FIPS_CHECK_TAG Tag for wolfSSL FIPS bundle (linuxv5.2.1, v6.0.0, etc), used as an argument for fips-check.sh when cloning a wolfSSL FIPS version"
30+
echo " WOLFPROV_CLEAN If set to 1, run make clean in OpenSSL, wolfSSL, and wolfProvider"
31+
echo " WOLFPROV_DISTCLEAN If set to 1, remove the source directories of OpenSSL and wolfSSL"
32+
echo " WOLFPROV_DEBUG If set to 1, builds OpenSSL, wolfSSL, and wolfProvider with debug options enabled"
33+
echo " WOLFPROV_QUICKTEST If set to 1, disables some tests in the test suite to increase test speed"
34+
echo " WOLFPROV_DISABLE_ERR_TRACE If set to 1, wolfSSL will not be configured with --enable-debug-trace-errcodes=backtrace"
2835
echo ""
2936
}
3037

@@ -37,9 +44,21 @@ for arg in "$@"; do
3744
show_help
3845
exit 0
3946
;;
47+
--clean)
48+
WOLFPROV_CLEAN=1
49+
;;
50+
--distclean)
51+
WOLFPROV_DISTCLEAN=1
52+
;;
4053
--debug)
4154
WOLFPROV_DEBUG=1
4255
;;
56+
--debug-asn-template)
57+
WOLFSSL_DEBUG_ASN_TEMPLATE=1
58+
;;
59+
--disable-err-trace)
60+
WOLFPROV_DISABLE_ERR_TRACE=1
61+
;;
4362
--openssl-ver=*)
4463
IFS='=' read -r trash ossl_ver <<< "$arg"
4564
if [ -z "$ossl_ver" ]; then
@@ -91,7 +110,7 @@ for arg in "$@"; do
91110
WOLFPROV_QUICKTEST=1
92111
;;
93112
*)
94-
args_wrong+="$arg "
113+
args_wrong+="$arg, "
95114
;;
96115
esac
97116
done

scripts/utils-openssl.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,21 @@ clone_openssl() {
7878
}
7979

8080
install_openssl() {
81-
printf "\nInstalling OpenSSL ${OPENSSL_TAG} ...\n"
81+
printf "\n"
82+
83+
if [ "$WOLFPROV_CLEAN" -eq "1" ]; then
84+
printf "Cleaning OpenSSL ...\n"
85+
if [ -f "${OPENSSL_SOURCE_DIR}/Makefile" ]; then
86+
make -C "${OPENSSL_SOURCE_DIR}" clean >>$LOG_FILE 2>&1
87+
fi
88+
rm -rf "${OPENSSL_INSTALL_DIR}"
89+
fi
90+
if [ -d "${OPENSSL_SOURCE_DIR}" ] && [ "$WOLFPROV_DISTCLEAN" -eq "1" ]; then
91+
printf "Removing OpenSSL source ...\n"
92+
rm -rf "${OPENSSL_SOURCE_DIR}"
93+
fi
94+
95+
printf "Installing OpenSSL ${OPENSSL_TAG} ...\n"
8296
clone_openssl
8397
cd ${OPENSSL_SOURCE_DIR}
8498

scripts/utils-wolfprovider.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,26 @@ WOLFPROV_PATH=$WOLFPROV_INSTALL_DIR/lib
4343

4444
WOLFPROV_DEBUG=${WOLFPROV_DEBUG:-0}
4545

46+
WOLFPROV_CLEAN=${WOLFPROV_CLEAN:-0}
47+
WOLFPROV_DISTCLEAN=${WOLFPROV_DISTCLEAN:-0}
48+
4649
install_wolfprov() {
4750
cd ${WOLFPROV_SOURCE_DIR}
4851

4952
init_openssl
5053
init_wolfssl
54+
55+
printf "\n"
56+
57+
if [ "$WOLFPROV_CLEAN" -eq "1" ]; then
58+
printf "Cleaning wolfProvider ...\n"
59+
if [ -f "Makefile" ]; then
60+
make clean >>$LOG_FILE 2>&1
61+
fi
62+
rm -rf ${WOLFPROV_INSTALL_DIR}
63+
fi
64+
65+
printf "Consolidating wolfProvider ...\n"
5166
unset OPENSSL_MODULES
5267
unset OPENSSL_CONF
5368
printf "LD_LIBRARY_PATH: $LD_LIBRARY_PATH\n"

scripts/utils-wolfssl.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,28 @@ clone_wolfssl() {
6565
exit 1
6666
fi
6767
printf "Done.\n"
68+
else
69+
printf "\twolfSSL source directory exists: ${WOLFSSL_SOURCE_DIR}\n"
6870
fi
6971
fi
7072
}
7173

7274
install_wolfssl() {
75+
printf "\n"
76+
77+
if [ "$WOLFPROV_CLEAN" -eq "1" ]; then
78+
printf "Cleaning wolfSSL ...\n"
79+
if [ -f "${WOLFSSL_SOURCE_DIR}/Makefile" ]; then
80+
make -C "${WOLFSSL_SOURCE_DIR}" clean >>$LOG_FILE 2>&1
81+
fi
82+
rm -rf "${WOLFSSL_INSTALL_DIR}"
83+
fi
84+
if [ -d "${WOLFSSL_SOURCE_DIR}" ] && [ "$WOLFPROV_DISTCLEAN" -eq "1" ]; then
85+
printf "Removing wolfSSL source ...\n"
86+
rm -rf "${WOLFSSL_SOURCE_DIR}"
87+
fi
88+
89+
printf "Installing wolfSSL ${WOLFSSL_TAG} ...\n"
7390
clone_wolfssl
7491
cd ${WOLFSSL_SOURCE_DIR}
7592

0 commit comments

Comments
 (0)