Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobcode
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-blobcode
Commits
28869d5e
Commit
28869d5e
authored
Jul 30, 2013
by
Tollef Fog Heen
Committed by
Tollef Fog Heen
Jul 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update for varnish 4.0, including reworking the build system
parent
477f1ff5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
41 deletions
+18
-41
configure.ac
configure.ac
+6
-29
Makefile.am
src/Makefile.am
+5
-5
vmod_example.c
src/vmod_example.c
+7
-7
No files found.
configure.ac
View file @
28869d5e
...
...
@@ -29,41 +29,18 @@ if test "x$RST2MAN" = "xno"; then
fi
AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
# Check for pkg-config
PKG_PROG_PKG_CONFIG
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/stdlib.h])
# Check for python
AC_CHECK_PROGS(PYTHON, [python3 python3.1 python3.2 python2.7 python2.6 python2.5 python2 python], [AC_MSG_ERROR([Python is needed to build this vmod, please install python.])])
# Varnish source tree
AC_ARG_VAR([VARNISHSRC], [path to Varnish source tree (mandatory)])
if test "x$VARNISHSRC" = x; then
AC_MSG_ERROR([No Varnish source tree specified])
fi
VARNISHSRC=`cd $VARNISHSRC && pwd`
AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h],
[],
[AC_MSG_FAILURE(["$VARNISHSRC" is not a Varnish source directory])]
)
# Varnish include files tree
VARNISH_VMOD_INCLUDES
VARNISH_VMOD_DIR
VARNISH_VMODTOOL
# Check that varnishtest is built in the varnish source directory
AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest],
[],
[AC_MSG_FAILURE([Can't find "$VARNISHSRC/bin/varnishtest/varnishtest". Please build your varnish source directory])]
)
# vmod installation dir
AC_ARG_VAR([VMODDIR], [vmod installation directory @<:@LIBDIR/varnish/vmods@:>@])
if test "x$VMODDIR" = x; then
VMODDIR=`pkg-config --variable=vmoddir varnishapi`
if test "x$VMODDIR" = x; then
AC_MSG_FAILURE([Can't determine vmod installation directory])
fi
fi
AC_PATH_PROG([VARNISHTEST], [varnishtest])
AC_PATH_PROG([VARNISHD], [varnishd])
AC_CONFIG_FILES([
Makefile
...
...
src/Makefile.am
View file @
28869d5e
INCLUDES
=
-I
$(VARNISHSRC)
/include
-I
$(VARNISHSRC)
AM_CPPFLAGS
=
@VMOD_INCLUDES@
vmoddir
=
$(VMODDIR)
vmoddir
=
@VMOD_DIR@
vmod_LTLIBRARIES
=
libvmod_example.la
libvmod_example_la_LDFLAGS
=
-module
-export-dynamic
-avoid-version
-shared
...
...
@@ -10,14 +10,14 @@ libvmod_example_la_SOURCES = \
vcc_if.h
\
vmod_example.c
vcc_if.c vcc_if.h
:
$(VARNISHSRC)/lib/libvmod_std/vmod.py
$(top_srcdir)/src/vmod_example.vcc
@
PYTHON@
$(VARNISHSRC)
/lib/libvmod_std/vmod.py
$(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
VMOD_TESTS
=
tests/
*
.vtc
.PHONY
:
$(VMOD_TESTS)
tests/*.vtc
:
$(VARNISHSRC)
/bin/varnishtest/varnishtest
-Dvarnishd
=
$(VARNISHSRC)
/bin/varnishd/varnishd
-Dvmod_topbuild
=
$(abs_top_builddir)
$@
@
VARNISHTEST@
-Dvarnishd
=
@VARNISHD@
-Dvmod_topbuild
=
$(abs_top_builddir)
$@
check
:
$(VMOD_TESTS)
...
...
src/vmod_example.c
View file @
28869d5e
#include <stdlib.h>
#include "vrt.h"
#include "
bin/varnishd
/cache.h"
#include "
cache
/cache.h"
#include "vcc_if.h"
...
...
@@ -11,22 +11,22 @@ init_function(struct vmod_priv *priv, const struct VCL_conf *conf)
return
(
0
);
}
const
char
*
vmod_hello
(
struct
sess
*
sp
,
const
char
*
name
)
VCL_STRING
vmod_hello
(
const
struct
vrt_ctx
*
ctx
,
VCL_STRING
name
)
{
char
*
p
;
unsigned
u
,
v
;
u
=
WS_Reserve
(
sp
->
wrk
->
ws
,
0
);
/* Reserve some work space */
p
=
sp
->
wrk
->
ws
->
f
;
/* Front of workspace area */
u
=
WS_Reserve
(
ctx
->
ws
,
0
);
/* Reserve some work space */
p
=
ctx
->
ws
->
f
;
/* Front of workspace area */
v
=
snprintf
(
p
,
u
,
"Hello, %s"
,
name
);
v
++
;
if
(
v
>
u
)
{
/* No space, reset and leave */
WS_Release
(
sp
->
wrk
->
ws
,
0
);
WS_Release
(
ctx
->
ws
,
0
);
return
(
NULL
);
}
/* Update work space with what we've used */
WS_Release
(
sp
->
wrk
->
ws
,
v
);
WS_Release
(
ctx
->
ws
,
v
);
return
(
p
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment