diff --git a/t/sanity.t b/t/sanity.t index 9fe5789..ec6d2ab 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -2,7 +2,7 @@ use t::Config; -plan tests => 243; +plan tests => 251; #no_diff(); @@ -1734,7 +1734,7 @@ install: all clean: rm -rf build --- err -Can't exec "cl": No such file or directory at ./configure line 605. +Can't exec "cl": No such file or directory at ./configure line 613. @@ -2572,7 +2572,7 @@ install: all clean: rm -rf build --- err -Can't exec "sw_vers": No such file or directory at ./configure line 651. +Can't exec "sw_vers": No such file or directory at ./configure line 659. @@ -2653,7 +2653,7 @@ install: all clean: rm -rf build --- err -Can't exec "sw_vers": No such file or directory at ./configure line 651. +Can't exec "sw_vers": No such file or directory at ./configure line 659. @@ -4772,3 +4772,160 @@ install: all clean: rm -rf build + + +=== TEST 64: --sbin-path (absolute) +--- cmd: ./configure --sbin-path=/opt/blah/nginx --dry-run +--- out +platform: linux (linux) +cp -rp bundle/ build +cd build +cd LuaJIT-2.1-20161104 +gmake TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' CC=cc PREFIX=/usr/local/openresty/luajit +gmake install TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' 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.11.2 +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.60 \ + --add-module=../xss-nginx-module-0.05 \ + --add-module=../ngx_coolkit-0.2rc3 \ + --add-module=../set-misc-nginx-module-0.31 \ + --add-module=../form-input-nginx-module-0.12 \ + --add-module=../encrypted-session-nginx-module-0.06 \ + --add-module=../srcache-nginx-module-0.31 \ + --add-module=../ngx_lua-0.10.7 \ + --add-module=../ngx_lua_upstream-0.06 \ + --add-module=../headers-more-nginx-module-0.32 \ + --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' \ + --sbin-path=/opt/blah/nginx --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-20161104 && $(MAKE) TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' 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.11.2 && $(MAKE) + +install: all + cd $OPENRESTY_BUILD_DIR/LuaJIT-2.1-20161104 && $(MAKE) install TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' 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.18 && $(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.26 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-mysql-0.17 && $(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.10 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-websocket-0.06 && $(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.9 && $(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/lua-resty-limit-traffic-0.01 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/opm-0.0.2 && $OPENRESTY_BUILD_DIR/install bin/* $(DESTDIR)/usr/local/openresty/bin/ + cd $OPENRESTY_BUILD_DIR/resty-cli-0.16 && $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.11.2 && $(MAKE) install DESTDIR=$(DESTDIR) + mkdir -p $(DESTDIR)/usr/local/openresty/site/lualib $(DESTDIR)/usr/local/openresty/site/pod $(DESTDIR)/usr/local/openresty/site/manifest + ln -sf /opt/blah/nginx $(DESTDIR)/usr/local/openresty/bin/openresty + +clean: + rm -rf build + + + +=== TEST 65 --sbin-path (relative) +--- cmd: ./configure --sbin-path=../bin/nginx --dry-run +--- out +platform: linux (linux) +cp -rp bundle/ build +cd build +cd LuaJIT-2.1-20161104 +gmake TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' CC=cc PREFIX=/usr/local/openresty/luajit +gmake install TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' 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.11.2 +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.60 \ + --add-module=../xss-nginx-module-0.05 \ + --add-module=../ngx_coolkit-0.2rc3 \ + --add-module=../set-misc-nginx-module-0.31 \ + --add-module=../form-input-nginx-module-0.12 \ + --add-module=../encrypted-session-nginx-module-0.06 \ + --add-module=../srcache-nginx-module-0.31 \ + --add-module=../ngx_lua-0.10.7 \ + --add-module=../ngx_lua_upstream-0.06 \ + --add-module=../headers-more-nginx-module-0.32 \ + --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' \ + --sbin-path=../bin/nginx --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-20161104 && $(MAKE) TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' 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.11.2 && $(MAKE) + +install: all + cd $OPENRESTY_BUILD_DIR/LuaJIT-2.1-20161104 && $(MAKE) install TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' 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.18 && $(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.26 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-mysql-0.17 && $(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.10 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/lua-resty-websocket-0.06 && $(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.9 && $(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/lua-resty-limit-traffic-0.01 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install + cd $OPENRESTY_BUILD_DIR/opm-0.0.2 && $OPENRESTY_BUILD_DIR/install bin/* $(DESTDIR)/usr/local/openresty/bin/ + cd $OPENRESTY_BUILD_DIR/resty-cli-0.16 && $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.11.2 && $(MAKE) install DESTDIR=$(DESTDIR) + mkdir -p $(DESTDIR)/usr/local/openresty/site/lualib $(DESTDIR)/usr/local/openresty/site/pod $(DESTDIR)/usr/local/openresty/site/manifest + ln -sf ../bin/nginx $(DESTDIR)/usr/local/openresty/bin/openresty + +clean: + rm -rf build diff --git a/util/configure b/util/configure index 5cde63a..8c146d3 100755 --- a/util/configure +++ b/util/configure @@ -121,6 +121,7 @@ my $with_resty_mods_regex; } my $prefix = '/usr/local/openresty'; +my $ngx_sbin; my %resty_opts; my $dry_run; my @ngx_rpaths; @@ -304,6 +305,10 @@ for my $opt (@ARGV) { $path = File::Spec->rel2abs($path); push @ngx_opts, "--with-$lib=$path"; + } elsif ($opt =~ /^--sbin-path=(.*)/) { + $ngx_sbin = $1; + push @ngx_opts, $opt; + } elsif ($opt =~ /^--\w.*/) { push @ngx_opts, $opt; @@ -354,7 +359,10 @@ push @make_install_cmds, . " \$(DESTDIR)$prefix/site/manifest"; if ($platform ne 'msys') { - push @make_install_cmds, "ln -sf $ngx_prefix/sbin/nginx \$(DESTDIR)$prefix/bin/openresty"; + if (!$ngx_sbin) { + $ngx_sbin = "$ngx_prefix/sbin/nginx"; + } + push @make_install_cmds, "ln -sf $ngx_sbin \$(DESTDIR)$prefix/bin/openresty"; } cd '../..'; # to the root