summaryrefslogtreecommitdiffhomepage
path: root/auto/modules
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-04-12 15:53:29 +0100
committerAndrew Clayton <a.clayton@nginx.com>2024-11-15 00:52:38 +0000
commit6c085cfaf4f2244af72d1f98517e2908129120c5 (patch)
treeafce4fb966b10986ba1b5817bc2c1bf69a5ace66 /auto/modules
parenta35517901fb3c7d524739fc4fcf9e531d6404487 (diff)
downloadunit-6c085cfaf4f2244af72d1f98517e2908129120c5.tar.gz
unit-6c085cfaf4f2244af72d1f98517e2908129120c5.tar.bz2
Add a skeleton language module.skel_lm
Module is called 'skel'. Configure with $ ./configure skel Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'auto/modules')
-rw-r--r--auto/modules/conf4
-rw-r--r--auto/modules/skel100
2 files changed, 104 insertions, 0 deletions
diff --git a/auto/modules/conf b/auto/modules/conf
index ab4ed351..0909af34 100644
--- a/auto/modules/conf
+++ b/auto/modules/conf
@@ -41,6 +41,10 @@ case "$nxt_module" in
. auto/modules/wasm-wasi-component
;;
+ skel)
+ . auto/modules/skel
+ ;;
+
*)
echo
echo $0: error: invalid module \"$nxt_module\".
diff --git a/auto/modules/skel b/auto/modules/skel
new file mode 100644
index 00000000..386b61fa
--- /dev/null
+++ b/auto/modules/skel
@@ -0,0 +1,100 @@
+# Copyright (C) NGINX, Inc.
+
+
+shift
+
+if [ ! -f $NXT_AUTOCONF_DATA ]; then
+ echo
+ echo Please run common $0 before configuring module \"$nxt_module\".
+ echo
+ exit 1
+fi
+
+. $NXT_AUTOCONF_DATA
+
+$echo "configuring SKEL module"
+$echo "configuring SKEL module ..." >> $NXT_AUTOCONF_ERR
+
+NXT_SKEL=skel
+NXT_SKEL_MODULE=${NXT_SKEL_MODULE=${NXT_SKEL##*/}}
+
+NXT_SKEL_LDFLAGS=
+NXT_SKEL_ADDITIONAL_FLAGS=
+
+if grep ^$NXT_SKEL_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then
+ $echo
+ $echo $0: error: duplicate \"$NXT_SKEL_MODULE\" module configured.
+ $echo
+ exit 1;
+fi
+
+$echo " + SKEL module: ${NXT_SKEL_MODULE}.unit.so"
+
+. auto/cc/deps
+
+$echo >> $NXT_MAKEFILE
+
+NXT_SKEL_MODULE_SRCS=" \
+ src/skel/nxt_skel.c \
+"
+
+# The skel module object files.
+
+nxt_objs=$NXT_BUILD_DIR/src/nxt_unit.o
+
+for nxt_src in $NXT_SKEL_MODULE_SRCS; do
+
+ nxt_obj=${nxt_src%.c}-$NXT_SKEL_MODULE.o
+ nxt_dep=${nxt_src%.c}-$NXT_SKEL_MODULE.dep
+ nxt_dep_flags=`nxt_gen_dep_flags`
+ nxt_dep_post=`nxt_gen_dep_post`
+ nxt_objs="$nxt_objs $NXT_BUILD_DIR/$nxt_obj"
+
+ cat << END >> $NXT_MAKEFILE
+
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
+ \$(v)mkdir -p $NXT_BUILD_DIR/src/skel
+ \$(PP_CC) \$@
+ \$(v)\$(CC) -c \$(CFLAGS) $NXT_SKEL_ADDITIONAL_FLAGS \$(NXT_INCS) \\
+ $nxt_dep_flags \\
+ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src
+ $nxt_dep_post
+
+-include $NXT_BUILD_DIR/$nxt_dep
+
+END
+
+done
+
+
+cat << END >> $NXT_MAKEFILE
+
+.PHONY: ${NXT_SKEL_MODULE}
+.PHONY: ${NXT_SKEL_MODULE}-install
+.PHONY: ${NXT_SKEL_MODULE}-uninstall
+
+all: ${NXT_SKEL_MODULE}
+
+${NXT_SKEL_MODULE}: $NXT_BUILD_DIR/lib/unit/modules/${NXT_SKEL_MODULE}.unit.so
+
+$NXT_BUILD_DIR/lib/unit/modules/${NXT_SKEL_MODULE}.unit.so: $nxt_objs
+ \$(PP_LD) \$@
+ \$(v)\$(NXT_MODULE_LINK) -o \$@ \\
+ $nxt_objs ${NXT_SKEL_LDFLAGS} $NXT_LD_OPT
+
+
+install: ${NXT_SKEL_MODULE}-install
+
+${NXT_SKEL_MODULE}-install: ${NXT_SKEL_MODULE} install-check
+ install -d \$(DESTDIR)$NXT_MODULESDIR
+ install -p $NXT_BUILD_DIR/lib/unit/modules/${NXT_SKEL_MODULE}.unit.so \\
+ \$(DESTDIR)$NXT_MODULESDIR/
+
+
+uninstall: ${NXT_SKEL_MODULE}-uninstall
+
+${NXT_SKEL_MODULE}-uninstall:
+ rm -f \$(DESTDIR)$NXT_MODULESDIR/${NXT_SKEL_MODULE}.unit.so
+ @rmdir -p \$(DESTDIR)$NXT_MODULESDIR 2>/dev/null || true
+
+END