diff --git a/t/sanity.t b/t/sanity.t index 4d1a9f1..c2b2954 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -2,7 +2,7 @@ use t::Config; -plan tests => 231; +plan tests => 235; #no_diff(); @@ -1421,7 +1421,7 @@ sh ./configure --prefix=/usr/local/openresty/nginx \ --add-module=../redis-nginx-module-0.3.7 \ --add-module=../rds-json-nginx-module-0.14 \ --add-module=../rds-csv-nginx-module-0.07 \ - '--with-cc=gcc-4.2' --with-http_ssl_module + --with-cc=gcc-4.2 --with-http_ssl_module cd ../.. Type the following commands to build and install: gmake @@ -1573,7 +1573,7 @@ sh ./configure --prefix=/usr/local/openresty/nginx \ --add-module=../rds-json-nginx-module-0.14 \ --add-module=../rds-csv-nginx-module-0.07 \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \ - '--with-cc=cl' --with-http_ssl_module + --with-cc=cl --with-http_ssl_module cd ../.. Type the following commands to build and install: gmake @@ -4275,3 +4275,78 @@ install: all clean: rm -rf build + + + +=== TEST 5: --with-pcre-opt='foo bar' +--- cmd: ./configure --dry-run --with-pcre-opt='-foo -bar' --with-zlib-opt="hello, '\world" +--- out +platform: linux (linux) +cp -rp bundle/ build +cd build +cd LuaJIT-2.1-20160517 +gmake TARGET_STRIP=@: CCDEBUG=-g CC=cc PREFIX=/usr/local/openresty/luajit +gmake install TARGET_STRIP=@: CCDEBUG=-g CC=cc PREFIX=/usr/local/openresty/luajit DESTDIR=$OPENRESTY_BUILD_DIR/luajit-root/ +export LUAJIT_LIB='$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/lib' +export LUAJIT_INC='$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1' +cd .. +cd nginx-1.9.15 +sh ./configure --prefix=/usr/local/openresty/nginx \ + --with-cc-opt='-O2' \ + --add-module=../ngx_devel_kit-0.3.0 \ + --add-module=../echo-nginx-module-0.59 \ + --add-module=../xss-nginx-module-0.05 \ + --add-module=../ngx_coolkit-0.2rc3 \ + --add-module=../set-misc-nginx-module-0.30 \ + --add-module=../form-input-nginx-module-0.12 \ + --add-module=../encrypted-session-nginx-module-0.05 \ + --add-module=../srcache-nginx-module-0.31 \ + --add-module=../ngx_lua-0.10.5 \ + --add-module=../ngx_lua_upstream-0.05 \ + --add-module=../headers-more-nginx-module-0.30 \ + --add-module=../array-var-nginx-module-0.05 \ + --add-module=../memc-nginx-module-0.17 \ + --add-module=../redis2-nginx-module-0.13 \ + --add-module=../redis-nginx-module-0.3.7 \ + --add-module=../rds-json-nginx-module-0.14 \ + --add-module=../rds-csv-nginx-module-0.07 \ + --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \ + '--with-pcre-opt=-foo -bar' $'--with-zlib-opt=hello, \'\\world' --with-http_ssl_module +cd ../.. +Type the following commands to build and install: + gmake + gmake install + +--- makefile +.PHONY: all install clean + +all: + cd $OPENRESTY_BUILD_DIR/LuaJIT-2.1-20160517 && $(MAKE) TARGET_STRIP=@: CCDEBUG=-g CC=cc PREFIX=/usr/local/openresty/luajit + cd $OPENRESTY_BUILD_DIR/lua-cjson-2.1.0.4 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/usr/local/openresty/lualib LUA_MODULE_DIR=/usr/local/openresty/lualib CJSON_CFLAGS="-g -fpic" CC=cc + cd $OPENRESTY_BUILD_DIR/lua-redis-parser-0.12 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc + cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.06 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc + cd $OPENRESTY_BUILD_DIR/nginx-1.9.15 && $(MAKE) + +install: all + cd $OPENRESTY_BUILD_DIR/LuaJIT-2.1-20160517 && $(MAKE) install TARGET_STRIP=@: CCDEBUG=-g CC=cc PREFIX=/usr/local/openresty/luajit DESTDIR=$(DESTDIR) + cd $OPENRESTY_BUILD_DIR/lua-cjson-2.1.0.4 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/usr/local/openresty/lualib LUA_MODULE_DIR=/usr/local/openresty/lualib CJSON_CFLAGS="-g -fpic" CC=cc + cd $OPENRESTY_BUILD_DIR/lua-redis-parser-0.12 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc + cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.06 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc + cd $OPENRESTY_BUILD_DIR/lua-resty-dns-0.16 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-memcached-0.14 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-redis-0.24 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-mysql-0.16 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-string-0.09 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-upload-0.09 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-websocket-0.05 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-lock-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-lrucache-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-core-0.1.6 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-upstream-healthcheck-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/resty-cli-0.12 && $OPENRESTY_BUILD_DIR/install bin/* $(DESTDIR)/usr/local/openresty/bin/ + cp $OPENRESTY_BUILD_DIR/resty.index $(DESTDIR)/usr/local/openresty/ + cp -r $OPENRESTY_BUILD_DIR/pod $(DESTDIR)/usr/local/openresty/ + cd $OPENRESTY_BUILD_DIR/nginx-1.9.15 && $(MAKE) install DESTDIR=$(DESTDIR) + +clean: + rm -rf build diff --git a/util/configure b/util/configure index 15def7f..f75392a 100755 --- a/util/configure +++ b/util/configure @@ -144,7 +144,7 @@ for my $opt (@ARGV) { if ($opt =~ /^--with-cc=(.+)/) { $cc = $1; - push @ngx_opts, "'$opt'"; + push @ngx_opts, "$opt"; next; } @@ -330,7 +330,7 @@ if (@ngx_ld_opts) { my $cmd = "sh ./configure --prefix=$ngx_prefix" . $resty_opts . $ld_opts - . (@ngx_opts ? " \\\n @ngx_opts" : ""); + . (@ngx_opts ? " \\\n " . quote_cli_args(\@ngx_opts) : ""); ; shell $cmd, $dry_run; @@ -1290,3 +1290,20 @@ sub can_run { return undef; } +sub quote_cli_args { + my $args = shift; + my @quoted; + for my $arg (@$args) { + if ($arg =~ /[\\\s'"\$]/) { + if ($arg =~ /'/) { + $arg =~ s/([\\'])/\\$1/g; + push @quoted, "\$'$arg'"; + } else { + push @quoted, "'$arg'"; + } + } else { + push @quoted, $arg; + } + } + join " ", @quoted; +}