Fix the stable designation on the tarball name for stable builds.
[privoxy.git] / doc / source / buildsource.sgml
1 <!--
2  File        :  $Source: /cvsroot/ijbswa/current/doc/source/buildsource.sgml,v $
3
4  Purpose     :  Entity included in other project documents.
5                 
6  $Id: buildsource.sgml,v 2.16 2009/01/13 16:50:35 fabiankeil Exp $
7
8  Copyright (C) 2001-2008 Privoxy Developers http://www.privoxy.org/
9  See LICENSE.
10
11  ======================================================================
12   This file used for inclusion with other documents only.
13  ======================================================================
14
15  If you make changes to this file, please verify the finished 
16  docs all display as intended.
17
18  This file is included into:
19
20   user-manual
21   INSTALL
22
23 -->
24 <para>
25  To build <application>Privoxy</application> from source, 
26  <ulink url="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</ulink>,
27  <ulink
28  url="http://www.gnu.org/software/make/make.html">GNU make
29  (gmake)</ulink>, and, of course, a C compiler like <ulink
30  url="http://www.gnu.org/software/gcc/gcc.html">gcc</ulink> are required.
31 </para>
32
33 <para>
34  When building from a source tarball,
35 <!-- 
36  no longer available ...
37  <ulink
38  url="http://cvs.sourceforge.net/cvstarballs/ijbswa-cvsroot.tar.gz">nightly CVS
39  tarball</ulink>), 
40 --> first unpack the source: 
41 </para>
42
43 <para>
44  <screen>
45  tar xzvf
46  privoxy-&p-version;<![%p-not-stable;[-beta]]><![%p-stable;[-stable]]>-src* [.tgz or .tar.gz]
47  cd privoxy-&p-version;<![%p-not-stable;[-beta]]>
48 </screen>
49 </para>
50
51 <para>
52  For retrieving the current CVS sources, you'll need a CVS client installed.
53  Note that sources from CVS are typically development quality, and may not be
54  stable, or well tested. To download CVS source, check the Sourceforge
55  documentation, which might give commands like:
56 </para>
57
58 <para>
59  <screen>
60   cvs -d:pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa login
61   cvs -z3 -d:pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa co current
62   cd current
63 </screen>
64 </para>
65
66 <para>
67  This will create a directory named <filename>current/</filename>, which will 
68  contain the source tree.
69 </para>
70
71 <para>
72  You can also check out any <application>Privoxy</application>
73  <quote>branch</quote>, just exchange the <application>current</application>
74  name with the wanted branch name (Example: v_3_0_branch for the 3.0 cvs
75  tree).
76 </para>
77
78 <para>
79  It is also strongly recommended to not run <application>Privoxy</application>
80  as root. You should configure/install/run <application>Privoxy</application> as
81  an unprivileged user, preferably by  creating a <quote>privoxy</quote> user
82  and group just for this purpose. See your local documentation for the correct
83  command line to do add new users and groups (something like
84  <command>adduser</command>, but the command syntax may vary from platform
85  to platform). 
86 </para>
87
88 <para>
89  <filename>/etc/passwd</filename> might then look like:
90 </para>
91
92 <para>
93  <screen>  privoxy:*:7777:7777:privoxy proxy:/no/home:/no/shell</screen>
94 </para>
95
96 <para>
97  And then <filename>/etc/group</filename>, like:
98 </para>
99
100 <para>
101  <screen>  privoxy:*:7777:</screen>
102 </para>
103
104 <para>
105  Some binary packages may do this for you.
106 </para>
107
108 <para>
109  Then, to build from either unpacked tarball or CVS source:
110 </para>
111
112 <para>
113  <screen>
114  autoheader
115  autoconf
116  ./configure      # (--help to see options)
117  make             # (the make from GNU, sometimes called gmake) 
118  su               # Possibly required
119  make -n install  # (to see where all the files will go)
120  make -s install  # (to really install, -s to silence output)</screen>
121 </para>
122
123 <para>
124   Using GNU <command>make</command>, you can have the first four steps
125   automatically done for you by just typing:
126 </para>
127
128 <para>
129  <screen>
130   make
131 </screen>
132 </para>
133
134 <para>
135   in the freshly downloaded or unpacked source directory.
136 </para>
137
138 <para>
139  To build an executable with security enhanced features so that 
140  users cannot easily bypass the proxy (e.g. <quote>Go There Anyway</quote>), or
141  alter their own configurations, <command>configure</command> like this:
142 </para>
143 <para>
144  <screen>
145  ./configure  --disable-toggle  --disable-editor  --disable-force</screen>
146 </para> 
147 <para>
148 Then build as above. In Privoxy 3.0.7 and later, all of these options
149 can also be disabled through the configuration file.
150 </para>
151 <para>
152  <emphasis>WARNING:</emphasis> If installing as root, the install will fail
153  unless a non-root user or group is specified, or a <literal>privoxy</literal>
154  user and group already exist on the system. If a non-root user is specified,
155  and no group, then the installation will try to also use a group of the same name
156  as <quote>user</quote>. If a group is specified (and no user), then the
157  support files will be installed as writable by that group, and owned by the
158  user running the installation.
159 </para>
160
161 <para>
162  <command>configure</command> accepts <literal>--with-user</literal> and
163  <literal>--with-group</literal> options for setting user and group ownership
164  of the configuration files (which need to be writable by the daemon). The
165  specified <emphasis>user must already exist</emphasis>. When starting
166  <application>Privoxy</application>, it must be run as this same user to
167  insure write access to configuration and log files!
168 </para>
169
170 <para>
171  Alternately, you can specify <literal>user</literal> and <literal>group</literal>
172  on the <command>make</command> command line, but be sure both already exist:
173 </para>
174
175 <para>
176  <screen>
177  make -s install  USER=privoxy GROUP=privoxy</screen>
178 </para>
179
180 <para>
181  The default installation path for <command>make install</command> is 
182  <filename>/usr/local</filename>. This may of course be customized with 
183  the various <command>./configure</command> path options. If you are doing 
184  an install to anywhere besides <filename>/usr/local</filename>, be
185  sure to set the appropriate paths with the correct configure options
186  (<command>./configure --help</command>). Non-privileged users must of course
187  have write access permissions to wherever the target installation is going.
188 </para>
189
190 <para>
191  If you do install to <filename>/usr/local</filename>, the install will use
192  <literal>sysconfdir=$prefix/etc/privoxy</literal> by default. All other
193  destinations, and the direct usage of <literal>--sysconfdir</literal> flag
194  behave like normal, i.e. will not add the extra <filename>privoxy</filename>
195  directory. This is for a safer install, as there may already exist another
196  program that uses a file with the <quote>config</quote> name, and thus makes
197  <filename>/usr/local/etc</filename> cleaner.
198 </para>
199
200 <para>
201  If installing to <filename>/usr/local</filename>, the documentation will go
202  by default to <filename>$prefix/share/doc</filename>. But if this directory
203  doesn't exist, it will then try <filename>$prefix/doc</filename> and install
204  there before creating a new <filename>$prefix/share/doc</filename> just for
205  <application>Privoxy</application>.
206 </para>
207
208 <para>
209  Again, if the installs goes to <filename>/usr/local</filename>, the
210  <literal>localstatedir</literal> (ie: <filename>var/</filename>) will default
211  to <filename>/var</filename> instead of <literal>$prefix/var</literal> so
212  the logs will go to <filename>/var/log/privoxy/</filename>, and the pid file
213  will be created in <filename>/var/run/privoxy.pid</filename>. 
214 </para>
215
216 <para>
217  <command>make install</command> will attempt to set the correct values 
218  in <filename>config</filename> (main configuration file). You should  
219  check this to make sure all values are correct. If appropriate,
220  an init script will be installed, but it is up to the user to determine 
221  how and where to start <application>Privoxy</application>. The init 
222  script should be checked for correct paths and values, if anything other than
223  a default install is done.
224 </para>
225
226 <para>
227  If install finds previous versions of local configuration files, most of
228  these will not be overwritten, and the new ones will be installed with a
229  <quote>new</quote> extension. default.action and default.filter
230  <emphasis>will be overwritten</emphasis>. You will then need
231  to manually update the other installed configuration files as needed. The
232  default template files <emphasis>will</emphasis> be overwritten. If you have
233  customized, local templates, these should be stored safely in a separate
234  directory and defined in <filename>config</filename> by the
235  <quote>templdir</quote> directive. It is of course wise to always back-up any
236  important configuration files <quote>just in case</quote>. If a previous
237  version of <application>Privoxy</application> is already running, you will
238  have to restart it manually.
239 </para>
240
241 <para>
242  For more detailed instructions on how to build Redhat RPMs,
243  Windows self-extracting installers, building on platforms with
244  special requirements etc, please consult the <ulink
245  url="../developer-manual/newrelease.html">developer manual</ulink>.
246 </para>
247
248 <!-- print for README only -->
249 <!-- Actually this is now in INSTALL -->
250  <![%p-readme;[
251 <para>
252  The simplest command line to start <application>Privoxy</application> is 
253  <command>$path/privoxy --user=privoxy  $path/etc/privoxy/config</command>. 
254  See <command>privoxy --usage</command>, or the man page, for other options, 
255  and configuration.
256 </para>
257 ]]>