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