improved Yao Weibin's patch for the --add-module option a bit and also added a test case.
This commit is contained in:
parent
5fb3e869e5
commit
af701e5b64
|
@ -2,6 +2,7 @@ package t::Config;
|
|||
|
||||
use Test::Base -Base;
|
||||
use IPC::Run3 qw( run3 );
|
||||
use Cwd qw( cwd );
|
||||
|
||||
our @EXPORT = qw(
|
||||
run_tests
|
||||
|
@ -13,6 +14,7 @@ sub shell (@);
|
|||
sub cd ($);
|
||||
|
||||
our $BuildRoot;
|
||||
our $DistRoot;
|
||||
our @SavedTests;
|
||||
our $RootDir = `pwd`;
|
||||
chomp $RootDir;
|
||||
|
@ -23,6 +25,7 @@ sub run_tests {
|
|||
|
||||
cd "ngx_openresty-$ver";
|
||||
|
||||
$DistRoot = cwd();
|
||||
$BuildRoot = File::Spec->rel2abs("./build");
|
||||
|
||||
for my $block (blocks()) {
|
||||
|
@ -52,6 +55,7 @@ sub run_test ($) {
|
|||
$expected_err = '';
|
||||
} else {
|
||||
$expected_err =~ s/\$OPENRESTY_BUILD_DIR\b/$BuildRoot/gs;
|
||||
$expected_err =~ s/\$OPENRESTY_DIR\b/$DistRoot/gs;
|
||||
}
|
||||
|
||||
my $expected_out = $block->out;
|
||||
|
@ -64,6 +68,7 @@ sub run_test ($) {
|
|||
#die $BuildRoot;
|
||||
|
||||
$stdout =~ s/\Q$BuildRoot\E/\$OPENRESTY_BUILD_DIR/g;
|
||||
$stdout =~ s/\Q$DistRoot\E/\$OPENRESTY_DIR/g;
|
||||
|
||||
is($stdout, $expected_out, "$name - stdout ok");
|
||||
is($stderr, $expected_err, "$name - stderr ok");
|
||||
|
|
60
t/sanity.t
60
t/sanity.t
|
@ -190,7 +190,6 @@ Options directly inherited from nginx
|
|||
|
||||
|
||||
|
||||
|
||||
=== TEST 2: default
|
||||
--- cmd: ./configure --dry-run
|
||||
--- out
|
||||
|
@ -837,7 +836,6 @@ Options directly inherited from nginx
|
|||
|
||||
|
||||
|
||||
|
||||
=== TEST 12: default on solaris
|
||||
--- cmd: ./configure --dry-run --platform=solaris
|
||||
--- out
|
||||
|
@ -2243,3 +2241,61 @@ install:
|
|||
clean:
|
||||
rm -rf build
|
||||
|
||||
|
||||
|
||||
=== TEST 41: --add-module
|
||||
--- cmd: ./configure --add-module=/path/to/some/module --add-module=../some/module/ --dry-run
|
||||
--- out
|
||||
platform: linux (linux)
|
||||
cp -rp bundle/ build
|
||||
cd build
|
||||
cd lua-5.1.4
|
||||
gmake linux
|
||||
gmake install INSTALL_TOP=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua
|
||||
export LUA_LIB='$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/lib'
|
||||
export LUA_INC='$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include'
|
||||
cd ..
|
||||
cd nginx-1.0.10
|
||||
./configure --prefix=/usr/local/openresty/nginx \
|
||||
--add-module=../ngx_devel_kit-0.2.17 \
|
||||
--add-module=../echo-nginx-module-0.37rc7 \
|
||||
--add-module=../xss-nginx-module-0.03rc8 \
|
||||
--add-module=../set-misc-nginx-module-0.22rc4 \
|
||||
--add-module=../form-input-nginx-module-0.07rc5 \
|
||||
--add-module=../encrypted-session-nginx-module-0.01 \
|
||||
--add-module=../ngx_lua-0.3.1rc42 \
|
||||
--add-module=../headers-more-nginx-module-0.16rc6 \
|
||||
--add-module=../srcache-nginx-module-0.13rc3 \
|
||||
--add-module=../array-var-nginx-module-0.03rc1 \
|
||||
--add-module=../memc-nginx-module-0.13rc2 \
|
||||
--add-module=../redis2-nginx-module-0.08rc2 \
|
||||
--add-module=../upstream-keepalive-nginx-module-0.3 \
|
||||
--add-module=../auth-request-nginx-module-0.2 \
|
||||
--add-module=../rds-json-nginx-module-0.12rc7 \
|
||||
--add-module=../rds-csv-nginx-module-0.04 \
|
||||
--add-module=/path/to/some/module --add-module=$OPENRESTY_DIR/../some/module --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/lua-5.1.4 && $(MAKE) linux
|
||||
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.3 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/lua-redis-parser-0.09rc5 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.04 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/nginx-1.0.10 && $(MAKE)
|
||||
|
||||
install:
|
||||
cd $OPENRESTY_BUILD_DIR/lua-5.1.4 && $(MAKE) install INSTALL_TOP=$(DESTDIR)/usr/local/openresty/lua
|
||||
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.3 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/lua-redis-parser-0.09rc5 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/nginx-1.0.10 && $(MAKE) install DESTDIR=$(DESTDIR)
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
|
|
|
@ -214,22 +214,8 @@ for my $opt (@ARGV) {
|
|||
|
||||
} elsif ($opt =~ /^--add-module=(.*)/) {
|
||||
|
||||
my $mod_path=$1;
|
||||
my $path;
|
||||
my $new_opt;
|
||||
|
||||
if ($mod_path =~ /^\//) {
|
||||
#absolute path
|
||||
$path = $mod_path;
|
||||
}
|
||||
else{
|
||||
#relative path
|
||||
$path = "$root_dir/$mod_path";
|
||||
}
|
||||
|
||||
$new_opt = "--add-module=$path";
|
||||
|
||||
push @ngx_opts, $new_opt;
|
||||
my $mod_path = File::Spec->rel2abs($1);
|
||||
push @ngx_opts, "--add-module=$mod_path";
|
||||
|
||||
} elsif ($opt =~ /^--\w.*/) {
|
||||
push @ngx_opts, $opt;
|
||||
|
|
Loading…
Reference in New Issue