[master] fb4c1f8 Rework a bit of the build system for vmod docs
Tollef Fog Heen
tfheen at err.no
Wed Mar 19 10:12:02 CET 2014
commit fb4c1f855f0d21bf56799f57bf4232b736b90a05
Author: Tollef Fog Heen <tfheen at fastly.com>
Date: Wed Mar 19 10:08:09 2014 +0100
Rework a bit of the build system for vmod docs
Move the vmod man pages to man/ and build and ship the vmod_director
page. Also make sure we use the vmod_std docs from the .vcc file, not
the old copy in docs/
diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am
index 64e6020..716e8da 100644
--- a/doc/sphinx/Makefile.am
+++ b/doc/sphinx/Makefile.am
@@ -127,7 +127,6 @@ EXTRA_DIST = \
reference/varnishtop.rst \
reference/vcl.rst \
reference/vmod.rst \
- reference/vmod_std.rst \
reference/vsl-query.rst \
reference/vsl.rst \
reference/vsm.rst \
@@ -212,5 +211,13 @@ include/varnishhist_synopsis.rst: $(top_builddir)/bin/varnishhist/varnishhist_op
BUILT_SOURCES += include/varnishhist_options.rst \
include/varnishhist_synopsis.rst
+include/vmod_std.rst: $(top_builddir)/lib/libvmod_std/vmod_std.rst
+ cp $? $@
+BUILT_SOURCES += include/vmod_std.rst
+
+include/vmod_directors.rst: $(top_builddir)/lib/libvmod_directors/vmod_directors.rst
+ cp $? $@
+BUILT_SOURCES += include/vmod_directors.rst
+
EXTRA_DIST += $(BUILT_SOURCES)
MAINTAINERCLEANFILES = $(EXTRA_DIST)
diff --git a/doc/sphinx/reference/index.rst b/doc/sphinx/reference/index.rst
index 1537fb4..20ac975 100644
--- a/doc/sphinx/reference/index.rst
+++ b/doc/sphinx/reference/index.rst
@@ -21,7 +21,8 @@ The Varnish Reference Manual
varnishtop.rst
vsm.rst
vmod.rst
- vmod_std.rst
+ ../include/vmod_std.rst
+ ../include/vmod_directors.rst
vsl.rst
vsl-query.rst
diff --git a/doc/sphinx/reference/vmod_std.rst b/doc/sphinx/reference/vmod_std.rst
deleted file mode 100644
index b8f2aa3..0000000
--- a/doc/sphinx/reference/vmod_std.rst
+++ /dev/null
@@ -1,188 +0,0 @@
-========
-vmod_std
-========
-
------------------------
-Varnish Standard Module
------------------------
-
-SYNOPSIS
-========
-
-import std [from "path"] ;
-
-DESCRIPTION
-===========
-
-Vmod_std contains basic functions which are part and parcel of Varnish,
-but which for reasons of architecture fit better in a VMOD.
-
-One particular class of functions in vmod_std is the conversions functions
-which all have the form::
-
- TYPE type(STRING, TYPE)
-
-These functions attempt to convert STRING to the TYPE, and if that fails,
-they return the second argument, which must have the given TYPE.
-
-FUNCTIONS
-=========
-
-toupper
--------
-
-Prototype
- STRING toupper(STRING s)
-Description
- Converts the string *s* to upper case.
-Example
- set beresp.http.x-scream = std.toupper("yes!");
-
-tolower
--------
-Prototype
- STRING tolower(STRING s)
-Description
- Converts the string *s* to lower case.
-Example
- set beresp.http.x-nice = std.tolower("VerY");
-
-set_ip_tos
-----------
-Prototype
- VOID set_ip_tos(INT i)
-Description
- Sets the Type-of-Service flag for the current session. Please
- note that the TOS flag is not removed by the end of the
- request so probably want to set it on every request should you
- utilize it.
-Example
- | if (req.url ~ ^/slow/) {
- | std.set_ip_tos(0x0);
- | }
-
-random
-------
-Prototype
- REAL random(REAL a, REAL b)
-Description
- Returns a random REAL number between *a* and *b*.
-Example
- set beresp.http.x-random-number = std.random(1, 100);
-
-log
----
-Prototype
- VOID log(STRING string)
-Description
- Logs *string* to the shared memory log, using VSL tag *SLT_VCL_Log*.
-Example
- std.log("Something fishy is going on with the vhost " + req.host);
-
-syslog
-------
-Prototype
- VOID syslog(INT priority, STRING string)
-Description
- Logs *string* to syslog marked with *priority*. See your
- system's syslog.h file for the legal values of *priority*.
-Example
- std.syslog(8 + 1, "Something is wrong");
-
-fileread
---------
-Prototype
- STRING fileread(STRING filename)
-Description
- Reads a file and returns a string with the content. Please
- note that it is not recommended to send variables to this
- function the caching in the function doesn't take this into
- account. Also, files are not re-read.
-Example
- set beresp.http.x-served-by = std.fileread("/etc/hostname");
-
-collect
--------
-Prototype
- VOID collect(HEADER header)
-Description
- Collapses the header, joining the headers into one.
-Example
- std.collect(req.http.cookie);
- This will collapse several Cookie: headers into one, long
- cookie header.
-
-
-CONVERSION FUNCTIONS
-====================
-
-duration
---------
-Prototype
- DURATION duration(STRING s, DURATION fallback)
-Description
- Converts the string *s* to seconds. *s* must be quantified
- with ms (milliseconds), s (seconds), m (minutes), h (hours),
- d (days) or w (weeks) units. If *s* fails to parse,
- *fallback* will be returned.
-Example
- set beresp.ttl = std.duration("1w", 3600s);
-
-integer
---------
-Prototype
- INT integer(STRING s, INT fallback)
-Description
- Converts the string *s* to an integer. If *s* fails to parse,
- *fallback* will be returned.
-Example
- if (std.integer(beresp.http.x-foo, 0) > 5) { ... }
-
-ip
---
-Prototype
- IP ip(STRING s, IP fallback)
-Description
- Converts string *s* to the first IP number returned by
- the system library function getaddrinfo(3). If conversion
- fails, *fallback* will be returned.
-Example
- if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { ... }
-
-healthy
--------
-Prototype
- BOOL healthy(BACKEND backend)
-
-Description
- Returns true if the backend is healthy.
-
-port
-----
-Prototype
- INT port(IP ip)
-
-Description
- Returns the port number of an IP address.
-
-
-SEE ALSO
-========
-
-* vcl(7)
-* varnishd(1)
-
-HISTORY
-=======
-
-The Varnish standard module was released along with Varnish Cache 3.0.
-This manual page was written by Per Buer with help from Martin Blix
-Grydeland.
-
-COPYRIGHT
-=========
-
-This document is licensed under the same licence as Varnish
-itself. See LICENCE for details.
-
-* Copyright (c) 2011-2014 Varnish Software
diff --git a/lib/libvmod_directors/Makefile.am b/lib/libvmod_directors/Makefile.am
index 6a85ad5..05912e0 100644
--- a/lib/libvmod_directors/Makefile.am
+++ b/lib/libvmod_directors/Makefile.am
@@ -28,7 +28,7 @@ nodist_libvmod_directors_la_SOURCES = \
# BUILT_SOURCES is only a hack and dependency tracking does not help for the first build
vdir.lo fall_back.lo hash.lo random.lo round_robin.lo: vcc_if.h
-vcc_if.c vcc_if.h: $(vmodtool) $(vmod_srcdir)/vmod.vcc
+vcc_if.c vcc_if.h vmod_directors.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc
@PYTHON@ $(vmodtool) $(vmod_srcdir)/vmod.vcc
EXTRA_DIST = vmod.vcc
diff --git a/lib/libvmod_std/Makefile.am b/lib/libvmod_std/Makefile.am
index 8967bf5..07dda95 100644
--- a/lib/libvmod_std/Makefile.am
+++ b/lib/libvmod_std/Makefile.am
@@ -7,8 +7,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/bin/varnishd \
-I$(top_builddir)/include
-dist_man_MANS = vmod_std.3
-
vmoddir = $(pkglibdir)/vmods
vmod_srcdir = $(top_srcdir)/lib/libvmod_std
vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py
@@ -36,6 +34,3 @@ EXTRA_DIST = vmod.vcc
CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
$(builddir)/vmod_std.rst \
$(builddir)/vmod_std.man.rst
-
-vmod_std.3: $(top_srcdir)/doc/sphinx/reference/vmod_std.rst
- ${RST2MAN} $? $@
diff --git a/man/Makefile.am b/man/Makefile.am
index 581a9de..c25804e 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -19,7 +19,9 @@ dist_man_MANS = \
varnishncsa.1 \
varnishstat.1 \
varnishtest.1 \
- varnishtop.1
+ varnishtop.1 \
+ vmod_directors.3 \
+ vmod_std.3
MAINTAINERCLEANFILES = $(dist_man_MANS)
@@ -80,3 +82,9 @@ varnishhist.1: \
$(top_srcdir)/doc/sphinx/include/varnishhist_options.rst \
$(top_srcdir)/doc/sphinx/include/varnishhist_synopsis.rst
${RST2MAN} $(top_srcdir)/doc/sphinx/reference/varnishhist.rst $@
+
+vmod_std.3: $(top_srcdir)/lib/libvmod_std/vmod_std.man.rst
+ ${RST2MAN} $? $@
+
+vmod_directors.3: $(top_srcdir)/lib/libvmod_directors/vmod_directors.man.rst
+ ${RST2MAN} $? $@
More information about the varnish-commit
mailing list