1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
ngx_addon_name="ngx_js_module"
NJS_OPENSSL=${NJS_OPENSSL:-YES}
NJS_LIBXSLT=${NJS_LIBXSLT:-YES}
NJS_ZLIB=${NJS_ZLIB:-YES}
NJS_QUICKJS=${NJS_QUICKJS:-YES}
NJS_DEPS="$ngx_addon_dir/ngx_js.h \
$ngx_addon_dir/ngx_js_fetch.h \
$ngx_addon_dir/ngx_js_shared_dict.h"
NJS_SRCS="$ngx_addon_dir/ngx_js.c \
$ngx_addon_dir/ngx_js_fetch.c \
$ngx_addon_dir/ngx_js_regex.c \
$ngx_addon_dir/ngx_js_shared_dict.c"
QJS_DEPS=""
QJS_SRCS=""
NJS_OPENSSL_LIB=
NJS_XSLT_LIB=
NJS_ZLIB_LIB=
NJS_QUICKJS_LIB=
NJS_QUICKJS_INC=
NJS_HAVE_QUICKJS=
if [ $NJS_QUICKJS != NO ]; then
ngx_feature="QuickJS library -lquickjs.lto"
ngx_feature_name=NJS_HAVE_QUICKJS
ngx_feature_run=yes
ngx_feature_incs="#if defined(__GNUC__) && (__GNUC__ >= 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored \"-Wcast-function-type\"
#endif
#include <quickjs.h>"
ngx_feature_path=""
ngx_feature_libs="-lquickjs.lto -lm -ldl -lpthread"
ngx_feature_test="JSRuntime *rt;
rt = JS_NewRuntime();
(void) JS_GetClassID;
JS_FreeRuntime(rt);
return 0;"
. auto/feature
if [ $ngx_found = no ]; then
ngx_feature="QuickJS library -lquickjs"
ngx_feature_libs="-lquickjs -lm -ldl -lpthread"
. auto/feature
fi
if [ $ngx_found = no ]; then
ngx_feature="QuickJS library -I/usr/include/quickjs/ -L/usr/lib/quickjs/ -lquickjs.lto"
ngx_feature_path="/usr/include/quickjs/"
ngx_feature_libs="-L/usr/lib/quickjs/ -lquickjs.lto -lm -ldl -lpthread"
. auto/feature
fi
if [ $ngx_found = no ]; then
ngx_feature="QuickJS library -I/usr/include/quickjs/ -L/usr/lib/quickjs/ -lquickjs"
ngx_feature_libs="-L/usr/lib/quickjs/ -lquickjs -lm -ldl -lpthread"
. auto/feature
fi
if [ $ngx_found = yes ]; then
ngx_feature="QuickJS JS_NewTypedArray()"
ngx_feature_test="(void) JS_NewTypedArray;
return 0;"
. auto/feature
if [ $ngx_found = yes ]; then
have=NJS_HAVE_QUICKJS_NEW_TYPED_ARRAY . auto/have
fi
NJS_HAVE_QUICKJS=YES
NJS_QUICKJS_LIB="$ngx_feature_libs"
NJS_QUICKJS_INC="$ngx_feature_path"
echo " enabled QuickJS engine"
fi
fi
if [ $NJS_OPENSSL != NO ]; then
NJS_OPENSSL_LIB=OPENSSL
have=NJS_HAVE_OPENSSL . auto/have
NJS_SRCS="$NJS_SRCS $ngx_addon_dir/../external/njs_webcrypto_module.c"
echo " enabled webcrypto module"
fi
if [ $NJS_LIBXSLT != NO ]; then
NJS_XSLT_LIB=LIBXSLT
have=NJS_HAVE_XML . auto/have
NJS_SRCS="$NJS_SRCS $ngx_addon_dir/../external/njs_xml_module.c"
echo " enabled xml module"
fi
if [ $NJS_ZLIB != NO ]; then
NJS_ZLIB_LIB=ZLIB
have=NJS_HAVE_ZLIB . auto/have
NJS_SRCS="$NJS_SRCS $ngx_addon_dir/../external/njs_zlib_module.c"
if [ "$NJS_HAVE_QUICKJS" = "YES" ]; then
NJS_SRCS="$NJS_SRCS $ngx_addon_dir/../external/qjs_zlib_module.c"
fi
echo " enabled zlib module"
fi
NJS_ENGINE_DEP="$ngx_addon_dir/../build/libnjs.a"
NJS_ENGINE_LIB="$ngx_addon_dir/../build/libnjs.a"
if [ "$NJS_HAVE_QUICKJS" = "YES" ]; then
NJS_ENGINE_DEP="$ngx_addon_dir/../build/libqjs.a"
NJS_ENGINE_LIB="$ngx_addon_dir/../build/libnjs.a $ngx_addon_dir/../build/libqjs.a"
fi
if [ $HTTP != NO ]; then
ngx_module_type=HTTP_AUX_FILTER
ngx_module_name=ngx_http_js_module
ngx_module_incs="$ngx_addon_dir/../src $ngx_addon_dir/../build \
$NJS_QUICKJS_INC"
ngx_module_deps="$NJS_ENGINE_DEP $NJS_DEPS $QJS_DEPS"
ngx_module_srcs="$ngx_addon_dir/ngx_http_js_module.c $NJS_SRCS $QJS_SRCS"
ngx_module_libs="PCRE $NJS_OPENSSL_LIB $NJS_XSLT_LIB $NJS_ZLIB_LIB \
$NJS_QUICKJS_LIB $NJS_ENGINE_LIB -lm"
. auto/module
if [ "$ngx_module_link" != DYNAMIC ]; then
NJS_SRCS=
fi
fi
if [ $STREAM != NO ]; then
ngx_module_type=STREAM
ngx_module_name=ngx_stream_js_module
ngx_module_incs="$ngx_addon_dir/../src $ngx_addon_dir/../build \
$NJS_QUICKJS_INC"
ngx_module_deps="$NJS_ENGINE_DEP $NJS_DEPS $QJS_DEPS"
ngx_module_srcs="$ngx_addon_dir/ngx_stream_js_module.c $NJS_SRCS $QJS_SRCS"
ngx_module_libs="PCRE $NJS_OPENSSL_LIB $NJS_XSLT_LIB $NJS_ZLIB_LIB \
$NJS_QUICKJS_LIB $NJS_ENGINE_LIB -lm"
. auto/module
fi
|