aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2017-08-08 18:24:38 +0300
committerSergey Poznyakoff <gray@gnu.org>2017-08-08 18:33:23 +0300
commit754af24200ceda805c66994151ad1eba2dfb2619 (patch)
treed327735304517ee02049f4d3901af643a68f29ff
parentba32780019480b89cd9d796b93a76cae6afe99ab (diff)
downloadacvmod-754af24200ceda805c66994151ad1eba2dfb2619.tar.gz
acvmod-754af24200ceda805c66994151ad1eba2dfb2619.tar.bz2
Add documentation
* README: New file. * bootstrap: Rename --copying to --license. Look for the license file in the directory "copying" first. * .gitignore: New file. * license/gnu: New file. * tmpl/Makefile.am: Use %[LICENSE] instead of %[COPYING] * tmpl/configure.ac: Likewise. * tmpl/src/Makefile.am: Likewise. * tmpl/src/vmod.c: Likewise. * tmpl/src/vmod.vcc: Likewise. * tmpl/tests/Makefile.am: Likewise. * tmpl/tests/testsuite.at: Likewise.
-rw-r--r--.gitignore4
-rw-r--r--README247
-rwxr-xr-xbootstrap38
-rw-r--r--license/gnu14
-rw-r--r--tmpl/Makefile.am2
-rw-r--r--tmpl/configure.ac2
-rw-r--r--tmpl/src/Makefile.am2
-rw-r--r--tmpl/src/vmod.c2
-rw-r--r--tmpl/src/vmod.vcc2
-rw-r--r--tmpl/tests/Makefile.am2
-rw-r--r--tmpl/tests/testsuite.at2
11 files changed, 296 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b2ea4fc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
1.emacs
2.emacs.*
3README.html
4*~
diff --git a/README b/README
new file mode 100644
index 0000000..9762ba4
--- /dev/null
+++ b/README
@@ -0,0 +1,247 @@
1#+TITLE: Varnish Cache module creator
2
3* Overview
4
5*Acvmod* is a framework for creating loadable modules for [[https://varnish-cache.org][Varnish
6Cache]] (_vmods_). It provides a set of macros and templates for configuring
7the module using GNU autotools and includes several auxiliary
8tools for creating GNU-style ChangeLog, testsuite, etc.
9
10It is intended to be included as a git submodule to the _vmod_ project
11repository.
12
13* Creating new vmod
14
15The *bootstrap* tool is designed to facilitate the task of creating a
16new _vmod_ from the scratch. It takes a number of options supplying it
17with the additional data about the module, but in general, creating
18a new module is as simple as running:
19
20#+BEGIN_SRC shell-script
21 ./bootstrap -C $DIR $NAME
22#+END_SRC
23
24where =$NAME= is the module name and =$DIR= is the name of the
25directory where to create the skeleton for the module.
26
27Suppose you start to write a module named =vmod-new= (traditionally,
28vmod names are prefixed with =vmod_= or =vmod-=. *Acvmod* accepts the
29latter convention). Then, do the following:
30
311. Clone the *acvmod*:
32 #+BEGIN_SRC shell-script
33 git clone git://git.gnu.org.ua/acvmod.git
34 #+END_SRC
352. Run
36 #+BEGIN_SRC shell-script -r
37 acvmod/bootstrap -C ~/src/vmod-new --git new
38 #+END_SRC
39
40The =--git= option instructs the tool that the module will be under
41control of Git, so that *acvmod* will add itself as a submodule.
42
43This command will do the following:
44
45 * Create the directory =~/src/vmod-new=
46 * Copy entire *acvmod* package to this directory
47 * Initialize an empty Git repository in =~/src/vmod-new=
48 * Register *acvmod* as a Git submodule in this repository.
49 * Populate the directory with the files necessary to build a valid Varnish-Cache module
50 * Add these files to the repository index
51 * Run *autoreconf* to create the *configure* script and Makefiles.
52
53The =~/src/vmod-new= will now contain the following files:
54
55#+BEGIN_EXAMPLE
56COPYING
57Makefile.am
58acvmod/
59configure.ac
60m4/
61src/
62src/Makefile.am
63src/vmod_new.c
64src/vmod_new.vcc
65tests/
66tests/Makefile.am
67tests/atlocal.in
68tests/testsuite.at
69#+END_EXAMPLE
70
71plus the Git infrastructure files and files created by autotools
72(=configure=, =Makefile.am='s, etc.)
73
74Note, that the new project created by *bootstrap* can already be compiled
75with the usual commands:
76
77 #+BEGIN_SRC shell-script
78 ./configure
79 make
80 #+END_SRC
81
82This will produce a module that you can import into your VCL script
83using the
84
85 #+BEGIN_SRC C
86 import new;
87 #+END_SRC
88
89statement. Of course, apart from it, the module won't do anything
90useful, so it's now time to change to =~src/vmod-new=, commit the
91changes and start hacking on the module source files =src/vmod_new.c=
92and =src/vmod_new.vcc=.
93
94** Bootstrap options
95
96The sample *bootstrap* invocation discussed above creates the module
97sources using the default settings. To customize them, a number of
98options are provided. You can always get a comprehensive summary of
99these by running =bootstrap --help=.
100
101*** Strictness level
102
103Automake [[https://www.gnu.org/software/automake/manual/html_node/Strictness.html][strictness level]] defines how stringently Automake checks
104standards conformance when creating =Makefile.in= files. Three
105mutually exclusive options are provided to control strictness:
106=--foreign=, =--gnu=, and =--gnits=. The default is =--foreign=.
107
108If =--gnu= is used, the following additional files will be created:
109=AUTHORS=, =NEWS=, =README=, and =ChangeLog=. The top-level
110=Makefile.am= file will include a rule for updating the latter from
111the git commit history.
112
113If =--gnits= is specified, the above files and the file =THANKS= will
114be created.
115
116*** Module description and URL
117
118+ ~--version=N~ :: Sets module version number. Default value is *0.1*.
119+ ~--description=TEXT~ :: One-line textual description of the module.
120 It will be included in the =$Module= line of the created *vcc*
121 file, and subsequently in the generated manpage. Default text
122 is =No description yet=.
123+ ~--url=URL~ :: URL of the project's web page. It is mentioned, among
124 others, in the generated =README= file.
125+ ~--license=FILE~ :: Name of the file containing short license text,
126 which will be reproduced in heading comments of each created
127 source file. Unless _FILE_ begins with a directory separator
128 (=/=, or =./=. or =../=) it will be looked first in the
129 =acvmod/license= subdirectory, and if not found there, in the
130 current working directory.
131
132*** Personal information
133
134Some of the created files contain the author's personal information,
135such as email and real name. The *bootstrap* tool will do its best to
136deduce this information from the system user database. Use the
137following two options if it guesses wrong:
138
139- ~--email=EMAIL~ :: Sets your email address. The default is your user
140 name, followed by the =@=-sign, followed by the hostname of the
141 machine on which *bootstrap* is run.
142- ~--real-name=TEXT~ :: Your real-world name. By default it is looked up
143 in the _Gecos_ field of your =/etc/passwd= record.
144
145** Another example
146
147The following command was used to create initial set up of the
148[[https://puszcza.gnu.org.ua/projects/vmod-dict][vmod-dict]] module:
149
150 #+BEGIN_SRC shell-script
151 bootstrap --gnu \
152 --git \
153 -C ~/src/vmod-dict \
154 --email gray@gnu.org \
155 --url http://ps.gnu.org.ua/software/vmod-dict \
156 --description='Dictionary look-up for Varnish Cache' \
157 --license=gnu \
158 dict
159 #+END_SRC
160
161* The ~AM_VARNISHAPI~ macro
162
163The =AM_VARNISHAPI= macro is used in =configure.ac= to check whether
164the varnish API components (header files and libraries) are installed
165and are of sufficiently modern version. The macro is invoked with one
166optional argument - the oldest required version of the API:
167
168#+BEGIN_SRC autoconf
169 AM_VARNISHAPI([VERSION])
170#+END_SRC
171
172If =VERSION= argument is supplied, the macro checks if varnish API
173version is the same or newer than that version number. Otherwise, if
174package version string ends in -N.N.N, where N stands for a decimal
175digit, it checks if varnish API version is at least N.N.N.
176If API is older, it emits error message and aborts. If the version is
177newer, a warning message is emitted at the end of configure.
178
179The ~AM_VARNISHAPI~ macro sets the following configuration variables:
180
181- ~VMODDIR~ :: The path of the varnish module directory.
182- ~VARNISH_MAJOR~ :: Major number of the varnish API version.
183- ~VARNISH_MINOR~ :: Minor number of the varnish API version.
184- ~VARNISH_PATCH~ :: Patchlevel number of the varnish API version.
185- ~VARNISHD~ :: Full pathname of the varnishd binary.
186- ~VARNISHTEST~ :: Full pathname of the varnishtest binary.
187- ~VARNISHAPI_PKGDATADIR~ :: Varnish API package data directory.
188- ~VARNISHAPI_VMODTOOL~ :: Absolute pathname of the vmodtool.py script.
189
190* Module installation directory
191
192The produced =configure= script determines the location where
193Varnish looks for loadable modules, and arranges for installing your
194module there. Most of the time that's what you and the end user would
195expect. However, there are cases when such behavior is undesirable.
196
197For example, when packaging the module for distribution in binary
198form, the module should normally go to a temporary installation
199directory outside of the usual system-wide locations. To make it
200possible, the generated =configure= provides the =--with-vmoddir=
201option. Argument to this option defines the directory where to
202install the loadable module.
203
204Another option is =--without-vmoddir=. If supplied, it instructs
205=configure= to follow the the standard practice of installing all files
206to subdirectories below the installation prefix (by default it is
207=/usr/local=; it can be changed via the =--prefix= command line option).
208This option is useful for testing the module. In fact, it is used by
209default when you run =make distcheck= to test and package your module.
210
211* The =top.am= file
212
213The =top.am= file is included in the generated top-level
214=Makefile.am=. This file defines a rule for creating =ChangeLog=
215file from the git log, adds to the distribution the =gencl= script,
216used by that rule, and the file =testsuite.inc=, which
217provides macros for use in testsuite. It also sets up the =distcheck=
218goal to use the =--without-vmoddir= option, described above.
219
220* Testsuite
221