Update and fix build infrastructure by example of vcdk

parent 46c861e1
Makefile
Makefile.in
# build system
.deps/
.libs/
*.o
*.lo
autom4te.cache/
build-aux/
m4/
*.la
*.gcda
*.gcno
*~
*.[1-9]
.dirstamp
/aclocal.m4
/ar-lib
/autom4te.cache/
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
/test-driver
/m4/
/src/vcc_if.c
/src/vcc_if.h
/src/vmod_*rst
/src/tests/*.log
/src/tests/*.trs
/src/test-suite.log
/src/tests/pathtest
/src/coverage
*.lo
*.o
*.tar.gz
Makefile
Makefile.in
aclocal.m4
config.h
config.h.in
config.log
config.status
configure
libtool
stamp-h1
# test suite
*.log
*.trs
# vmodtool
vcc_*_if.[ch]
vmod_*.rst
# man
*.1
*_options.rst
*_synopsis.rst
vmod_*.3
ACLOCAL_AMFLAGS = -I m4 -I ${VARNISHAPI_DATAROOTDIR}/aclocal
ACLOCAL_AMFLAGS = -I m4 -I @VARNISHAPI_DATAROOTDIR@/aclocal
SUBDIRS = src
DISTCHECK_CONFIGURE_FLAGS = \
VMOD_DIR='$${libdir}/varnish/vmods'
DISTCHECK_CONFIGURE_FLAGS = RST2MAN=:
coverage:
$(MAKE) $(AM_MAKEFLAGS) -C src coverage
......@@ -15,13 +14,3 @@ doc_DATA = README.rst LICENSE CONTRIBUTING.rst INSTALL.rst
README.rst: src/vmod_file.vcc
$(MAKE) $(AM_MAKEFLAGS) -C src vmod_file.man.rst
cp src/vmod_file.man.rst README.rst
%.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9:
if HAVE_RST2MAN
${RST2MAN} $< $@
else
@echo "========================================"
@echo "You need rst2man installed to make dist"
@echo "========================================"
@false
endif
#!/bin/sh
set -e
set -u
WORK_DIR=$(pwd)
ROOT_DIR=$(dirname "$0")
cd "$ROOT_DIR"
if ! command -v libtoolize >/dev/null
then
echo "libtoolize: command not found, falling back to glibtoolize" >&2
alias libtoolize=glibtoolize
fi
mkdir -p m4
aclocal
libtoolize --copy --force
autoheader
automake --add-missing --copy --foreign
autoconf
cd "$WORK_DIR"
"$ROOT_DIR"/configure "$@"
AC_PREREQ(2.68)
AC_COPYRIGHT([Copyright (c) 2019 UPLEX - Nils Goroll Systemoptimierung])
AC_PREREQ([2.68])
AC_COPYRIGHT([Copyright (c) 2019,2023 UPLEX - Nils Goroll Systemoptimierung])
AC_INIT([libvmod-file], [trunk], [varnish-support@uplex.de], [vmod-file])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/vmod_file.vcc)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
AC_LANG(C)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign parallel-tests])
AM_SILENT_RULES([yes])
AM_PROG_AR
LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
AC_PROG_CC
AC_PROG_CC_STDC
if test "x$ac_cv_prog_cc_c99" = xno; then
AC_MSG_ERROR([Could not find a C99 compatible compiler])
fi
AC_PROG_CPP
AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
AC_ARG_WITH([rst2man],
AS_HELP_STRING(
[--with-rst2man=PATH],
[Location of rst2man (auto)]),
[RST2MAN="$withval"],
AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], []))
AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
[AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], [])])
AC_ARG_WITH([lcov],
AS_HELP_STRING(
[--with-lcov=PATH],
[Location of lcov to generate coverage data (auto)]),
[LCOV="$withval"],
AC_CHECK_PROGS(LCOV, [lcov], []))
[AC_CHECK_PROGS(LCOV, [lcov], [])])
AM_CONDITIONAL(HAVE_LCOV, [test -n "$LCOV"])
AC_ARG_WITH([genhtml],
......@@ -48,20 +26,16 @@ AC_ARG_WITH([genhtml],
[--with-genhtml=PATH],
[Location of genhtml to generate coverage reports (auto)]),
[GENHTML="$withval"],
AC_CHECK_PROGS(GENHTML, [genhtml], []))
[AC_CHECK_PROGS(GENHTML, [genhtml], [])])
AM_CONDITIONAL(HAVE_GENHTML, [test -n "$GENHTML"])
m4_ifndef([VARNISH_PREREQ], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
VARNISH_PREREQ([6.5.0])
VARNISH_VMODS([file])
VMOD_TESTS="$(cd $srcdir/src && echo tests/*.vtc)"
AC_SUBST(VMOD_TESTS)
AM_PROG_AR
PKG_CHECK_VAR([LIBVARNISHAPI_LIBDIR], [varnishapi], [libdir])
AC_SUBST([VARNISH_LIBRARY_PATH],
[$LIBVARNISHAPI_LIBDIR:$LIBVARNISHAPI_LIBDIR/varnish])
LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
# Checks for C sources
AC_CHECK_FUNCS([memset])
......@@ -108,4 +82,19 @@ AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
AS_ECHO("
==== $PACKAGE_STRING ====
varnish: $VARNISH_VERSION
prefix: $prefix
vmoddir: $vmoddir
vcldir: $vcldir
pkgvcldir: $pkgvcldir
compiler: $CC
cflags: $CFLAGS
ldflags: $LDFLAGS
")
AUTOMAKE_OPTIONS = subdir-objects
AM_CFLAGS = $(VARNISHAPI_CFLAGS) -Wall -Werror -Wextra -std=c99
AM_LDFLAGS = $(VARNISHAPI_LIBS) -ldl -lrt
vmod_LTLIBRARIES = libvmod_file.la
# Modules
libvmod_file_la_SOURCES = \
vmod_file.c
vmod_LTLIBRARIES = \
libvmod_file.la
libvmod_file_la_LDFLAGS = $(VMOD_LDFLAGS)
libvmod_file_la_SOURCES = vmod_file.c
nodist_libvmod_file_la_SOURCES = \
vcc_if.c \
vcc_if.h
vmod_file.lo: $(nodist_libvmod_file_la_SOURCES)
dist_man_MANS = vmod_file.3
vcc_if.h vmod_file.rst vmod_file.man.rst: vcc_if.c
vcc_file_if.c \
vcc_file_if.h
vcc_if.c: vmod_file.vcc
$(AM_V_VMODTOOL) $(PYTHON) $(VMODTOOL) -o vcc_if $(srcdir)/vmod_file.vcc
@BUILD_VMOD_FILE@
vmod_file.3: vmod_file.man.rst
$(AM_V_GEN) $(RST2MAN) vmod_file.man.rst vmod_file.3
# Test suite
AM_TESTS_ENVIRONMENT = \
PATH="$(VMOD_TEST_PATH)" \
PATH="$(abs_builddir):$(VARNISH_TEST_PATH):$(PATH)" \
LD_LIBRARY_PATH="$(VARNISH_LIBRARY_PATH)"
TEST_EXTENSIONS = .vtc
VTC_LOG_COMPILER = varnishtest -v
AM_VTC_LOG_FLAGS = -Dvmod_file="$(VMOD_FILE)"
TESTS = @VMOD_TESTS@
AM_VTC_LOG_FLAGS = \
-p vcl_path="$(abs_top_srcdir)/vcl:$(VARNISHAPI_VCLDIR)" \
-p vmod_path="$(abs_builddir)/.libs:$(vmoddir):$(VARNISHAPI_VMODDIR)"
TESTS = \
vtc/00basic.vtc \
vtc/blob.vtc \
vtc/errors.vtc \
vtc/get.vtc \
vtc/info.vtc \
vtc/path.vtc \
vtc/synth.vtc \
vtc/temperature.vtc
# Documentation
dist_doc_DATA = \
vmod_file.vcc \
$(TESTS)
# To test an individual VTC test named test.vtc:
# $ cd src/
# $ make check TESTS=tests/test.vtc
dist_man_MANS = \
vmod_file.3
gcov: clean
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) CC=gcc \
CFLAGS="${AM_CFLAGS} --coverage -fno-inline -g -O0" check
.rst.1:
$(AM_V_GEN) $(RST2MAN) $< $@
# Coverage
# Set QUIET=-q for non-verbose builds, otherwise set to empty.
QUIET_0 = -q
QUIET_ = $(QUIET_@AM_DEFAULT_V@)
QUIET = $(QUIET_@AM_V@)
gcov: clean
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) CC=gcc \
CFLAGS="${AM_CFLAGS} --coverage -fno-inline -g -O0" check
coverage/lcov.info: gcov
if HAVE_LCOV
$(AM_V_at)@mkdir $(builddir)/coverage
......@@ -67,18 +81,5 @@ else
@false
endif
EXTRA_DIST = \
vmod_file.vcc \
$(VMOD_TESTS)
CLEANFILES = \
$(builddir)/vcc_if.c \
$(builddir)/vcc_if.h \
$(builddir)/vmod_file.rst \
$(builddir)/vmod_file.man.rst \
$(builddir)/vmod_file.3 \
$(builddir)/*.gcda \
$(builddir)/*.gcno
clean-local:
@rm -rf $(builddir)/coverage
......@@ -47,7 +47,7 @@
#include "vsb.h"
#include "vsha256.h"
#include "vcc_if.h"
#include "vcc_file_if.h"
#define VFAIL(ctx, fmt, ...) \
VRT_fail((ctx), "vmod file failure: " fmt, __VA_ARGS__)
......
......@@ -3,7 +3,7 @@
varnishtest "vcl.use and .discard, and version strings"
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
} -start
......@@ -21,7 +21,7 @@ varnish v1 -cli "vcl.discard vcl1"
varnish v1 -cli "vcl.list"
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_recv {
......
......@@ -5,7 +5,7 @@ varnishtest "reader.blob()"
shell {echo -n "foo bar baz quux" > ${tmpdir}/blob}
varnish v1 -vcl {
import ${vmod_file};
import file;
import blob;
backend b None;
......
......@@ -5,7 +5,7 @@ varnishtest "reader.error()"
shell {touch ${tmpdir}/error}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......
......@@ -5,7 +5,7 @@ varnishtest "reader constructor and .get()"
shell {echo -n "foo bar baz quux" > ${tmpdir}/file}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -32,7 +32,7 @@ client c1 {
shell {ln -s ${tmpdir}/file ${tmpdir}/link}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -52,7 +52,7 @@ varnish v1 -vcl {
client c1 -run
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -130,7 +130,7 @@ client c1 -run
shell {echo -n "The quick brown fox jumps over the lazy dog." > ${tmpdir}/fox}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -168,7 +168,7 @@ client c1 {
} -run
varnish v1 -errvcl {cannot open} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -177,7 +177,7 @@ varnish v1 -errvcl {cannot open} {
}
varnish v1 -errvcl {not a regular file} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -188,7 +188,7 @@ varnish v1 -errvcl {not a regular file} {
shell {ln -s ${tmpdir} ${tmpdir}/dirlink}
varnish v1 -errvcl {not a regular file} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -197,7 +197,7 @@ varnish v1 -errvcl {not a regular file} {
}
varnish v1 -errvcl {vmod file failure: new rdr: name is empty} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -206,7 +206,7 @@ varnish v1 -errvcl {vmod file failure: new rdr: name is empty} {
}
varnish v1 -errvcl {vmod file failure: new rdr: ttl -1.000 must be >= 0s} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......
......@@ -5,7 +5,7 @@ varnishtest "methods for information about files and timers"
shell {echo -n "foo bar baz quux" > ${tmpdir}/sz}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -80,7 +80,7 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
shell {touch ${tmpdir}/mtime}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -114,7 +114,7 @@ logexpect l1 -wait
shell {touch ${tmpdir}/nxtchk}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -149,7 +149,7 @@ client c1 {
shell {touch ${tmpdir}/deleteme}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -182,7 +182,7 @@ client c1 {
shell {touch ${tmpdir}/id}
varnish v1 -vcl {
import ${vmod_file};
import file;
import blob;
backend b None;
......@@ -216,7 +216,7 @@ client c1 -run
shell {echo -n "foo bar baz quux" > ${tmpdir}/sha}
varnish v1 -vcl {
import ${vmod_file};
import file;
import blob;
backend b None;
......@@ -250,7 +250,7 @@ client c1 -run
varnish v1 -vcl {
import ${vmod_file};
import file;
import blob;
backend b None;
......
......@@ -10,7 +10,7 @@ shell {
}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -40,7 +40,7 @@ client c1 {
} -run
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -67,7 +67,7 @@ shell {echo -n "1 only" > ${tmpdir}/d1/pathtest}
shell {echo -n "2 only" > ${tmpdir}/d2/pathtest}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -95,7 +95,7 @@ client c1 {
} -run
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -128,7 +128,7 @@ shell {
}
varnish v1 -errvcl {new rdr: unreadable not found or not readable on path} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -140,7 +140,7 @@ shell {rm -f ${tmpdir}/d1/pathtest}
shell {rm -f ${tmpdir}/d2/pathtest}
varnish v1 -errvcl {new rdr: pathtest not found or not readable on path} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -150,7 +150,7 @@ varnish v1 -errvcl {new rdr: pathtest not found or not readable on path} {
}
varnish v1 -errvcl {new rdr: path is empty} {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......
......@@ -8,7 +8,7 @@ shell {
}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......@@ -78,7 +78,7 @@ shell {
}
varnish v1 -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......
......@@ -7,7 +7,7 @@ shell {echo -n "foo bar baz quux" > ${tmpdir}/file}
# Debug param vclrel causes VCLs to be released without delay, making
# it possible to check the effects of temperature changes.
varnish v1 -arg "-p debug=+vclrel" -vcl {
import ${vmod_file};
import file;
backend b None;
sub vcl_init {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment