Skip to content

Commit 88dedd4

Browse files
authored
quickjs: add the engine (#156)
* quickjs: add the engine QuickJS version 2024-01-13 (...) 14 4.403 NJS configuration summary: 14 4.403 14 4.403 + using CC: "cc" 14 4.403 + using CFLAGS: " -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-prototypes -Werror -g -fexcess-precision=standard -I /usr/src/quickjs " 14 4.403 14 4.403 + using PCRE library: -lpcre 14 4.403 + using readline library: -ledit 14 4.403 + using QuickJS library: -lquickjs -lm -ldl -lpthread 14 4.403 + using OpenSSL library: -lcrypto 14 4.403 + using libxml2 library: -lxml2 14 4.403 + using zlib library: -L/lib -lz 14 4.403 14 4.403 njs build dir: build 14 4.403 njs CLI: build/njs (...) 15 8.768 adding module in /usr/src/njs/nginx 15 8.769 checking for QuickJS library -lquickjs.lto ... not found 15 8.829 checking for QuickJS library -lquickjs ... found 15 8.984 checking for QuickJS JS_NewTypedArray() ... found 15 9.072 enabled QuickJS engine 15 9.072 enabled webcrypto module 15 9.073 enabled xml module 15 9.074 enabled zlib module 15 9.075 + ngx_js_module was configured * Ecbo the quickjs version * Update Dockerfile * Update Dockerfile
1 parent f1282cd commit 88dedd4

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

Dockerfile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,14 @@ RUN \
120120
&& apk add --no-cache --virtual .geoip2-build-deps \
121121
libmaxminddb-dev \
122122
&& apk add --no-cache --virtual .njs-build-deps \
123-
readline-dev
123+
libedit-dev \
124+
libxml2-dev \
125+
libxslt-dev \
126+
openssl-dev \
127+
pcre-dev \
128+
readline-dev \
129+
zlib-dev \
130+
&& git config --global init.defaultBranch master
124131

125132
WORKDIR /usr/src/
126133

@@ -164,22 +171,29 @@ RUN \
164171
echo "Downloading ngx_http_geoip2_module ..." \
165172
&& git clone --depth 1 --branch ${GEOIP2_VERSION} https://github.com/leev/ngx_http_geoip2_module /usr/src/ngx_http_geoip2_module
166173

174+
RUN \
175+
echo "Cloning and configuring quickjs ..." \
176+
&& cd /usr/src \
177+
&& git clone https://github.com/bellard/quickjs quickjs \
178+
&& cd quickjs \
179+
&& make libquickjs.a \
180+
&& echo "quickjs $(cat VERSION)"
181+
167182
RUN \
168183
echo "Cloning and configuring njs ..." \
169-
&& mkdir /usr/src/njs \
170-
&& cd /usr/src/njs \
184+
&& mkdir /usr/src/njs && cd /usr/src/njs \
171185
&& git init \
172186
&& git remote add origin https://github.com/nginx/njs.git \
173187
&& git fetch --depth 1 origin ${NJS_COMMIT} \
174188
&& git checkout -q FETCH_HEAD \
175-
&& ./configure \
189+
&& ./configure --cc-opt='-I /usr/src/quickjs' --ld-opt="-L /usr/src/quickjs" \
176190
&& make njs \
177191
&& mv /usr/src/njs/build/njs /usr/sbin/njs \
178192
&& echo "njs v$(njs -v)"
179193

180194
# https://github.com/macbre/docker-nginx-http3/issues/152
181-
ARG CC_OPT='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects'
182-
ARG LD_OPT='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto'
195+
ARG CC_OPT='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -I /usr/src/quickjs'
196+
ARG LD_OPT='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -L /usr/src/quickjs'
183197
RUN \
184198
echo "Building nginx ..." \
185199
&& mkdir -p /var/run/nginx/ \

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ configure arguments:
8282
--add-module=/usr/src/headers-more-nginx-module-0.37
8383
--add-module=/usr/src/njs/nginx
8484
--add-dynamic-module=/usr/src/ngx_http_geoip2_module
85-
--with-cc-opt='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects'
86-
--with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto'
85+
--with-cc-opt='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -I /usr/src/quickjs'
86+
--with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -L /usr/src/quickjs'
8787
8888
$ docker run -it macbre/nginx-http3 njs -v
8989
0.8.7

0 commit comments

Comments
 (0)