Skip to content

Commit

Permalink
Added a target to generate pkg-config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
thresheek committed Oct 17, 2022
1 parent 36f649b commit edae0c9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
15 changes: 14 additions & 1 deletion auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ default: njs
NJS_LIB_INCS = $njs_incs
NJS_LIB_OBJS = $njs_objs

libnjs: $NJS_BUILD_DIR/libnjs.a
libnjs: $NJS_BUILD_DIR/libnjs.a pc

$NJS_BUILD_DIR/libnjs.a: \\
$NJS_BUILD_DIR/njs_auto_config.h \\
Expand Down Expand Up @@ -314,6 +314,19 @@ ts_clean:
rm -rf $NJS_BUILD_DIR/ts
END

# pkg-config file
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," \\
-e "s,@VERSION@,\$(NJS_VER)," \\
-e "s,@EXTRA_LIBS@,-lm $NJS_LIBS $NJS_LIB_AUX_LIBS," \\
src/njs.pc.in > \$@
END

# Makefile.

Expand Down
8 changes: 8 additions & 0 deletions src/njs.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
prefix=@PREFIX@
libdir=@LIBDIR@

Name: njs
Description: library to embed njs scripting language
Version: @VERSION@
Libs: -L${libdir} -lnjs @EXTRA_LIBS@
Cflags: @CFLAGS@

0 comments on commit edae0c9

Please sign in to comment.