Commit 5602713f authored by Nils Goroll's avatar Nils Goroll

Major overhaul of autocrap infrastructure and modernize varnish.m4 with varnish >= 4

- configure by pkg-config (new varnish4 / master standard - see vmod-example)
- make distcheck works now (working around dependency tracking issues with
  --disable-dependency-tracking )
- split out checks into a seperate subtree to ensure the build is complete
  before checking (parallel make wasn't working otherwise)
parent 274bf62b
...@@ -22,9 +22,8 @@ benchmark_results ...@@ -22,9 +22,8 @@ benchmark_results
/autom4te.cache/ /autom4te.cache/
/compile /compile
/config.guess /config.guess
/dcs_config.h /config.h
/dcs_config.h.in /config.h.in
/dcs_config.h.in~
/config.log /config.log
/config.status /config.status
/config.sub /config.sub
...@@ -65,3 +64,5 @@ src/vcc_if.h ...@@ -65,3 +64,5 @@ src/vcc_if.h
src/gen/dcs_classifier.checksum src/gen/dcs_classifier.checksum
src/*.rst src/*.rst
test-driver test-driver
dcs_classifier-*
src/gen/dbfile
if HAVE_VARNISH_M4
ACLOCAL_AMFLAGS = -I m4 -I ${LIBVARNISHAPI_DATAROOTDIR}/aclocal
else
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
endif
# pass all given arguments
#
# --disable-dependency-tracking works around this issue which seems to
# be related to subdir-objects
DISTCHECK_CONFIGURE_FLAGS = \
DCS_KEY='$(DCS_KEY)' \
DCS_ACCOUNT='$(DCS_ACCOUNT)' \
DCS_DBFILE='$(DCS_DBFILE)' \
VMOD_DIR='$(VMOD_DIR)' \
VARNISHSRC='$(VARNISHSRC)' \
--disable-dependency-tracking
SUBDIRS = src SUBDIRS = src check
dist_man_MANS = vmod_dcs.3 dist_man_MANS = vmod_dcs.3
MAINTAINERCLEANFILES = $(dist_man_MANS) MAINTAINERCLEANFILES = $(dist_man_MANS)
...@@ -19,4 +36,4 @@ else ...@@ -19,4 +36,4 @@ else
@false @false
endif endif
dist_data_DATA = dcs_config.h dist_data_DATA = config.h
...@@ -242,7 +242,7 @@ above, the `VARNISHSRC` argument must be used as in ...@@ -242,7 +242,7 @@ above, the `VARNISHSRC` argument must be used as in
VARNISHSRC=/path/to/your/varnish/source/varnish-cache VARNISHSRC=/path/to/your/varnish/source/varnish-cache
Optionally, a custom vmod installation directory can be specified Optionally, a custom vmod installation directory can be specified
using `VMODDIR=<dir>` using `VMOD_DIR=<dir>`
When building the vmod, an additional When building the vmod, an additional
......
...@@ -35,10 +35,16 @@ else ...@@ -35,10 +35,16 @@ else
esac esac
fi fi
# check for varnishapi.m4 in custom paths
dataroot=$(pkg-config --variable=datarootdir varnishapi 2>/dev/null)
# no error if this fails, we could be building for varnish2
if [ -z "${dataroot}" ] ; then
aclocal -I m4
else
aclocal -I m4 -I ${dataroot}/aclocal
fi
set -ex set -ex
$LIBTOOLIZE --copy --force $LIBTOOLIZE --copy --force
aclocal -I m4
autoheader autoheader
automake --add-missing --copy --foreign automake --add-missing --copy --foreign
autoconf autoconf
# check / Makefile.am
AUTOMAKE_OPTIONS = subdir-objects
VMOD_TESTS = $(srcdir)/@TESTDIR@/*.vtc
.PHONY: $(VMOD_TESTS)
$(srcdir)/@TESTDIR@/*.vtc:
@VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@
check: $(VMOD_TESTS)
EXTRA_DIST = \
$(VMOD_TESTS)
This diff is collapsed.
...@@ -43,7 +43,8 @@ dcs_test_SOURCES = \ ...@@ -43,7 +43,8 @@ dcs_test_SOURCES = \
# - # -
EXTRA_DIST = \ EXTRA_DIST = \
classes.conf classes.conf \
dcs_demo.db
# included c source # included c source
if INSTALL_VARNISH2 if INSTALL_VARNISH2
...@@ -67,7 +68,7 @@ nodist_data_DATA = \ ...@@ -67,7 +68,7 @@ nodist_data_DATA = \
gen/dcs_type.c gen/dcs_type.c
endif endif
## varnish 3 vmod ## varnish 3/4 vmod
if BUILD_VMOD if BUILD_VMOD
...@@ -75,12 +76,12 @@ if BUILD_VMOD ...@@ -75,12 +76,12 @@ if BUILD_VMOD
# libvmod_dcs.so will include an own copy of the code without the # libvmod_dcs.so will include an own copy of the code without the
# overhead of library calls - at the cost of some memory overhead # overhead of library calls - at the cost of some memory overhead
vmoddir = $(VMODDIR) vmoddir = $(VMOD_DIR)
vmod_LTLIBRARIES = libvmod_dcs.la vmod_LTLIBRARIES = libvmod_dcs.la
libvmod_dcs_la_CPPFLAGS = -Igen -I$(VARNISHSRC)/include -I$(VARNISHSRC)/bin/varnishd -I$(VARNISHSRC) libvmod_dcs_la_CPPFLAGS = -Igen @VMOD_INCLUDES@
libvmod_dcs_la_LDFLAGS = -module -export-dynamic -avoid-version libvmod_dcs_la_LDFLAGS = -module -export-dynamic -avoid-version -shared
libvmod_dcs_la_SOURCES = \ libvmod_dcs_la_SOURCES = \
vmod_dcs.c vmod_dcs.c
...@@ -89,31 +90,26 @@ nodist_libvmod_dcs_la_SOURCES = \ ...@@ -89,31 +90,26 @@ nodist_libvmod_dcs_la_SOURCES = \
vcc_if.c \ vcc_if.c \
vcc_if.h vcc_if.h
vcc_if_INCLUDES = -I$(VARNISHSRC)/include -I$(VARNISHSRC) libvmod_dcs.lo: dcs_varnish.c vcc_if.c vcc_if.h
vcc_dcs_INCLUDES = -I$(VARNISHSRC)/include -I$(VARNISHSRC) #libvmod_dcs_la-vmod_dcs.lo: dcs_varnish.c vcc_if.c vcc_if.h
vcc_if.c vcc_if.h: @VMODTOOL@ @VCCFILE@ vcc_if_INCLUDES = @VMOD_INCLUDES@
@PYTHON@ @VMODTOOL@ @VCCFILE@
BUILT_SOURCES = \ vmod_dcs.rst vmod_dcs.man.rst vcc_if.c: vcc_if.h
vcc_if.c \
vcc_if.h
CLEANFILES = \
vcc_if.c \
vcc_if.h
VMOD_TESTS = @TESTDIR@/*.vtc vcc_if.h: @VMODTOOL@ $(srcdir)/@VCCFILE@
@PYTHON@ @VMODTOOL@ $(srcdir)/@VCCFILE@
.PHONY: $(VMOD_TESTS) BUILT_SOURCES = \
vcc_if.c \
@TESTDIR@/*.vtc: libvmod_dcs.la vcc_if.h \
$(VARNISHSRC)/bin/varnishtest/varnishtest -Dvarnishd=$(VARNISHSRC)/bin/varnishd/varnishd -Dvmod_topbuild=$(abs_top_builddir) $@ vmod_dcs.rst \
vmod_dcs.man.rst
check: $(VMOD_TESTS) CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST += \ EXTRA_DIST += \
vmod_dcs.vcc \ @VCCFILE@
$(VMOD_TESTS)
endif endif # BUILD_VMOD
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*/ */
#include "dcs_config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "dcs_match.h" #include "dcs_match.h"
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*/ */
#include "dcs_config.h" #include "config.h"
#ifdef DEBUG_K_MATCH #ifdef DEBUG_K_MATCH
#include <stdlib.h> #include <stdlib.h>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*/ */
#include "dcs_config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*/ */
#include "dcs_config.h" #include "config.h"
#include "dcs_varnish.c" #include "dcs_varnish.c"
......
...@@ -4,19 +4,33 @@ BUILT_SOURCES = \ ...@@ -4,19 +4,33 @@ BUILT_SOURCES = \
dcs_classifier.c \ dcs_classifier.c \
dcs_classifier.h \ dcs_classifier.h \
dcs_type.c \ dcs_type.c \
dcs_match_mem.h dcs_match_mem.h \
dbfile
EXTRA_DIST = \ EXTRA_DIST = \
gen_dcs_classifier.pl \ gen_dcs_classifier.pl \
gen_dcs_match_mem.c gen_dcs_match_mem.c
if DCS_DBFILE_ABS
dbfile: @DCS_DBFILE@
- rm $@
ln -s $< $@
else
dbfile: $(abs_top_srcdir)/src/@DCS_DBFILE@
- rm $@
ln -s $< $@
endif
# -- the classifier # -- the classifier
dcs_classifier.c dcs_classifier.h dcs_type.c: gen_dcs_classifier.pl $(DCS_DBFILE) ../classes.conf # serialize build
dcs_classifier.checksum dcs_classifier.h dcs_type.c: dcs_classifier.c
dcs_classifier.c: $(srcdir)/gen_dcs_classifier.pl dbfile $(srcdir)/../classes.conf
if [[ -f fixup.remove ]] && [[ -f fixup.reorder ]] ; then \ if [[ -f fixup.remove ]] && [[ -f fixup.reorder ]] ; then \
./gen_dcs_classifier.pl $(DCS_DBFILE) $(DCS_KEY) ../classes.conf fixup.remove fixup.reorder ; \ $(srcdir)/gen_dcs_classifier.pl dbfile $(DCS_KEY) $(srcdir)/../classes.conf fixup.remove fixup.reorder ; \
else \ else \
./gen_dcs_classifier.pl $(DCS_DBFILE) $(DCS_KEY) ../classes.conf ; \ $(srcdir)/gen_dcs_classifier.pl dbfile $(DCS_KEY) $(srcdir)/../classes.conf ; \
fi fi
# -- gen_dcs_match_mem # -- gen_dcs_match_mem
...@@ -31,7 +45,9 @@ dcs_match_mem.h: gen_dcs_match_mem ...@@ -31,7 +45,9 @@ dcs_match_mem.h: gen_dcs_match_mem
./gen_dcs_match_mem >dcs_match_mem.h ./gen_dcs_match_mem >dcs_match_mem.h
# -- fixup db # -- fixup db
fixup.remove fixup.reorder fixup.out: fixup.remove fixup.reorder: fixup.out
fixup.out:
- rm fixup.remove fixup.reorder fixup.out - rm fixup.remove fixup.reorder fixup.out
- rm dcs_classifier.c dcs_classifier.h dcs_type.c - rm dcs_classifier.c dcs_classifier.h dcs_type.c
$(MAKE) $(AM_MAKEFLAGS) dcs_classifier.c dcs_classifier.h dcs_type.c $(MAKE) $(AM_MAKEFLAGS) dcs_classifier.c dcs_classifier.h dcs_type.c
...@@ -94,5 +110,6 @@ CLEANFILES = \ ...@@ -94,5 +110,6 @@ CLEANFILES = \
fixup.reorder \ fixup.reorder \
fixup.out \ fixup.out \
dcs.db \ dcs.db \
dcs.db.tstamp dcs.db.tstamp \
dbfile \
dcs_classifier.checksum
...@@ -1393,7 +1393,7 @@ dcs_register_subkey_match(struct dcs_matchstate *state, dcs_subkey_id_t subkey_i ...@@ -1393,7 +1393,7 @@ dcs_register_subkey_match(struct dcs_matchstate *state, dcs_subkey_id_t subkey_i
EOF EOF
_VCL (F_TYPE_C, VCL_TOP, <<'EOF'); _VCL (F_TYPE_C, VCL_TOP, <<'EOF');
#include "dcs_config.h" #include "config.h"
#include <errno.h> #include <errno.h>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*/ */
#include "dcs_config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*/ */
#include "dcs_config.h" #include "config.h"
#include "vrt.h" #include "vrt.h"
#include "vcc_if.h" #include "vcc_if.h"
......
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