Skip to content

Commit b60b325

Browse files
committed
auto/quickjs, nginx/config: Used pkg-config to find quickjs-ng
In QuickJS-NG since 8e671eb8e59f5f5d7eca111386fbe158fab09049 ("build: initial support for meson build system")[1], Meson can be used as a build system, generating .pc (pkg-config) modules. This commit adds another method of QuickJS-NG discovery using pkg-config. [1]: quickjs-ng/quickjs@8e671eb Signed-off-by: Zurab Kvachadze <[email protected]>
1 parent 4842185 commit b60b325

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

auto/quickjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ NJS_QUICKJS_LIB=
77
NJS_HAVE_QUICKJS=NO
88
NJS_QUICKJS_DEFAULT_INCS="src $NJS_BUILD_DIR"
99

10+
# Alternative pkg-config binary can be supplied by setting the PKG_CONFIG
11+
# environment variable.
12+
: "${PKG_CONFIG:=pkg-config}"
13+
1014
if [ $NJS_TRY_QUICKJS = YES ]; then
1115
njs_found=no
1216

@@ -57,6 +61,20 @@ if [ $NJS_TRY_QUICKJS = YES ]; then
5761
. auto/feature
5862
fi
5963

64+
if [ $ngx_found = no ]; then
65+
ngx_feature="QuickJS-NG library via pkg-config"
66+
67+
flags="$("${PKG_CONFIG}" --cflags-only-I quickjs-ng)"
68+
# Trim the -I prefix from includes.
69+
pkg_config_includes="$(printf "%s\n" "$flags" | sed 's|-I||g')"
70+
pkg_config_libs="$("${PKG_CONFIG}" --libs quickjs-ng)"
71+
72+
ngx_feature_incs="$NJS_QUICKJS_DEFAULT_INCS ${pkg_config_includes}"
73+
ngx_feature_libs="-lm -ldl -lpthread ${pkg_config_libs}"
74+
75+
. auto/feature
76+
fi
77+
6078

6179
if [ $njs_found = yes ]; then
6280

nginx/config

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ NJS_QUICKJS_INC=
2626
NJS_QUICKJS_DEFAULT_INCS="$ngx_addon_dir/../src $ngx_addon_dir/../build"
2727
NJS_HAVE_QUICKJS=
2828

29+
# Alternative pkg-config binary can be supplied by setting the PKG_CONFIG
30+
# environment variable.
31+
: "${PKG_CONFIG:=pkg-config}"
32+
2933
if [ $NJS_QUICKJS != NO ]; then
3034

3135
ngx_feature="QuickJS library -lquickjs.lto"
@@ -71,6 +75,21 @@ if [ $NJS_QUICKJS != NO ]; then
7175
. auto/feature
7276
fi
7377

78+
if [ $ngx_found = no ]; then
79+
ngx_feature="QuickJS-NG library via pkg-config"
80+
81+
flags="$("${PKG_CONFIG}" --cflags-only-I quickjs-ng)"
82+
# Trim the -I prefix from includes.
83+
pkg_config_includes="$(printf "%s\n" "$flags" | sed 's|-I||g')"
84+
pkg_config_libs="$("${PKG_CONFIG}" --libs quickjs-ng)"
85+
86+
ngx_feature_path="$NJS_QUICKJS_DEFAULT_INCS ${pkg_config_includes}"
87+
ngx_feature_libs="-lm -ldl -lpthread ${pkg_config_libs}"
88+
89+
. auto/feature
90+
fi
91+
92+
7493
if [ $ngx_found = yes ]; then
7594

7695
ngx_feature="QuickJS JS_GetClassID()"

0 commit comments

Comments
 (0)