From 8696bcf8a736efbf34eb0be7d23cd1592ddb66df Mon Sep 17 00:00:00 2001 From: Jan Schaumann Date: Wed, 4 Sep 2024 21:25:47 -0400 Subject: [PATCH] add support for the CMAKE_FLAGS environment variable --- CONFIGURE.md | 10 ++++++++++ scripts/fullbuild.sh | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CONFIGURE.md b/CONFIGURE.md index 63dccf97..26e8a20b 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -30,6 +30,16 @@ activate further warning messages. In particular, when "Debug" has been set, dis [debugging capabilities](https://github.com/open-quantum-safe/oqs-provider/wiki/Debugging) are activated and additional setup warnings are output. +### CMAKE_FLAGS + +This environment variable lets you specify additional flags to pass to `cmake` explicitly when using the `fullbuild.sh` script. + +For example, in order to point `cmake` to a specific library, you might run: + +``` +$ env CMAKE_FLAGS="-DOPENSSL_CRYPTO_LIBRARY=/opt/lib64/libcrypto.so" bash scripts/fullbuild.sh +``` + ### liboqs_DIR This environment variable must be set to the location of the `liboqs` installation to be diff --git a/scripts/fullbuild.sh b/scripts/fullbuild.sh index 4640b575..96b6a7cc 100755 --- a/scripts/fullbuild.sh +++ b/scripts/fullbuild.sh @@ -3,6 +3,7 @@ # The following variables influence the operation of this build script: # Argument -f: Soft clean, ensuring re-build of oqs-provider binary # Argument -F: Hard clean, ensuring checkout and build of all dependencies +# EnvVar CMAKE_FLAGS: passed to cmake # EnvVar MAKE_PARAMS: passed to invocations of make; sample value: "-j" # EnvVar OQSPROV_CMAKE_PARAMS: passed to invocations of oqsprovider cmake # EnvVar LIBOQS_BRANCH: Defines branch/release of liboqs; default value "main" @@ -108,7 +109,7 @@ if [ -z $liboqs_DIR ]; then # STD: only include NIST standardized algorithms # NIST_R4: only include algorithms in round 4 of the NIST competition # All: include all algorithms supported by liboqs (default) - cd liboqs && cmake -GNinja $DOQS_ALGS_ENABLED $CMAKE_OPENSSL_LOCATION -DCMAKE_INSTALL_PREFIX=$(pwd)/../.local -S . -B _build && cd _build && ninja && ninja install && cd ../.. + cd liboqs && cmake -GNinja $CMAKE_FLAGS $DOQS_ALGS_ENABLED $CMAKE_OPENSSL_LOCATION -DCMAKE_INSTALL_PREFIX=$(pwd)/../.local -S . -B _build && cd _build && ninja && ninja install && cd ../.. if [ $? -ne 0 ]; then echo "liboqs build failed. Exiting." exit -1 @@ -125,9 +126,9 @@ if [ ! -f "_build/lib/oqsprovider.$SHLIBEXT" ]; then BUILD_TYPE="" # for omitting public key in private keys add -DNOPUBKEY_IN_PRIVKEY=ON if [ -z "$OPENSSL_INSTALL" ]; then - cmake $CMAKE_OPENSSL_LOCATION $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build + cmake $CMAKE_FLAGS $CMAKE_OPENSSL_LOCATION $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build else - cmake -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build + cmake $CMAKE_FLAGS -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build fi if [ $? -ne 0 ]; then echo "provider build failed. Exiting."