This repository was archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig
More file actions
90 lines (63 loc) · 2.16 KB
/
config
File metadata and controls
90 lines (63 loc) · 2.16 KB
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
ngx_addon_name=ngx_http_nodejs_module
nodejs_flags="-std=c++17"
nodejs_link_version=node
SYSTEM_NODE=0
libnode_path=`ldconfig -p 2>/dev/null | grep libnode.so$ | awk '{ print $4 }'`
if test "$libnode_path" != ""; then
SYSTEM_NODE=1
nodejs_include="/usr/include/libnode"
fi
if test "$SYSTEM_NODE" = 0; then
echo 'Could not find system nodejs-libs (libnode.so) - linking from source'
nodejs_dir="$ngx_addon_dir/ext/node-v18.16.1"
if test ! -d "$nodejs_dir/out/Release"; then
if test "$NUMCPUS" = ""; then
NUMCPUS=`nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo Failed to detect number of CPUs, please export NUMCPUS=n || echo 1`
fi
mkdir -p ext
pushd $nodejs_dir
wget "https://nodejs.org/dist/v18.16.1/node-v18.16.1.tar.gz" && tar -xf ./nodejs-18.16.1.tar.gz && rm ./nodejs-18.16.1.tar.gz || (echo Failed to download node && exit 1)
popd
if test ! -d "$nodejs_dir/tools"; then
echo Configuring Node
./configure --enable-static
fi
echo Making node
make -j$NUMCPUS
else
echo libnode was found locally
fi
nodejs_link_version=node.108
nodejs_include="\
$ngx_addon_dir/ext/node-v18.16.1/deps/uv/include \
$ngx_addon_dir/ext/node-v18.16.1/deps/v8/include \
$ngx_addon_dir/ext/node-v18.16.1/src"
libnode_path=${ngx_addon_dir}/ext/node-v18.16.1/out/Release
fi
nodejs_libs="-L${libnode_path} -lstdc++ $nodejs_flags -lpthread -lz -l${nodejs_link_version}"
ngx_feature="node"
ngx_feature_run=no
ngx_feature_path="$nodejs_include"
ngx_feature_libs="$nodejs_libs"
ngx_feature_incs="
#include <node.h>
#include <node_api.h>
#include <cstring>
"
ngx_feature_test="
std::unique_ptr<node::MultiIsolatePlatform> platform =
node::MultiIsolatePlatform::Create(4);
v8::V8::InitializePlatform(platform.get());
"
. "$ngx_addon_dir/cpp_feature"
ngx_module_type=HTTP
ngx_module_name=$ngx_addon_name
ngx_module_incs="$nodejs_include"
ngx_module_deps=""
ngx_module_srcs=" $ngx_addon_dir/ngx_http_nodejs_module.cpp "
ngx_module_libs="$nodejs_libs"
echo $OSTYPE | grep darwin -q && export ngx_modext=".dylib"
. auto/module
NODE_NGX_SRCS="$ngx_module_srcs"
CXXFLAGS="$CXXFLAGS $nodejs_flags"
# HTTP_MODULES="$HTTP_MODULES ngx_http_nodejs_module"