From 61f6ecb419a9339df5ca72e21c1d74bce7d38a3b Mon Sep 17 00:00:00 2001 From: lijunlong Date: Fri, 5 Jun 2020 18:11:26 +0800 Subject: [PATCH] feature: passed C compiler option -g by default for statically linked openssl, pcre, and zlib libraries to enable debuginfo. --- t/000-sanity.t | 24 ++++++++++++------------ util/configure | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/t/000-sanity.t b/t/000-sanity.t index 8aeff9a..7087a8a 100644 --- a/t/000-sanity.t +++ b/t/000-sanity.t @@ -1407,8 +1407,8 @@ install: all clean: rm -rf build *.exe *.dll openresty-* --- err -Can't exec "gcc-4.2": No such file or directory at ./configure line 710. -Can't exec "gcc-4.2": No such file or directory at ./configure line 755. +Can't exec "gcc-4.2": No such file or directory at ./configure line 725. +Can't exec "gcc-4.2": No such file or directory at ./configure line 770. @@ -1588,8 +1588,8 @@ install: all clean: rm -rf build *.exe *.dll openresty-* --- err -Can't exec "cl": No such file or directory at ./configure line 710. -Can't exec "cl": No such file or directory at ./configure line 755. +Can't exec "cl": No such file or directory at ./configure line 725. +Can't exec "cl": No such file or directory at ./configure line 770. @@ -2432,8 +2432,8 @@ install: all clean: rm -rf build *.exe *.dll openresty-* --- err -Can't exec "sw_vers": No such file or directory at ./configure line 829. -Use of uninitialized value $v in scalar chomp at ./configure line 830. +Can't exec "sw_vers": No such file or directory at ./configure line 844. +Use of uninitialized value $v in scalar chomp at ./configure line 845. @@ -2523,8 +2523,8 @@ install: all clean: rm -rf build *.exe *.dll openresty-* --- err -Can't exec "sw_vers": No such file or directory at ./configure line 829. -Use of uninitialized value $v in scalar chomp at ./configure line 830. +Can't exec "sw_vers": No such file or directory at ./configure line 844. +Use of uninitialized value $v in scalar chomp at ./configure line 845. @@ -3523,7 +3523,7 @@ sh ./configure --prefix=/usr/local/openresty/nginx \ --add-module=../rds-csv-nginx-module-0.09 \ --add-module=../ngx_stream_lua-0.0.8rc3 \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \ - --with-openssl=$OPENRESTY_DIR/../some/module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module + --with-openssl=$OPENRESTY_DIR/../some/module --with-openssl-opt=-g --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module cd ../.. Type the following commands to build and install: gmake @@ -3962,7 +3962,7 @@ sh ./configure --prefix=/usr/local/openresty/nginx \ --add-module=../rds-csv-nginx-module-0.09 \ --add-module=../ngx_stream_lua-0.0.8rc3 \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \ - --with-pcre=$OPENRESTY_DIR/../some/module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module + --with-pcre=$OPENRESTY_DIR/../some/module --with-pcre-opt=-g --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module cd ../.. Type the following commands to build and install: gmake @@ -4050,7 +4050,7 @@ sh ./configure --prefix=/usr/local/openresty/nginx \ --add-module=../rds-csv-nginx-module-0.09 \ --add-module=../ngx_stream_lua-0.0.8rc3 \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \ - --with-zlib=$OPENRESTY_DIR/../some/module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module + --with-zlib=$OPENRESTY_DIR/../some/module --with-zlib-opt=-g --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module cd ../.. Type the following commands to build and install: gmake @@ -4847,7 +4847,7 @@ sh ./configure --prefix=/usr/local/openresty/nginx \ --add-module=../rds-csv-nginx-module-0.09 \ --add-module=../ngx_stream_lua-0.0.8rc3 \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \ - '--with-pcre-opt=-foo -bar' $'--with-zlib-opt=hello, \'\\world' --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module + '--with-pcre-opt=-g -foo -bar' $'--with-zlib-opt=-g hello, \'\\world' --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module cd ../.. Type the following commands to build and install: gmake diff --git a/util/configure b/util/configure index 1cdd8fc..da74fe2 100755 --- a/util/configure +++ b/util/configure @@ -25,6 +25,9 @@ my $OS = $^O; my ($ngx_dir, $lualib_prefix); +my %with_ext_lib; +my %with_ext_lib_opts; + for my $opt (@ARGV) { if ($opt =~ /^--platform=(.*)/) { $OS = $1; @@ -346,6 +349,12 @@ for my $opt (@ARGV) { } $path = File::Spec->rel2abs($path); push @ngx_opts, "--with-$lib=$path"; + $with_ext_lib{$lib} = 1; + + } elsif ($opt =~ /^--with-(openssl|pcre|zlib)-opt=(.*)/) { + my ($lib, $opt) = ($1, $2); + push @ngx_opts, "--with-$lib-opt=-g $opt"; + $with_ext_lib_opts{$lib} = 1; } elsif ($opt =~ /^--sbin-path=(.*)/) { $ngx_sbin = $1; @@ -359,6 +368,12 @@ for my $opt (@ARGV) { } } +for my $lib (qw/openssl pcre zlib/) { + if ($with_ext_lib{$lib} && !$with_ext_lib_opts{$lib}) { + push @ngx_opts, "--with-$lib-opt=-g"; + } +} + if ($platform eq 'msys') { $resty_opts{no_lua_resty_signal} = 1; $resty_opts{no_lua_resty_shell} = 1;