]> git.ipfire.org Git - thirdparty/sarg.git/blame - README_cmake
Add support to decompress xz files
[thirdparty/sarg.git] / README_cmake
CommitLineData
b3695c67
FM
1WHY SWITCH TO CMAKE
2
3cb25232
FM
3I (Frederic Marchal) could not make the autotools work with msys+mingw. The
4choices reduced to: fight some more time with the autotools; wait until the msys
5port evolved or switch to cmake. Despite not being familiar with cmake, I
6decided to give it a chance and was surprised to come up within a few hours
7with something capable of compiling sarg.
b3695c67 8
3cb25232
FM
9Now, that doesn't mean that the autotools are to be discarded on the spot. The
10two systems may coexist for some times especially since it is my first project
11with cmake and I'm sure it is done in an definitely autotoolistic way.
b3695c67 12
9632855c
FM
13Any comment about the usage of cmake is welcome.
14
b3695c67 15
9a2efbd0
FM
16
17
b3695c67
FM
18CONFIGURING SARG
19
3cb25232
FM
20It is recommended to build sarg out of the source directory. It makes it easier
21to delete the build directory completely and restart the configuration from
b008f87f
FM
22scratch if the first attempt doesn't produce the expected result.
23
24If you intent to use both cmake and the autotools, then you MUST build sarg out
25of the source directory as it will overwrite the original stub config.h in the
26source directory and you won't be able to use the autotools afterward.
27
027aa648
FM
28To build sarg out of source, create a build directory and cd into that directory.
29For instance, assuming your prompt is in the source directory, run
b3695c67 30
027aa648
FM
31 mkdir build
32 cd build
b3695c67 33
027aa648
FM
34Configure sarg with the command (assuming the case of a build directory one level
35below the sources of sarg):
36
37 ccmake ..
b3695c67 38
3cb25232
FM
39On the first run, it will report that the cache is empty. Press 'c' to configure
40the cache. Then ccmake will display an interface to select some configuration
41options. You should set the CMAKE_INSTALL_PREFIX to the root of the directory to
42install sarg, for instance: /usr. You may also need to change SYSCONFDIR to
43/etc/sarg to install the configuration files at that location.
b3695c67 44
3cb25232
FM
45Then press 'c' again to reconfigure sarg. Four more configuration variables
46appear. They are build from the paths you provided for the installation
47directories of the components. These are the absolute paths sarg will use to
48find the corresponding files. You then have the opportunity to adjust them if
49the final location of the files it not what is resolved with the installed
50configuration.
b3695c67
FM
51
52Finally, press 'g' to generate the final configuration.
53
54Compile with
55
56 make
57
58Install with
59
60 make install
61
62
9a2efbd0
FM
63
64
b3695c67
FM
65CONFIGURATION VARIABLES
66
67These configuration variables are available on the first configuration run.
68
69 CMAKE_INSTALL_PREFIX - The root of the installation.
9632855c 70 default: /usr/local
b3695c67 71
3cb25232
FM
72 SYSCONFDIR - The directory with the configuration files relative to the
73 installation prefix.
b3695c67
FM
74 default: etc/sarg
75
76 BINDIR - The directory to copy sarg executable to.
77 default: bin
78
79 MANDIR - The directory to install the man page.
80 default: share/man
81
b3695c67
FM
82 FONTDIR - The directory where the fonts for the reports are located.
83 default: share/sarg/fonts
84
85 IMAGEDIR - The directory containing the images to use in the reports.
86 default: share/sarg/images
87
027aa648
FM
88 SARGPHPDIR - The directory to install sarg-php.
89 default: share/sarg/sarg-php
90
05b90947
FM
91 ENABLE_EXTRA_PROTECT - Compile sarg with some GCC options to increase the
92 security (tolerate no compilation warning, use the stack smashing
93 protection, improved printf check, and so on).
94 default: use standard warnings and no protection.
95
3cb25232
FM
96These variables are initialized with the values of the above variables and are
97available on the second run.
b3695c67 98
3cb25232
FM
99 SYSCONFDIR_SOURCE - The full path to the configuration files to compile in
100 sarg.
b3695c67
FM
101 default: CMAKE_INSTALL_PREFIX/SYSCONFDIR
102
b3695c67
FM
103 FONTDIR_SOURCE - The full path to the fonts to compile in sarg.
104 default: CMAKE_INSTALL_PREFIX/FONTDIR
105
106 IMAGEDIR_SOURCE - The full path to the images to compile in sarg.
107 default: CMAKE_INSTALL_PREFIX/IMAGEDIR
108
027aa648 109There are other configuration variables whose documentation is visible during the
3cb25232 110configuration with ccmake.
b3695c67 111
9a2efbd0
FM
112
113
114
115COMPILATION WITH MSYS+MINGW
116
117The autotools don't compile sarg with msys. You have to use cmake in an msys
118terminal.
119
120If cmake is not already installed on your system, download and uncompress the
121cmake sources in your home directory then run the following commands in an msys
122terminal:
123
124 configure
125 make
126 make install
127
128Permanently add the path to cmake.exe by appending this line at the end of your
129profile file (c:/msys/1.0/etc/profile):
130
131 export PATH="$PATH:/c/Program files/CMake/bin"
132
133Reopen the msys terminal or run the above command in the same terminal to
134register the new path.
135
136Get the sources of sarg and uncompress them in your home directory. Let's assume
137they are in a directory named "sarg".
138
027aa648
FM
139Create a separate build directory and change to that directory. For instance,
140assuming your prompt is in the sarg directory, run the following commands:
9a2efbd0 141
027aa648
FM
142 mkdir build
143 cd build
9a2efbd0
FM
144
145Configure, compile and install sarg:
146
027aa648 147 cmake .. -G "MSYS Makefiles"
9a2efbd0
FM
148 make
149 make install
150
151This will compile sarg outside of the sources and install it in c:\Program
152Files\sarg.
153
154If the compilation fails because mkstemp cannot be found, ensure that the LIB
155and INCLUDE environment variables are set properly to the lib and include
156directories of mingw. For instance, type the following two commands and run make
157again:
158
159 export LIB=c:/mingw/lib
160 export INCLUDE=c:/mingw/include
161
162You can make them permanent by appending those two commands at the end of the
163profile file in c:/msys/1.0/etc/profile.
164
165
166
167
168CONFIGURING SARG TO RUN ON WINDOWS
169
170Cmake install a sample configuration file in c:/Program
171Files/sarg/etc/sarg/sarg.conf.exemple. Rename it as sarg.conf and edit it.
172
173You must change the following options:
174
175 access_log c:/Program Files/sarg/log/access.log
176 temporary_dir c:/Program Files/sarg/tmp
177 output_dir c:/Program Files/sarg/www/squid-reports
178
179Adjust and create the directories according to your configuration.
180
181You may have to adjust other options to suit your needs.
182
027aa648 183If sarg complains about a missing sort command, then you have to install
9a2efbd0
FM
184the unxtools or run sarg from msys.
185
186If you want to run sarg from a regular dos prompt, download UnxUtils.zip from
187http://unxutils.sourceforge.net/ and uncompress it somewhere. Change the system
188path to include the usr\local\wbin directory before the Windows system
189directory.
190
191You must be sure that the unxutils are found before the windows native commands.
192To check this, open a dos prompt and type
193
194ls
195
196If it list the content of the directory, then the unxutils are found. Then type
197
198sort --help
199
200It should display the help of the sort command if the unxutils command is found
201first. If the windows command is found first, it will complain that the --help
202file cannot be found.
203
204Finally, if sort complains that it cannot write in the /tmp directory, either
205create that directory or set TMPDIR like this:
206
207 set TMPDIR=c:/Program Files/sarg/tmp
208
209It may be set to your TMP or TEMP directory or the temporary directory you named
210in your sarg.conf file.