Skip to content

Commit d1250d8

Browse files
committed
chore(lib) new build option for OpenSSL debug builds
Will produce an OpenSSL build that can be debugged via gdb.
1 parent cb7e69a commit d1250d8

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export NGX_BUILD_NOPOOL ?= 0
3030
export NGX_BUILD_FSANITIZE ?=
3131
export NGX_BUILD_OPENRESTY ?=
3232
export NGX_BUILD_OPENSSL ?=
33+
export NGX_BUILD_OPENSSL_DEBUG ?= 0
3334
export NGX_BUILD_CLANG_ANALYZER ?= 0
3435
export NGX_BUILD_GCOV ?= 0
3536
export NGX_BUILD_FORCE ?= 0

util/_lib.sh

+19-6
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,27 @@ install_openssl() {
126126
local dirname="openssl-lib-$OPENSSL_VER"
127127

128128
if [ ! -d $dirname ]; then
129-
notice "building OpenSSL..."
129+
notice "building OpenSSL... (debug: $NGX_BUILD_OPENSSL_DEBUG)"
130130
local prefix="$(pwd)/$dirname"
131+
local opts=""
132+
133+
if [[ "$NGX_BUILD_OPENSSL_DEBUG" == 1 ]]; then
134+
opts+="no-asm \
135+
-fno-inline \
136+
-fno-omit-frame-pointer \
137+
-d \
138+
-g3 \
139+
-ggdb3 \
140+
-O0"
141+
fi
142+
131143
pushd openssl-$OPENSSL_VER
132-
./config \
133-
--prefix=$prefix \
134-
--openssldir=$prefix/openssl \
135-
shared \
136-
no-threads
144+
eval ./config \
145+
"--prefix=$prefix" \
146+
"--openssldir=$prefix/openssl" \
147+
"shared" \
148+
"no-threads" \
149+
"$opts"
137150
make -j$(n_jobs)
138151
make install_sw
139152
popd

0 commit comments

Comments
 (0)