From dbce694d5a9b43009fef894120edd44ad1e59c25 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 17 Jul 2019 21:17:30 +0300 Subject: Perl: removed "--include=" configure option. It's surplus option because the perl executable returns the proper path. Also the Perl module configure script was cleaned up a bit. Note that NXT_PERL_LDOPTS already contains the library path. --- auto/modules/perl | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'auto') diff --git a/auto/modules/perl b/auto/modules/perl index bf6fe6f0..904a5055 100644 --- a/auto/modules/perl +++ b/auto/modules/perl @@ -14,14 +14,12 @@ for nxt_option; do case "$nxt_option" in --perl=*) NXT_PERL="$value" ;; - --include=*) NXT_PERL_INCPATH="$value" ;; --module=*) NXT_PERL_MODULE="$value" ;; --help) cat << END --perl=FILE set perl executable, default: perl - --include=DIRECTORY set directory path to perl headers --module=NAME set unit perl module name END @@ -59,10 +57,8 @@ nxt_found=no if /bin/sh -c "$NXT_PERL -MConfig -e 'print \"Perl version: \", \$Config{version}, \"\\n\"'" >> $NXT_AUTOCONF_ERR 2>&1; then - NXT_PERL_INCPATH=${NXT_PERL_INCPATH=`$NXT_PERL -MConfig -e 'print $Config{archlib}, "/CORE"'`} - NXT_PERL_INCLUDE="-I ${NXT_PERL_INCPATH}" - - NXT_PERL_LDOPTS=`$NXT_PERL -MExtUtils::Embed -e ldopts` + NXT_PERL_INCLUDE=`$NXT_PERL -MExtUtils::Embed -e perl_inc | sed -e 's/^ //;s/ $//'` + NXT_PERL_LDOPTS=`$NXT_PERL -MExtUtils::Embed -e ldopts | sed -e 's/^ //;s/ $//'` if [ "$NXT_SYSTEM" = "Darwin" ]; then # OS X system perl wants to link universal binaries @@ -70,13 +66,11 @@ if /bin/sh -c "$NXT_PERL -MConfig -e 'print \"Perl version: \", | sed -e 's/-arch i386//' -e 's/-arch x86_64//'` fi - NXT_PERL_LIBS="-L ${NXT_PERL_INCPATH} ${NXT_PERL_LDOPTS}" - nxt_feature="Perl" nxt_feature_name="" nxt_feature_run=no nxt_feature_incs="${NXT_PERL_INCLUDE}" - nxt_feature_libs="${NXT_PERL_LIBS}" + nxt_feature_libs="${NXT_PERL_LDOPTS}" nxt_feature_test=" #define _GNU_SOURCE #include @@ -123,7 +117,7 @@ nxt_feature="Perl version" nxt_feature_name="" nxt_feature_run=value nxt_feature_incs="${NXT_PERL_INCLUDE}" -nxt_feature_libs="${NXT_PERL_LIBS}" +nxt_feature_libs="${NXT_PERL_LDOPTS}" nxt_feature_test=" #define _GNU_SOURCE #include @@ -194,7 +188,7 @@ ${NXT_PERL_MODULE}: $NXT_BUILD_DIR/${NXT_PERL_MODULE}.unit.so $NXT_BUILD_DIR/${NXT_PERL_MODULE}.unit.so: $nxt_objs \$(NXT_MODULE_LINK) -o $NXT_BUILD_DIR/${NXT_PERL_MODULE}.unit.so \\ - $nxt_objs $NXT_PERL_LIBS $NXT_LD_OPT + $nxt_objs $NXT_PERL_LDOPTS $NXT_LD_OPT install: ${NXT_PERL_MODULE}-install -- cgit From 242dc363ced8d244ff296e1c3c8f802b4857fd35 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 17 Jul 2019 21:17:30 +0300 Subject: Perl: propagated compile options from perl build. Some Perl compile options affects ABI and not using them while compiling our module resulted in non-working build. Notably on 32-bit Debian 10, Perl is built with -D_FILE_OFFSET_BITS=64 and our module after being compiled without this option caused segmentation faults in unexpected places. --- auto/modules/perl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'auto') diff --git a/auto/modules/perl b/auto/modules/perl index 904a5055..a4fd5437 100644 --- a/auto/modules/perl +++ b/auto/modules/perl @@ -57,6 +57,7 @@ nxt_found=no if /bin/sh -c "$NXT_PERL -MConfig -e 'print \"Perl version: \", \$Config{version}, \"\\n\"'" >> $NXT_AUTOCONF_ERR 2>&1; then + NXT_PERL_CFLAGS=`$NXT_PERL -MExtUtils::Embed -e ccflags | sed -e 's/^ //;s/ $//'` NXT_PERL_INCLUDE=`$NXT_PERL -MExtUtils::Embed -e perl_inc | sed -e 's/^ //;s/ $//'` NXT_PERL_LDOPTS=`$NXT_PERL -MExtUtils::Embed -e ldopts | sed -e 's/^ //;s/ $//'` @@ -165,7 +166,7 @@ for nxt_src in $NXT_PERL_MODULE_SRCS; do $NXT_BUILD_DIR/$nxt_obj: $nxt_src mkdir -p $NXT_BUILD_DIR/src/perl - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PERL_INCLUDE \\ + \$(CC) -c \$(CFLAGS) $NXT_PERL_CFLAGS \$(NXT_INCS) $NXT_PERL_INCLUDE \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post -- cgit From e501c74ddceab86e48c031ca9b5e154f52dcdae0 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 20 Aug 2019 16:31:53 +0300 Subject: Introducing websocket support in router and libunit. --- auto/make | 24 ++++++++++++++++++++++-- auto/modules/go | 1 + auto/sources | 5 +++++ 3 files changed, 28 insertions(+), 2 deletions(-) (limited to 'auto') diff --git a/auto/make b/auto/make index 1eee2a78..44d0bdfc 100644 --- a/auto/make +++ b/auto/make @@ -57,6 +57,7 @@ $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 +$echo " $NXT_BUILD_DIR/src/nxt_websocket.o \\" >> $NXT_MAKEFILE for nxt_src in $NXT_LIB_UNIT_SRCS do @@ -108,7 +109,9 @@ END # Object files. for nxt_src in $NXT_LIB_SRCS $NXT_TEST_SRCS $NXT_LIB_UNIT_SRCS \ - src/test/nxt_unit_app_test.c + src/test/nxt_unit_app_test.c \ + src/test/nxt_unit_websocket_chat.c \ + src/test/nxt_unit_websocket_echo.c do nxt_obj=${nxt_src%.c}.o nxt_dep=${nxt_src%.c}.dep @@ -150,7 +153,8 @@ if [ $NXT_TESTS = YES ]; then .PHONY: tests tests: $NXT_BUILD_DIR/tests $NXT_BUILD_DIR/utf8_file_name_test \\ - $NXT_BUILD_DIR/unit_app_test + $NXT_BUILD_DIR/unit_app_test $NXT_BUILD_DIR/unit_websocket_chat \\ + $NXT_BUILD_DIR/unit_websocket_echo $NXT_BUILD_DIR/tests: \$(NXT_TEST_OBJS) \\ $NXT_BUILD_DIR/$NXT_LIB_STATIC @@ -174,6 +178,22 @@ $NXT_BUILD_DIR/unit_app_test: $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 +$NXT_BUILD_DIR/unit_websocket_chat: \\ + $NXT_BUILD_DIR/src/test/nxt_unit_websocket_chat.o \\ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + \$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/unit_websocket_chat \\ + \$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_unit_websocket_chat.o \\ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\ + $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS + +$NXT_BUILD_DIR/unit_websocket_echo: \\ + $NXT_BUILD_DIR/src/test/nxt_unit_websocket_echo.o \\ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC + \$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/unit_websocket_echo \\ + \$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_unit_websocket_echo.o \\ + $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\ + $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS + END else diff --git a/auto/modules/go b/auto/modules/go index 62c3743f..51b5979d 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -107,6 +107,7 @@ ${NXT_GO}-install-src: ${NXT_VERSION_H} 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 \ + ./src/nxt_websocket.c \ \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit/ ${NXT_GO}-install-build: ${NXT_GO}-install-src diff --git a/auto/sources b/auto/sources index 4c4fd742..8ac8fb19 100644 --- a/auto/sources +++ b/auto/sources @@ -86,6 +86,11 @@ NXT_LIB_SRCS=" \ src/nxt_application.c \ src/nxt_external.c \ src/nxt_port_hash.c \ + src/nxt_sha1.c \ + src/nxt_websocket.c \ + src/nxt_websocket_accept.c \ + src/nxt_http_websocket.c \ + src/nxt_h1proto_websocket.c \ " NXT_LIB_SRC0=" \ -- cgit