Commit da3d3043 authored by Lasse Karstensen's avatar Lasse Karstensen

Merge branch 'master' into 4.0

Conflicts:
	README.rst
	debian/control
	rename-vmod-script
	vmod-example.spec
parents 33f2ef49 776c2ee2
language: c language: c
before_install: before_install:
- sudo apt-get install -qq python-docutils - sudo apt-get update -q
- sudo apt-get install -qq apt-transport-https python-docutils
- curl https://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -
- echo "deb https://repo.varnish-cache.org/ubuntu/ precise varnish-4.0" | sudo tee /etc/apt/sources.list.d/varnish-cache.list
- sudo apt-get -q update
- sudo apt-get install varnish libvarnishapi-dev
before_script: before_script:
- apt-get source -q varnish
- cd varnish*
- ./configure
- make
- cd ..
- ./autogen.sh - ./autogen.sh
- ./configure VARNISHSRC=varnish* VMODDIR=`pwd` - ./configure --prefix=/usr
- make - make -j4
script: script:
- make check - make check -j4
compiler:
- clang
- gcc
...@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I m4 ...@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src SUBDIRS = src
EXTRA_DIST = README.rst DISTCHECK_CONFIGURE_FLAGS = \
VMOD_DIR='$${libdir}/varnish/vmods'
EXTRA_DIST = README.rst LICENSE vmod-example.spec debian
dist_man_MANS = vmod_example.3 dist_man_MANS = vmod_example.3
MAINTAINERCLEANFILES = $(dist_man_MANS) MAINTAINERCLEANFILES = $(dist_man_MANS)
......
...@@ -6,8 +6,7 @@ vmod_example ...@@ -6,8 +6,7 @@ vmod_example
Varnish Example Module Varnish Example Module
---------------------- ----------------------
:Author: Martin Blix Grydeland :Date: 2014-11-05
:Date: 2011-05-26
:Version: 1.0 :Version: 1.0
:Manual section: 3 :Manual section: 3
...@@ -19,8 +18,7 @@ import example; ...@@ -19,8 +18,7 @@ import example;
DESCRIPTION DESCRIPTION
=========== ===========
Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod.
for Varnish 3.0 and later.
Implements the traditional Hello World as a vmod. Implements the traditional Hello World as a vmod.
...@@ -46,32 +44,28 @@ Example ...@@ -46,32 +44,28 @@ Example
INSTALLATION INSTALLATION
============ ============
This is an example skeleton for developing out-of-tree Varnish
vmods available from the 3.0 release. It implements the "Hello, World!"
as a vmod callback. Not particularly useful in good hello world
tradition,but demonstrates how to get the glue around a vmod working.
The source tree is based on autotools to configure the building, and The source tree is based on autotools to configure the building, and
does also have the necessary bits in place to do functional unit tests does also have the necessary bits in place to do functional unit tests
using the varnishtest tool. using the ``varnishtest`` tool.
Usage:: Building requires the Varnish header files and uses pkg-config to find
the necessary paths.
./configure VARNISHSRC=DIR [VMODDIR=DIR] If you have installed Varnish to a non-standard directory, you may need to
override PKG_CONFIG_PATH so configure can find varnishapi.pc.
Usage::
`VARNISHSRC` is the directory of the Varnish source tree for which to ./autogen.sh
compile your vmod. Both the `VARNISHSRC` and `VARNISHSRC/include` ./configure
will be added to the include search paths for your module.
Optionally you can also set the vmod install directory by adding
`VMODDIR=DIR` (defaults to the pkg-config discovered directory from your
Varnish installation).
Make targets: Make targets:
* make - builds the vmod * make - builds the vmod.
* make install - installs your vmod in `VMODDIR` * make install - installs your vmod.
* make check - runs the unit tests in ``src/tests/*.vtc`` * make check - runs the unit tests in ``src/tests/*.vtc``
* make distcheck - run check and prepare a tarball of the vmod.
In your VCL you could then use this vmod along the following lines:: In your VCL you could then use this vmod along the following lines::
...@@ -82,16 +76,6 @@ In your VCL you could then use this vmod along the following lines:: ...@@ -82,16 +76,6 @@ In your VCL you could then use this vmod along the following lines::
set resp.http.hello = example.hello("World"); set resp.http.hello = example.hello("World");
} }
HISTORY
=======
This manual page was released as part of the libvmod-example package,
demonstrating how to create an out-of-tree Varnish vmod.
For further examples and inspiration check out the vmod directory:
https://www.varnish-cache.org/vmods
COPYRIGHT COPYRIGHT
========= =========
......
AC_PREREQ(2.59) AC_PREREQ(2.64)
AC_COPYRIGHT([Copyright (c) 2011-2014 Varnish Software AS]) AC_COPYRIGHT([Copyright (c) 2011-2014 Varnish Software AS])
AC_INIT([libvmod-example], [trunk]) AC_INIT([libvmod-example], [trunk])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
...@@ -33,13 +33,17 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"]) ...@@ -33,13 +33,17 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([sys/stdlib.h]) AC_CHECK_HEADERS([sys/stdlib.h])
PKG_CHECK_MODULES([libvarnishapi], [varnishapi])
# Varnish include files tree # Varnish include files tree
VARNISH_VMOD_INCLUDES VARNISH_VMOD_INCLUDES
VARNISH_VMOD_DIR VARNISH_VMOD_DIR
VARNISH_VMODTOOL VARNISH_VMODTOOL
AC_PATH_PROG([VARNISHTEST], [varnishtest]) AC_PATH_PROG([VARNISHTEST], [varnishtest])
AC_PATH_PROG([VARNISHD], [varnishd]) AC_PATH_PROG([VARNISHD], [varnishd], [],
[$PATH:$PATH:`pkg-config varnishapi --variable=sbindir`])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
......
Source: libvmod-example Source: libvmod-example
Section: web Section: web
Priority: extra Priority: extra
Maintainer: Lasse Karstensen <lasse@varnish-software.com> Maintainer: Lasse Karstensen <lkarsten@varnish-software.com>
Build-Depends: debhelper (>= 7), build-essential, python-docutils Build-Depends: debhelper (>= 7), build-essential, pkg-config, python-docutils, varnish (>= 4.0.2), libvarnishapi-dev (>= 4.0.2)
Standards-Version: 3.8.1 Standards-Version: 3.8.1
Vcs-Git: git://github.com/varnish/libvmod-example.git Vcs-Git: git://github.com/varnish/libvmod-example.git
Package: libvmod-example Package: libvmod-example
Architecture: any Architecture: any
Depends: varnish (>= 4.0.0), ${misc:Depends} Depends: varnish (>= 4.0.2), ${misc:Depends}
Description: Example vmod for Varnish Description: Example vmod for Varnish
#!/usr/bin/make -f #!/usr/bin/make -f
export DH_VERBOSE=1 export DH_VERBOSE=1
VARNISHSRC = $(DEBIAN_VARNISH_SRC)
VMODDIR = $(shell PKG_CONFIG_PATH="$(VARNISHSRC)" pkg-config --variable=vmoddir varnishapi)
override_dh_auto_configure:
dh_auto_configure -- VMODDIR="$(VMODDIR)" VARNISHSRC="$(VARNISHSRC)"
override_dh_gencontrol: override_dh_gencontrol:
if [ -n "$$DEBIAN_OVERRIDE_BINARY_VERSION" ]; then \ if [ -n "$$DEBIAN_OVERRIDE_BINARY_VERSION" ]; then \
dh_gencontrol -- -v$$DEBIAN_OVERRIDE_BINARY_VERSION; \ dh_gencontrol -- -v$$DEBIAN_OVERRIDE_BINARY_VERSION; \
......
...@@ -13,16 +13,14 @@ libvmod_example_la_SOURCES = \ ...@@ -13,16 +13,14 @@ libvmod_example_la_SOURCES = \
vcc_if.c vcc_if.h: @VMODTOOL@ $(top_srcdir)/src/vmod_example.vcc vcc_if.c vcc_if.h: @VMODTOOL@ $(top_srcdir)/src/vmod_example.vcc
@VMODTOOL@ $(top_srcdir)/src/vmod_example.vcc @VMODTOOL@ $(top_srcdir)/src/vmod_example.vcc
VMOD_TESTS = tests/*.vtc VMOD_TESTS = $(top_srcdir)/src/tests/*.vtc
.PHONY: $(VMOD_TESTS) .PHONY: $(VMOD_TESTS)
tests/*.vtc: $(top_srcdir)/src/tests/*.vtc:
@VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@ @VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@
check: $(VMOD_TESTS) check: $(VMOD_TESTS)
EXTRA_DIST = \ EXTRA_DIST = vmod_example.vcc $(VMOD_TESTS)
vmod_example.vcc \
$(VMOD_TESTS)
CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h
Summary: Example VMOD for Varnish Summary: Example VMOD for Varnish
Name: vmod-varnish-%{VARNISHVER}-example Name: vmod-example
Version: 0.1 Version: 0.1
Release: 1%{?dist} Release: 1%{?dist}
License: BSD License: BSD
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: libvmod-example.tar.gz Source0: libvmod-example.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: varnish > 4.0 Requires: varnish >= 4.0.2
BuildRequires: make BuildRequires: make
BuildRequires: python-docutils BuildRequires: python-docutils
BuildRequires: varnish-libs-devel BuildRequires: varnish >= 4.0.2
BuildRequires: varnish-libs-devel >= 4.0.2
%description %description
Example VMOD Example VMOD
%prep %prep
%setup -n libvmod-example %setup -n libvmod-example-trunk
%build %build
# this assumes that VARNISHSRC is defined on the rpmbuild command line, like this: %configure --prefix=/usr/
# rpmbuild -bb --define 'VARNISHSRC /home/user/rpmbuild/BUILD/varnish-3.0.3' redhat/*spec
./configure VARNISHSRC=%{VARNISHSRC} VMODDIR="$(PKG_CONFIG_PATH=%{VARNISHSRC} pkg-config --variable=vmoddir varnishapi)" --prefix=/usr/
make make
make check make check
...@@ -35,7 +34,7 @@ rm -rf %{buildroot} ...@@ -35,7 +34,7 @@ rm -rf %{buildroot}
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/varnish/vmods/ %{_libdir}/varnis*/vmods/
%doc /usr/share/doc/%{name}/* %doc /usr/share/doc/%{name}/*
%{_mandir}/man?/* %{_mandir}/man?/*
......
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