From 0326cefef518acc053718063019189b21dc26d32 Mon Sep 17 00:00:00 2001 From: Tiago Natel de Moura Date: Tue, 23 Jun 2020 11:01:20 +0100 Subject: Python: fixed interpreter path in ./configure. --- auto/modules/python | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'auto/modules') diff --git a/auto/modules/python b/auto/modules/python index ad862f3c..ab314013 100644 --- a/auto/modules/python +++ b/auto/modules/python @@ -68,7 +68,6 @@ if /bin/sh -c "$NXT_PYTHON_CONFIG --prefix" >> $NXT_AUTOCONF_ERR 2>&1; then NXT_PYTHON_CONFIG="${NXT_PYTHON_CONFIG} --embed" fi - NXT_PYTHON_EXEC=`${NXT_PYTHON_CONFIG} --exec-prefix`/bin/${NXT_PYTHON} NXT_PYTHON_INCLUDE=`${NXT_PYTHON_CONFIG} --includes` NXT_PYTHON_LIBS=`${NXT_PYTHON_CONFIG} --ldflags` @@ -133,7 +132,7 @@ fi NXT_PYTHON_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_python_mounts.h -$NXT_PYTHON_EXEC -c 'import os.path +$NXT_PYTHON -c 'import os.path import sys pyver = "python" + str(sys.version_info[0]) + "." + str(sys.version_info[1]) -- cgit From f3471c29c0870cffff3d96c1c50c88c47a4d8009 Mon Sep 17 00:00:00 2001 From: Tiago Natel de Moura Date: Tue, 28 Jul 2020 16:17:18 +0100 Subject: PHP: fixed version comparison in configure script. Some PPAs for Ubuntu package PHP with versions like: 7.2.28-3+ubuntu18.04.1+deb.sury.org+1 But the script expected only "X.Y.Z". The issue was introduced in: http://hg.nginx.org/unit/rev/2ecb15904ba5 --- auto/modules/php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'auto/modules') diff --git a/auto/modules/php b/auto/modules/php index 2cec2f44..75d60242 100644 --- a/auto/modules/php +++ b/auto/modules/php @@ -77,8 +77,8 @@ if /bin/sh -c "${NXT_PHP_CONFIG} --version" >> $NXT_AUTOCONF_ERR 2>&1; then $echo " + PHP SAPI: [`${NXT_PHP_CONFIG} --php-sapis`]" NXT_PHP_MAJOR_VERSION=${NXT_PHP_VERSION%%.*} - NXT_PHP_MINOR_VERSION=${NXT_PHP_VERSION#??} - NXT_PHP_MINOR_VERSION=${NXT_PHP_MINOR_VERSION%.*} + NXT_PHP_MINOR_VERSION=${NXT_PHP_VERSION#*.} + NXT_PHP_MINOR_VERSION=${NXT_PHP_MINOR_VERSION%%.*} if [ $NXT_PHP_MAJOR_VERSION = 5 -a $NXT_PHP_MINOR_VERSION -lt 4 ]; then NXT_PHP_ADDITIONAL_FLAGS=-Wno-write-strings -- cgit From b28b4459b0899cb8357df5f6c1e904fd1a34ebe3 Mon Sep 17 00:00:00 2001 From: Tiago Natel de Moura Date: Fri, 31 Jul 2020 12:21:21 +0100 Subject: Isolation: fixed the generation of mounts table. Since the introduction of rootfs feature, some language modules can't be configured multiple times. Now the configure generates a separate nxt__mounts.h for each module compiled. --- auto/modules/java | 9 ++++++--- auto/modules/python | 9 +++++---- auto/modules/ruby | 15 +++++++++------ 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'auto/modules') diff --git a/auto/modules/java b/auto/modules/java index a3b1b958..fa68f573 100644 --- a/auto/modules/java +++ b/auto/modules/java @@ -227,7 +227,6 @@ NXT_JAVA_INSTALL_JARS= NXT_JAVA_UNINSTALL_JARS= NXT_JAVA_JARS=$NXT_BUILD_DIR/$NXT_JAVA_MODULE/nxt_jars.h -NXT_JAVA_MOUNTS_HEADER=$NXT_BUILD_DIR/$NXT_JAVA_MODULE/nxt_java_mounts.h mkdir -p $NXT_BUILD_DIR/$NXT_JAVA_MODULE cat << END > $NXT_JAVA_JARS @@ -318,7 +317,10 @@ NXT_JAVA_LIBC_DIR=`ldd "$NXT_JAVA_LIBJVM" | grep libc.so | cut -d' ' -f3` NXT_JAVA_LIBC_DIR=`dirname $NXT_JAVA_LIBC_DIR` fi -cat << END > $NXT_JAVA_MOUNTS_HEADER + +NXT_JAVA_MOUNTS_HEADER=nxt_${NXT_JAVA_MODULE}_mounts.h + +cat << END > $NXT_BUILD_DIR/$NXT_JAVA_MOUNTS_HEADER #ifndef _NXT_JAVA_MOUNTS_H_INCLUDED_ #define _NXT_JAVA_MOUNTS_H_INCLUDED_ @@ -371,7 +373,8 @@ for nxt_src in $NXT_JAVA_MODULE_SRCS; do $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H mkdir -p $NXT_BUILD_DIR/src/java - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_JAVA_INCLUDE \\ + \$(CC) -c \$(CFLAGS) -DNXT_JAVA_MOUNTS_H=\"$NXT_JAVA_MOUNTS_HEADER\" \\ + \$(NXT_INCS) $NXT_JAVA_INCLUDE \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post diff --git a/auto/modules/python b/auto/modules/python index ab314013..c14bf7e0 100644 --- a/auto/modules/python +++ b/auto/modules/python @@ -130,13 +130,13 @@ if grep ^$NXT_PYTHON_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then fi -NXT_PYTHON_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_python_mounts.h +NXT_PYTHON_MOUNTS_HEADER=nxt_${NXT_PYTHON_MODULE}_mounts.h $NXT_PYTHON -c 'import os.path import sys pyver = "python" + str(sys.version_info[0]) + "." + str(sys.version_info[1]) -print("static const nxt_fs_mount_t nxt_python%d%d_mounts[] = {" % (sys.version_info[0], sys.version_info[1])) +print("static const nxt_fs_mount_t nxt_python_mounts[] = {") pattern = "{(u_char *) \"%s\", (u_char *) \"%s\", (u_char *) \"bind\", NXT_MS_BIND|NXT_MS_REC, NULL}," base = None @@ -157,7 +157,7 @@ for p in sys.path: print("};\n\n") -' >> $NXT_PYTHON_MOUNTS_HEADER +' > $NXT_BUILD_DIR/$NXT_PYTHON_MOUNTS_HEADER $echo " + Python module: ${NXT_PYTHON_MODULE}.unit.so" @@ -185,7 +185,8 @@ for nxt_src in $NXT_PYTHON_MODULE_SRCS; do cat << END >> $NXT_MAKEFILE $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\ + \$(CC) -c \$(CFLAGS) -DNXT_PYTHON_MOUNTS_H=\"$NXT_PYTHON_MOUNTS_HEADER\" \\ + \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post diff --git a/auto/modules/ruby b/auto/modules/ruby index f7334cc7..5cead26b 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -51,7 +51,6 @@ $echo "configuring Ruby module ..." >> $NXT_AUTOCONF_ERR NXT_RUBY=${NXT_RUBY=ruby} NXT_RUBY_MODULE=${NXT_RUBY_MODULE=${NXT_RUBY}} -NXT_RUBY_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_ruby_mounts.h nxt_found=no @@ -145,7 +144,10 @@ if grep ^$NXT_RUBY_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then fi -cat << END > $NXT_RUBY_MOUNTS_HEADER +NXT_RUBY_MOUNTS_HEADER=nxt_${NXT_RUBY_MODULE}_mounts.h +NXT_RUBY_MOUNTS_PATH=$NXT_BUILD_DIR/$NXT_RUBY_MOUNTS_HEADER + +cat << END > $NXT_RUBY_MOUNTS_PATH static const nxt_fs_mount_t nxt_ruby_mounts[] = { {(u_char *) "$NXT_RUBY_RUBYHDRDIR", (u_char *) "$NXT_RUBY_RUBYHDRDIR", @@ -166,11 +168,11 @@ static const nxt_fs_mount_t nxt_ruby_mounts[] = { END for path in `echo $NXT_RUBY_GEMPATH | tr ':' '\n'`; do - $echo "{(u_char *) \"$path\", (u_char *) \"$path\"," >> $NXT_RUBY_MOUNTS_HEADER - $echo "(u_char *) \"bind\", NXT_MS_BIND | NXT_MS_REC, NULL}," >> $NXT_RUBY_MOUNTS_HEADER + $echo "{(u_char *) \"$path\", (u_char *) \"$path\"," >> $NXT_RUBY_MOUNTS_PATH + $echo "(u_char *) \"bind\", NXT_MS_BIND | NXT_MS_REC, NULL}," >> $NXT_RUBY_MOUNTS_PATH done -$echo "};" >> $NXT_RUBY_MOUNTS_HEADER +$echo "};" >> $NXT_RUBY_MOUNTS_PATH $echo " + Ruby module: ${NXT_RUBY_MODULE}.unit.so" @@ -200,7 +202,8 @@ for nxt_src in $NXT_RUBY_MODULE_SRCS; do $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H mkdir -p $NXT_BUILD_DIR/src/ruby - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_RUBY_INCPATH \\ + \$(CC) -c \$(CFLAGS) -DNXT_RUBY_MOUNTS_H=\"$NXT_RUBY_MOUNTS_HEADER\" \\ + \$(NXT_INCS) $NXT_RUBY_INCPATH \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post -- cgit From 0d7a6885a32e01a1d6986f9b77a57f101cd3e8d9 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Sat, 8 Aug 2020 23:52:31 +0300 Subject: Configure: verifying the Ruby library path. An attempt to build a Ruby module for a custom Ruby installation that has the same major version as the system Ruby may unexpectedly cause the use of the system Ruby library. This closes #449 issue on GitHub. --- auto/modules/ruby | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'auto/modules') diff --git a/auto/modules/ruby b/auto/modules/ruby index 5cead26b..f5384f98 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -70,25 +70,31 @@ if /bin/sh -c "$NXT_RUBY -v" >> $NXT_AUTOCONF_ERR 2>&1; then NXT_RUBY_LIBNAME=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["RUBY_SO_NAME"])'` NXT_RUBY_LIBSCONF=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["LIBS"])'` + NXT_RUBY_LIBPATH=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["libdir"])'` NXT_RUBY_LIBS="-l$NXT_RUBY_LIBNAME $NXT_RUBY_LIBSCONF" nxt_feature="Ruby library" nxt_feature_name="" - nxt_feature_run=no + nxt_feature_run=value nxt_feature_incs="${NXT_RUBY_INCPATH}" nxt_feature_libs="${NXT_RUBY_LIBS}" nxt_feature_test=" #include int main() { + static const char *argv[3] = { + \"NGINX_Unit\", \"-rrbconfig\", + \"-eprint RbConfig::CONFIG['libdir']\" + }; + + RUBY_INIT_STACK; ruby_init(); - return ruby_cleanup(0); + return ruby_run_node(ruby_options(3, (char **) argv)); }" . auto/feature - if [ $nxt_found = no ]; then - NXT_RUBY_LIBPATH=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["libdir"])'` + if [ "$nxt_feature_value" != "$NXT_RUBY_LIBPATH" ]; then NXT_RUBY_LIBS="-L$NXT_RUBY_LIBPATH -Wl,-rpath,${NXT_RUBY_LIBPATH} $NXT_RUBY_LIBS" nxt_feature="Ruby library in $NXT_RUBY_LIBPATH" -- cgit From 7e1d800f08f365dd3be7cd614d0fac01ca16ad28 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Sun, 9 Aug 2020 01:00:44 +0300 Subject: Ruby: removed unused variable from ./configure script. --- auto/modules/ruby | 1 - 1 file changed, 1 deletion(-) (limited to 'auto/modules') diff --git a/auto/modules/ruby b/auto/modules/ruby index f5384f98..7c3f8328 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -58,7 +58,6 @@ if /bin/sh -c "$NXT_RUBY -v" >> $NXT_AUTOCONF_ERR 2>&1; then NXT_RUBY_RUBYHDRDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubyhdrdir"])'` NXT_RUBY_ARCHHDRDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubyarchhdrdir"])'` - NXT_RUBY_SITEARCHDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["sitearchhdrdir"])'` NXT_RUBY_SITEDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["sitedir"])'` NXT_RUBY_LIBDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubylibdir"])'` NXT_RUBY_TOPDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["topdir"])'` -- cgit From 317fabc83e7ef7c423a64388de67ea851115b1b9 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Sun, 9 Aug 2020 01:00:44 +0300 Subject: Ruby: simplified commands in ./configure script. There is no reason to use printf instead of just print. No functional changes. --- auto/modules/ruby | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'auto/modules') diff --git a/auto/modules/ruby b/auto/modules/ruby index 7c3f8328..bf628935 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -56,20 +56,20 @@ nxt_found=no if /bin/sh -c "$NXT_RUBY -v" >> $NXT_AUTOCONF_ERR 2>&1; then - NXT_RUBY_RUBYHDRDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubyhdrdir"])'` - NXT_RUBY_ARCHHDRDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubyarchhdrdir"])'` - NXT_RUBY_SITEDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["sitedir"])'` - NXT_RUBY_LIBDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubylibdir"])'` - NXT_RUBY_TOPDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["topdir"])'` - NXT_RUBY_PREFIXDIR=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["rubylibprefix"])'` + NXT_RUBY_RUBYHDRDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubyhdrdir"]'` + NXT_RUBY_ARCHHDRDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubyarchhdrdir"]'` + NXT_RUBY_SITEDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["sitedir"]'` + NXT_RUBY_LIBDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"]'` + NXT_RUBY_TOPDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["topdir"]'` + NXT_RUBY_PREFIXDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubylibprefix"]'` NXT_RUBY_GEMDIR=`gem environment gemdir` NXT_RUBY_GEMPATH=`gem environment gempath` NXT_RUBY_INCPATH="-I$NXT_RUBY_ARCHHDRDIR -I$NXT_RUBY_RUBYHDRDIR" - NXT_RUBY_LIBNAME=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["RUBY_SO_NAME"])'` - NXT_RUBY_LIBSCONF=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["LIBS"])'` - NXT_RUBY_LIBPATH=`$NXT_RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG["libdir"])'` + NXT_RUBY_LIBNAME=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["RUBY_SO_NAME"]'` + NXT_RUBY_LIBSCONF=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["LIBS"]'` + NXT_RUBY_LIBPATH=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["libdir"]'` NXT_RUBY_LIBS="-l$NXT_RUBY_LIBNAME $NXT_RUBY_LIBSCONF" nxt_feature="Ruby library" -- cgit From 91280b4c0b3ec0721a8f3ba09a1cc9f5ca56c238 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Sun, 9 Aug 2020 01:00:44 +0300 Subject: Ruby: fixed gem mount paths. The gem paths must depend on the specified interpreter. Also, gemdir looks redundant as it's already included in Gem.default_path(). --- auto/modules/ruby | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'auto/modules') diff --git a/auto/modules/ruby b/auto/modules/ruby index bf628935..c1444f07 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -62,8 +62,8 @@ if /bin/sh -c "$NXT_RUBY -v" >> $NXT_AUTOCONF_ERR 2>&1; then NXT_RUBY_LIBDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"]'` NXT_RUBY_TOPDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["topdir"]'` NXT_RUBY_PREFIXDIR=`$NXT_RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubylibprefix"]'` - NXT_RUBY_GEMDIR=`gem environment gemdir` - NXT_RUBY_GEMPATH=`gem environment gempath` + + NXT_RUBY_GEMPATH=`$NXT_RUBY -rrubygems -e 'print Gem.default_path().join(":")'` NXT_RUBY_INCPATH="-I$NXT_RUBY_ARCHHDRDIR -I$NXT_RUBY_RUBYHDRDIR" @@ -163,8 +163,6 @@ static const nxt_fs_mount_t nxt_ruby_mounts[] = { (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, {(u_char *) "$NXT_RUBY_LIBDIR", (u_char *) "$NXT_RUBY_LIBDIR", (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, - {(u_char *) "$NXT_RUBY_GEMDIR", (u_char *) "$NXT_RUBY_GEMDIR", - (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, {(u_char *) "$NXT_RUBY_TOPDIR", (u_char *) "$NXT_RUBY_TOPDIR", (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, {(u_char *) "$NXT_RUBY_PREFIXDIR", (u_char *) "$NXT_RUBY_PREFIXDIR", -- cgit