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
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:
- apt-get source -q varnish
- cd varnish*
- ./configure
- make
- cd ..
- ./autogen.sh
- ./configure VARNISHSRC=varnish* VMODDIR=`pwd`
- make
- ./configure --prefix=/usr
- make -j4
script:
- make check
- make check -j4
compiler:
- clang
- gcc
......@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I m4
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
MAINTAINERCLEANFILES = $(dist_man_MANS)
......
......@@ -6,8 +6,7 @@ vmod_example
Varnish Example Module
----------------------
:Author: Martin Blix Grydeland
:Date: 2011-05-26
:Date: 2014-11-05
:Version: 1.0
:Manual section: 3
......@@ -19,8 +18,7 @@ import example;
DESCRIPTION
===========
Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod
for Varnish 3.0 and later.
Example Varnish vmod demonstrating how to write an out-of-tree Varnish vmod.
Implements the traditional Hello World as a vmod.
......@@ -46,32 +44,28 @@ Example
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
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
compile your vmod. Both the `VARNISHSRC` and `VARNISHSRC/include`
will be added to the include search paths for your module.
./autogen.sh
./configure
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 - builds the vmod
* make install - installs your vmod in `VMODDIR`
* make - builds the vmod.
* make install - installs your vmod.
* 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::
......@@ -82,16 +76,6 @@ In your VCL you could then use this vmod along the following lines::
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
=========
......
AC_PREREQ(2.59)
AC_PREREQ(2.64)
AC_COPYRIGHT([Copyright (c) 2011-2014 Varnish Software AS])
AC_INIT([libvmod-example], [trunk])
AC_CONFIG_MACRO_DIR([m4])
......@@ -33,13 +33,17 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/stdlib.h])
PKG_CHECK_MODULES([libvarnishapi], [varnishapi])
# Varnish include files tree
VARNISH_VMOD_INCLUDES
VARNISH_VMOD_DIR
VARNISH_VMODTOOL
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([
Makefile
......
Source: libvmod-example
Section: web
Priority: extra
Maintainer: Lasse Karstensen <lasse@varnish-software.com>
Build-Depends: debhelper (>= 7), build-essential, python-docutils
Maintainer: Lasse Karstensen <lkarsten@varnish-software.com>
Build-Depends: debhelper (>= 7), build-essential, pkg-config, python-docutils, varnish (>= 4.0.2), libvarnishapi-dev (>= 4.0.2)
Standards-Version: 3.8.1
Vcs-Git: git://github.com/varnish/libvmod-example.git
Package: libvmod-example
Architecture: any
Depends: varnish (>= 4.0.0), ${misc:Depends}
Depends: varnish (>= 4.0.2), ${misc:Depends}
Description: Example vmod for Varnish
#!/usr/bin/make -f
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:
if [ -n "$$DEBIAN_OVERRIDE_BINARY_VERSION" ]; then \
dh_gencontrol -- -v$$DEBIAN_OVERRIDE_BINARY_VERSION; \
......
......@@ -13,16 +13,14 @@ libvmod_example_la_SOURCES = \
vcc_if.c vcc_if.h: @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)
tests/*.vtc:
$(top_srcdir)/src/tests/*.vtc:
@VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@
check: $(VMOD_TESTS)
EXTRA_DIST = \
vmod_example.vcc \
$(VMOD_TESTS)
EXTRA_DIST = vmod_example.vcc $(VMOD_TESTS)
CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h
Summary: Example VMOD for Varnish
Name: vmod-varnish-%{VARNISHVER}-example
Name: vmod-example
Version: 0.1
Release: 1%{?dist}
License: BSD
Group: System Environment/Daemons
Source0: libvmod-example.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: varnish > 4.0
Requires: varnish >= 4.0.2
BuildRequires: make
BuildRequires: python-docutils
BuildRequires: varnish-libs-devel
BuildRequires: varnish >= 4.0.2
BuildRequires: varnish-libs-devel >= 4.0.2
%description
Example VMOD
%prep
%setup -n libvmod-example
%setup -n libvmod-example-trunk
%build
# this assumes that VARNISHSRC is defined on the rpmbuild command line, like this:
# 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/
%configure --prefix=/usr/
make
make check
......@@ -35,7 +34,7 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_libdir}/varnish/vmods/
%{_libdir}/varnis*/vmods/
%doc /usr/share/doc/%{name}/*
%{_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