From 1bb22d1e922c87d3c86c67bdce626767ee48fb5c Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Mon, 6 Aug 2018 17:27:33 +0300 Subject: Unit application library. Library now used in all language modules. Old 'nxt_app_*' code removed. See src/test/nxt_unit_app_test.c for usage sample. --- auto/make | 29 +++++++++++++++++++++++++++-- auto/modules/go | 1 + auto/modules/perl | 2 +- auto/modules/php | 2 +- auto/modules/python | 2 +- auto/modules/ruby | 2 +- auto/os/conf | 22 ++++++++++++++++++++++ auto/sources | 2 ++ 8 files changed, 56 insertions(+), 6 deletions(-) (limited to 'auto') diff --git a/auto/make b/auto/make index 9af63c97..121d575b 100644 --- a/auto/make +++ b/auto/make @@ -54,6 +54,18 @@ done $echo >> $NXT_MAKEFILE +$echo "NXT_LIB_UNIT_OBJS = \\" >> $NXT_MAKEFILE +$echo " $NXT_BUILD_DIR/src/nxt_lvlhsh.o \\" >> $NXT_MAKEFILE +$echo " $NXT_BUILD_DIR/src/nxt_murmur_hash.o \\" >> $NXT_MAKEFILE + +for nxt_src in $NXT_LIB_UNIT_SRCS +do + nxt_obj=${nxt_src%.c}.o + $echo " $NXT_BUILD_DIR/$nxt_obj \\" >> $NXT_MAKEFILE +done + +$echo >> $NXT_MAKEFILE + # Shared and static library. @@ -70,12 +82,17 @@ $NXT_BUILD_DIR/$NXT_LIB_STATIC: \$(NXT_LIB_OBJS) $NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_STATIC \\ \$(NXT_LIB_OBJS) +$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC: \$(NXT_LIB_UNIT_OBJS) + $NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\ + \$(NXT_LIB_UNIT_OBJS) + END # Object files. -for nxt_src in $NXT_LIB_SRCS $NXT_TEST_SRCS +for nxt_src in $NXT_LIB_SRCS $NXT_TEST_SRCS $NXT_LIB_UNIT_SRCS \ + src/test/nxt_unit_app_test.c do nxt_obj=${nxt_src%.c}.o nxt_dep=${nxt_src%.c}.dep @@ -129,6 +146,13 @@ $NXT_BUILD_DIR/utf8_file_name_test: $NXT_LIB_UTF8_FILE_NAME_TEST_SRCS \\ $NXT_BUILD_DIR/$NXT_LIB_STATIC \\ $NXT_LD_OPT $NXT_LIBM $NXT_LIBS +$NXT_BUILD_DIR/unit_app_test: $NXT_BUILD_DIR/src/test/nxt_unit_app_test.o \\ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + \$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/unit_app_test \\ + \$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_unit_app_test.o \\ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\ + $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS + END @@ -241,7 +265,8 @@ cat << END > Makefile include $NXT_MAKEFILE .PHONY: tests -tests: $NXT_BUILD_DIR/tests $NXT_BUILD_DIR/utf8_file_name_test +tests: $NXT_BUILD_DIR/tests $NXT_BUILD_DIR/utf8_file_name_test \\ + $NXT_BUILD_DIR/unit_app_test .PHONY: clean clean: diff --git a/auto/modules/go b/auto/modules/go index 68eb7d4a..7abd1e73 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -106,6 +106,7 @@ ${NXT_GO}-install: ${NXT_GO}-install-build ${NXT_GO}-install-src: install -d \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit install -p -m644 ./src/*.h ./build/*.h ./src/go/unit/* \ + ./src/nxt_unit.c ./src/nxt_lvlhsh.c ./src/nxt_murmur_hash.c \ \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit/ ${NXT_GO}-install-build: ${NXT_GO}-install-src diff --git a/auto/modules/perl b/auto/modules/perl index 4d59873e..35d4f5fb 100644 --- a/auto/modules/perl +++ b/auto/modules/perl @@ -155,7 +155,7 @@ NXT_PERL_MODULE_SRCS=" \ # The Perl module object files. -nxt_objs= +nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o for nxt_src in $NXT_PERL_MODULE_SRCS; do diff --git a/auto/modules/php b/auto/modules/php index 2fee49d3..762c1621 100644 --- a/auto/modules/php +++ b/auto/modules/php @@ -167,7 +167,7 @@ NXT_PHP_MODULE_SRCS=" \ # The php module object files. -nxt_objs= +nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o for nxt_src in $NXT_PHP_MODULE_SRCS; do diff --git a/auto/modules/python b/auto/modules/python index f8221915..e298f5b9 100644 --- a/auto/modules/python +++ b/auto/modules/python @@ -137,7 +137,7 @@ NXT_PYTHON_MODULE_SRCS=" \ # The python module object files. -nxt_objs= +nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o for nxt_src in $NXT_PYTHON_MODULE_SRCS; do diff --git a/auto/modules/ruby b/auto/modules/ruby index 971d3aeb..05072353 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -129,7 +129,7 @@ NXT_RUBY_MODULE_SRCS=" \ # The Ruby module object files. -nxt_objs= +nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o for nxt_src in $NXT_RUBY_MODULE_SRCS; do diff --git a/auto/os/conf b/auto/os/conf index df8b2683..1e298ecd 100644 --- a/auto/os/conf +++ b/auto/os/conf @@ -35,6 +35,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD" ;; @@ -57,6 +59,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD" ;; @@ -86,6 +90,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_EXEC_LINK="\$(CC)" NXT_SHARED_LOCAL_EXEC_LINK= @@ -113,6 +119,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.dylib" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.dylib" + NXT_LIB_UNIT_STATIC="libunit.a" + # MacOSX libm.dylib is a symlink to libSystem.dylib. NXT_LIBM= NXT_LIBS= @@ -135,6 +143,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD" ;; @@ -155,6 +165,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_PTHREAD" ;; @@ -175,6 +187,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD" ;; @@ -194,6 +208,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_PTHREAD" ;; @@ -213,6 +229,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_PTHREAD $NXT_LIBHG" ;; @@ -232,6 +250,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_PTHREAD" ;; @@ -250,6 +270,8 @@ case "$NXT_SYSTEM" in NXT_LIB_SHARED="libnxt.so" NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + NXT_LIB_UNIT_STATIC="libunit.a" + NXT_LIBM="-lm" NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD" ;; diff --git a/auto/sources b/auto/sources index eea0fb52..6f3c823e 100644 --- a/auto/sources +++ b/auto/sources @@ -102,6 +102,8 @@ NXT_LIB_SRC0=" \ src/nxt_mem_pool_cleanup.c \ " +NXT_LIB_UNIT_SRCS="src/nxt_unit.c" + NXT_LIB_SSLTLS_DEPS="src/nxt_ssltls.h" NXT_LIB_SSLTLS_SRCS="src/nxt_ssltls.c" -- cgit