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