From 8e9a4663dcfda31ace7fc6014d36267a7def9e09 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Thu, 22 Oct 2026 07:14:14 -0700 Subject: [PATCH] Configure: fix pkg-config paths for absolute build directories The generated njs.pc prepends the source directory to an absolute build directory, producing invalid include and library paths. Preserve absolute build paths and resolve only relative ones against the source directory. This also supports engine builds embedded in nginx without changing the standalone CLI configuration. --- auto/make | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/auto/make b/auto/make index 56963293..dacb610e 100644 --- a/auto/make +++ b/auto/make @@ -439,14 +439,20 @@ ts_clean: END # pkg-config file +njs_pc_build_dir=$NJS_BUILD_DIR +case "$njs_pc_build_dir" in + /*) ;; + *) njs_pc_build_dir="$(pwd)/$njs_pc_build_dir" ;; +esac + cat << END >> $NJS_MAKEFILE pc: $NJS_BUILD_DIR/njs.pc $NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h - sed -e "s#@PREFIX@#$(pwd)/$NJS_BUILD_DIR#" \\ - -e "s#@LIBDIR@#$(pwd)/$NJS_BUILD_DIR#" \\ - -e "s#@CFLAGS@#-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src#" \\ + sed -e "s#@PREFIX@#$njs_pc_build_dir#" \\ + -e "s#@LIBDIR@#$njs_pc_build_dir#" \\ + -e "s#@CFLAGS@#-I$njs_pc_build_dir -I$(pwd)/src#" \\ -e "s#@VERSION@#\$(NJS_VER)#" \\ -e "s#@EXTRA_LIBS@#-lm $NJS_LIBS $NJS_LIB_AUX_LIBS#" \\ src/njs.pc.in > \$@ -- 2.47.3