blob: 0c709318ac9dbe860512c8654e3807e94ae172df [file] [log] [blame]
MODULES+= lua
MODULE_SUMMARY_lua= 3rd-party Lua dynamic modules
include $(CONTRIB)/src/luajit2/version
include $(CONTRIB)/src/ngx_devel_kit/version
include $(CONTRIB)/src/lua-nginx-module/version
include $(CONTRIB)/src/stream-lua-nginx-module/version
include $(CONTRIB)/src/lua-resty-core/version
include $(CONTRIB)/src/lua-resty-lrucache/version
MODULE_VERSION_lua= $(LUA_NGINX_MODULE_VERSION)
MODULE_RELEASE_lua= 1
MODULE_VERSION_PREFIX_lua=$(MODULE_TARGET_PREFIX)
MODULE_SOURCES_lua= ngx_devel_kit-$(MODULE_VERSION_ndk).tar.gz \
lua-nginx-module-$(MODULE_VERSION_lua).tar.gz \
stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz \
luajit2-$(LUAJIT2_VERSION).tar.gz \
lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz \
lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz
MODULE_PATCHES_lua= $(CONTRIB)/src/luajit2/Makefile.patch \
$(CONTRIB)/src/luajit2/src-luaconf.h.patch \
$(CONTRIB)/src/lua-nginx-module/config.patch \
$(CONTRIB)/src/stream-lua-nginx-module/config.patch
MODULE_CONFARGS_lua= --with-http_dav_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
--add-dynamic-module=$(MODSRC_PREFIX)lua-nginx-module-$(LUA_NGINX_MODULE_VERSION) \
--add-dynamic-module=$(MODSRC_PREFIX)stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION)
.deps-module-lua:
cd $(CONTRIB) && make \
.sum-luajit2 \
.sum-ngx_devel_kit \
.sum-lua-nginx-module \
.sum-stream-lua-nginx-module \
.sum-lua-resty-core \
.sum-lua-resty-lrucache
touch $@
MODULE_DEPENDS_lua=,$(NDK_DEPENDENCY_TAG)
define MODULE_DEFINITIONS_lua
USE_LUAJIT = 1
LUAJIT_INC_nginx=$$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1
LUAJIT_LIB_nginx=$$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/lib
LUAJIT_INC_nginx_debug=$$(BUILDDIR_nginx_debug)/extra/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1
LUAJIT_LIB_nginx_debug=$$(BUILDDIR_nginx_debug)/extra/luajit2-$(LUAJIT2_VERSION)/usr/lib
endef
export MODULE_DEFINITIONS_lua
define MODULE_PREBUILD_lua
cd $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION) \&\& \
DESTDIR="$$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)" CFLAGS="-fPIC" $$(MAKE) -j$$(NUMJOBS) install
mv $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/bin/luajit $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/bin/nginx-luajit
mv $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/luajit.1 $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/nginx-luajit.1
endef
export MODULE_PREBUILD_lua
define MODULE_ENV_lua
LUAJIT_INC="$$(LUAJIT_INC_$$(shell echo $$@ | cut -d '.' -f 3))" LUAJIT_LIB="$$(LUAJIT_LIB_$$(shell echo $$@ | cut -d '.' -f 3))"
endef
export MODULE_ENV_lua
define MODULE_PREINSTALL_lua
rm -f $$(BUILDDIR_nginx_debug)/objs/ndk_http_module-debug.so
rm -f $$(BUILDDIR_nginx)/objs/ndk_http_module.so
mkdir -p $$(INSTALLDIR)/usr/bin
mkdir -p $$(INSTALLDIR)/usr/share/man/man1
install -m755 $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/bin/nginx-luajit $$(INSTALLDIR)/usr/bin/
install -m644 $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/nginx-luajit.1 $$(INSTALLDIR)/usr/share/man/man1/
mkdir -p $$(INSTALLDIR)/usr/share/nginx-luajit-2.1/jit
for f in `find $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/nginx-luajit-2.1/jit/ -type f`; do \
install -m644 $$$${f} $$(INSTALLDIR)/usr/share/nginx-luajit-2.1/jit/ ; \
done
mkdir -p $$(INSTALLDIR)/usr/include/nginx-luajit-2.1
for f in `find $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1/ -type f`; do \
install -m644 $$$${f} $$(INSTALLDIR)/usr/include/nginx-luajit-2.1/ ; \
done
mkdir -p $$(INSTALLDIR)/usr/share/nginx-luajit-2.1/resty
cd $$(BUILDDIR_nginx)/extra/lua-resty-core-$(LUA_RESTY_CORE_VERSION) \&\& \
LUA_LIB_DIR=$$(INSTALLDIR)/usr/share/nginx-luajit-2.1 make install
cd $$(BUILDDIR_nginx)/extra/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION) \&\& \
LUA_LIB_DIR=$$(INSTALLDIR)/usr/share/nginx-luajit-2.1 make install
endef
export MODULE_PREINSTALL_lua
define MODULE_POST_lua
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_lua) for $(MODULE_SUMMARY_PREFIX) have been installed.
To enable these modules, add the following to /etc/nginx/nginx.conf
and reload nginx:
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_lua_module.so;
load_module modules/ngx_stream_lua_module.so;
Note that ndk_http_module.so must be placed first.
These modules are compiled with LuaJIT 2.1 library.
The following binary should be used for testing and bytecode generation:
/usr/bin/nginx-luajit
Please refer to the modules documentation for further details:
https://github.com/openresty/lua-nginx-module
https://github.com/openresty/stream-lua-nginx-module
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_lua