Skip to content

Commit

Permalink
added the new option --with-lua51=PATH to the configure script. relea…
Browse files Browse the repository at this point in the history
…sed ngx_openresty 1.0.6.7.
  • Loading branch information
agentzh committed Sep 18, 2011
1 parent 733e37e commit b11711a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 4 deletions.
57 changes: 56 additions & 1 deletion t/sanity.t
Expand Up @@ -2,7 +2,7 @@

use t::Config;

plan tests => 139;
plan tests => 143;

#no_diff();

Expand Down Expand Up @@ -51,6 +51,7 @@ __DATA__
--without-lua_rds_parser disable the lua-rds-parser library
--without-lua51 disable the bundled Lua 5.1 interpreter
--with-lua51=PATH specify the external installation of Lua 5.1 by PATH
--with-luajit enable and build LuaJIT 2.0
--with-luajit=PATH use the external LuaJIT 2.0 installation specified by PATH
--with-libdrizzle=DIR specify the libdrizzle 1.0 (or drizzle) installation prefix
Expand Down Expand Up @@ -693,6 +694,7 @@ clean:
--without-lua_rds_parser disable the lua-rds-parser library
--without-lua51 disable the bundled Lua 5.1 interpreter
--with-lua51=PATH specify the external installation of Lua 5.1 by PATH
--with-luajit enable and build LuaJIT 2.0
--with-luajit=PATH use the external LuaJIT 2.0 installation specified by PATH
--with-libdrizzle=DIR specify the libdrizzle 1.0 (or drizzle) installation prefix
Expand Down Expand Up @@ -2063,3 +2065,56 @@ platform: linux (linux)
--with-luajit and --with-luajit=PATH are mutually exclusive.
--- exit: 2
=== TEST 38: --with-lua51=PATH
--- cmd: ./configure --dry-run --with-lua51=/tmp/lua
--- out
platform: linux (linux)
cp -rp bundle/ build/
cd build
export LUA_LIB='/tmp/lua/lib'
export LUA_INC='/tmp/lua/include'
cd nginx-1.0.6
./configure --prefix=/usr/local/openresty/nginx \
--add-module=../ngx_devel_kit-0.2.17 \
--add-module=../echo-nginx-module-0.37rc4 \
--add-module=../xss-nginx-module-0.03rc3 \
--add-module=../set-misc-nginx-module-0.22rc2 \
--add-module=../form-input-nginx-module-0.07rc5 \
--add-module=../encrypted-session-nginx-module-0.01 \
--add-module=../ngx_lua-0.3.1rc3 \
--add-module=../headers-more-nginx-module-0.16rc2 \
--add-module=../srcache-nginx-module-0.12 \
--add-module=../array-var-nginx-module-0.03rc1 \
--add-module=../memc-nginx-module-0.12 \
--add-module=../redis2-nginx-module-0.07 \
--add-module=../upstream-keepalive-nginx-module-0.3 \
--add-module=../auth-request-nginx-module-0.2 \
--add-module=../rds-json-nginx-module-0.12rc3 \
--add-module=../rds-csv-nginx-module-0.02 \
--with-ld-opt='-Wl,-rpath,/tmp/lua/lib' \
--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-cjson-1.0.2 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/tmp/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=/tmp/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.03 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/tmp/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
cd $OPENRESTY_BUILD_DIR/nginx-1.0.6 && $(MAKE)
install:
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.2 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/tmp/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=/tmp/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.03 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/tmp/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib CC=gcc
cd $OPENRESTY_BUILD_DIR/nginx-1.0.6 && $(MAKE) install DESTDIR=$(DESTDIR)
clean:
rm -rf build
19 changes: 16 additions & 3 deletions util/configure
Expand Up @@ -138,6 +138,9 @@ for my $opt (@ARGV) {
} elsif ($opt eq '--without-lua51') {
$resty_opts{no_lua} = 1;

} elsif ($opt =~ /^--with-lua51=(.*)/) {
$resty_opts{lua_path} = $1;

} elsif ($opt eq '--without-lua_cjson') {
$resty_opts{no_lua_cjson} = 1;

Expand Down Expand Up @@ -333,7 +336,8 @@ _END_
}

if (! $opts->{luajit} && ! $opts->{luajit_path}
&& ! $opts->{no_http_lua} && ! $opts->{no_lua})
&& ! $opts->{no_http_lua} && ! $opts->{no_lua}
&& ! $opts->{lua_path})
{
$opts->{lua} = 1;
}
Expand Down Expand Up @@ -498,6 +502,13 @@ _END_

cd '..';

} elsif ($opts->{lua_path}) {
my $lua_prefix = $opts->{lua_path};
env LUA_LIB => "$lua_prefix/lib";
env LUA_INC => "$lua_prefix/include";

push @ngx_rpaths, "$lua_prefix/lib";

} elsif ($opts->{lua}) {
# build stdandard lua

Expand Down Expand Up @@ -536,10 +547,11 @@ _END_
. "\$(MAKE) install$extra_opts INSTALL_TOP=\$(DESTDIR)$lua_prefix";

cd '..';

}

if ($opts->{lua} || $opts->{luajit} || $opts->{luajit_path}) {
if ($opts->{lua} || $opts->{lua_path}
|| $opts->{luajit} || $opts->{luajit_path})
{
# build lua modules

my $lualib_prefix = "$prefix/lualib";
Expand Down Expand Up @@ -797,6 +809,7 @@ _EOC_
--without-lua_rds_parser disable the lua-rds-parser library
--without-lua51 disable the bundled Lua 5.1 interpreter
--with-lua51=PATH specify the external installation of Lua 5.1 by PATH
--with-luajit enable and build LuaJIT 2.0
--with-luajit=PATH use the external LuaJIT 2.0 installation specified by PATH
--with-libdrizzle=DIR specify the libdrizzle 1.0 (or drizzle) installation prefix
Expand Down

0 comments on commit b11711a

Please sign in to comment.