Skip to content

Commit

Permalink
chore(lib) new build option for OpenSSL debug builds
Browse files Browse the repository at this point in the history
Will produce an OpenSSL build that can be debugged via gdb.
  • Loading branch information
thibaultcha committed Dec 4, 2024
1 parent cb7e69a commit 4412807
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export NGX_BUILD_NOPOOL ?= 0
export NGX_BUILD_FSANITIZE ?=
export NGX_BUILD_OPENRESTY ?=
export NGX_BUILD_OPENSSL ?=
export NGX_BUILD_OPENSSL_DEBUG ?= 0
export NGX_BUILD_CLANG_ANALYZER ?= 0
export NGX_BUILD_GCOV ?= 0
export NGX_BUILD_FORCE ?= 0
Expand Down
25 changes: 19 additions & 6 deletions util/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,27 @@ install_openssl() {
local dirname="openssl-lib-$OPENSSL_VER"

if [ ! -d $dirname ]; then
notice "building OpenSSL..."
notice "building OpenSSL... (debug: $NGX_BUILD_OPENSSL_DEBUG)"
local prefix="$(pwd)/$dirname"
local opts=""

if [[ "$NGX_BUILD_OPENSSL_DEBUG" == 1 ]]; then
opts+="no-asm \
-fno-inline \
-fno-omit-frame-pointer \
-d \
-g3 \
-ggdb3 \
-O0"
fi

pushd openssl-$OPENSSL_VER
./config \
--prefix=$prefix \
--openssldir=$prefix/openssl \
shared \
no-threads
eval ./config \
"--prefix=$prefix" \
"--openssldir=$prefix/openssl" \
"shared" \
"no-threads" \
"$opts"
make -j$(n_jobs)
make install_sw
popd
Expand Down

0 comments on commit 4412807

Please sign in to comment.