more progress on lua-cjson bundling. it now works on Mac OS X, FreeBSD, and Linux, at least.
This commit is contained in:
parent
6a75ebc5b0
commit
32ef993e05
|
@ -0,0 +1,13 @@
|
|||
diff --git a/lua_cjson.c b/lua_cjson.c
|
||||
index 4b1915a..b46e915 100644
|
||||
--- a/lua_cjson.c
|
||||
+++ b/lua_cjson.c
|
||||
@@ -501,7 +501,7 @@ static int lua_array_length(lua_State *l, json_config_t *cfg)
|
||||
/* table, startkey */
|
||||
while (lua_next(l, -2) != 0) {
|
||||
/* table, key, value */
|
||||
- if (lua_isnumber(l, -2) &&
|
||||
+ if (lua_type(l, -2) == LUA_TNUMBER &&
|
||||
(k = lua_tonumber(l, -2))) {
|
||||
/* Integer >= 1 ? */
|
||||
if (floor(k) == k && k >= 1) {
|
58
t/sanity.t
58
t/sanity.t
|
@ -219,12 +219,12 @@ Type the following commands to build and install:
|
|||
|
||||
all:
|
||||
cd $OPENRESTY_BUILD_DIR/lua-5.1.4 && $(MAKE) linux
|
||||
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.2 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib
|
||||
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.2 && $(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.5 && $(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.2 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib
|
||||
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.2 && $(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.5 && $(MAKE) install DESTDIR=$(DESTDIR)
|
||||
|
||||
clean:
|
||||
|
@ -1483,3 +1483,57 @@ install:
|
|||
clean:
|
||||
rm -rf build
|
||||
|
||||
|
||||
|
||||
=== TEST 30: default (on Mac OS X)
|
||||
--- ONLY
|
||||
--- cmd: ./configure --dry-run --platform=darwin
|
||||
--- out
|
||||
platform: macosx (darwin)
|
||||
cp -rp bundle/ build/
|
||||
cd build
|
||||
cd lua-5.1.4
|
||||
gmake macosx
|
||||
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.5
|
||||
./configure --prefix=/usr/local/openresty/nginx \
|
||||
--add-module=../ngx_devel_kit-0.2.17 \
|
||||
--add-module=../echo-nginx-module-0.37rc1 \
|
||||
--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.2.1rc4 \
|
||||
--add-module=../headers-more-nginx-module-0.15 \
|
||||
--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.12rc1 \
|
||||
--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) macosx
|
||||
cd $OPENRESTY_BUILD_DIR/lua-cjson-1.0.2 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib LDFLAGS='-bundle -undefined dynamic_lookup' CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/nginx-1.0.5 && $(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.2 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include LUA_LIB_DIR=/usr/local/openresty/lualib LDFLAGS='-bundle -undefined dynamic_lookup' CC=gcc
|
||||
cd $OPENRESTY_BUILD_DIR/nginx-1.0.5 && $(MAKE) install DESTDIR=$(DESTDIR)
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
|
||||
|
|
|
@ -528,32 +528,44 @@ _END_
|
|||
|
||||
print $in <<"_EOC_";
|
||||
|
||||
CFLAGS=\$"\$CFLAGS -DLUA_DEFAULT_PATH='\\"$lualib_prefix/?.lua\\"'"
|
||||
CFLAGS=\$"\$CFLAGS -DLUA_DEFAULT_CPATH='\\"$lualib_prefix/?.so\\"'"
|
||||
ngx_lua_dquote='"'
|
||||
CFLAGS="\$CFLAGS -DLUA_DEFAULT_PATH='\$ngx_lua_dquote$lualib_prefix/?.lua\$ngx_lua_dquote'"
|
||||
CFLAGS="\$CFLAGS -DLUA_DEFAULT_CPATH='\$ngx_lua_dquote$lualib_prefix/?.so\$ngx_lua_dquote'"
|
||||
_EOC_
|
||||
|
||||
close $in;
|
||||
|
||||
unless ($opts->{no_lua_cjson}) {
|
||||
my $dir = auto_complete 'lua-cjson';
|
||||
|
||||
|
||||
if (!defined $dir) {
|
||||
die "No lua-cjson found";
|
||||
}
|
||||
|
||||
my $install;
|
||||
if ($on_solaris) {
|
||||
$install = "$root_dir/build/install";
|
||||
} else {
|
||||
$install = "install";
|
||||
}
|
||||
my $lua_inc;
|
||||
if ($opts->{luajit}) {
|
||||
$lua_inc = $ENV{LUAJIT_INC};
|
||||
|
||||
my $lua_inc = $ENV{LUA_INC};
|
||||
} else {
|
||||
$lua_inc = $ENV{LUA_INC};
|
||||
}
|
||||
|
||||
my $extra_opts = " DESTDIR=\$(DESTDIR) LUA_INCLUDE_DIR=$lua_inc " .
|
||||
"LUA_LIB_DIR=$lualib_prefix";
|
||||
|
||||
if ($on_solaris) {
|
||||
$extra_opts .= " INSTALL=$root_dir/build/install";
|
||||
}
|
||||
|
||||
if ($platform eq 'macosx') {
|
||||
$extra_opts .= " LDFLAGS='-bundle -undefined dynamic_lookup'";
|
||||
}
|
||||
|
||||
if (defined $cc) {
|
||||
$extra_opts .= " CC=$cc";
|
||||
} else {
|
||||
$extra_opts .= " CC=gcc";
|
||||
}
|
||||
|
||||
push @make_cmds, "cd $root_dir/build/$dir && ".
|
||||
"\$(MAKE)$extra_opts";
|
||||
|
||||
|
|
|
@ -206,6 +206,9 @@ cd ..
|
|||
ver=1.0.2
|
||||
$root/util/get-tarball "http://www.kyne.com.au/~mark/software/lua-cjson-$ver.tar.gz" -O "lua-cjson-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-cjson-$ver.tar.gz || exit 1
|
||||
cd lua-cjson-$ver || exit 1
|
||||
patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
|
|
Loading…
Reference in New Issue