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