]>
Commit | Line | Data |
---|---|---|
b3695c67 FM |
1 | WHY SWITCH TO CMAKE |
2 | ||
3cb25232 FM |
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. | |
b3695c67 | 8 | |
3cb25232 FM |
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. | |
b3695c67 | 12 | |
9632855c FM |
13 | Any comment about the usage of cmake is welcome. |
14 | ||
b3695c67 | 15 | |
9a2efbd0 FM |
16 | |
17 | ||
b3695c67 FM |
18 | CONFIGURING SARG |
19 | ||
3cb25232 FM |
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 | |
b008f87f FM |
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 directory at the same level as the sources | |
29 | of sarg and cd into that directory. | |
b3695c67 FM |
30 | |
31 | Configure sarg with the command | |
32 | ||
33 | ccmake ../sarg | |
34 | ||
3cb25232 FM |
35 | On the first run, it will report that the cache is empty. Press 'c' to configure |
36 | the cache. Then ccmake will display an interface to select some configuration | |
37 | options. You should set the CMAKE_INSTALL_PREFIX to the root of the directory to | |
38 | install sarg, for instance: /usr. You may also need to change SYSCONFDIR to | |
39 | /etc/sarg to install the configuration files at that location. | |
b3695c67 | 40 | |
3cb25232 FM |
41 | Then press 'c' again to reconfigure sarg. Four more configuration variables |
42 | appear. They are build from the paths you provided for the installation | |
43 | directories of the components. These are the absolute paths sarg will use to | |
44 | find the corresponding files. You then have the opportunity to adjust them if | |
45 | the final location of the files it not what is resolved with the installed | |
46 | configuration. | |
b3695c67 FM |
47 | |
48 | Finally, press 'g' to generate the final configuration. | |
49 | ||
50 | Compile with | |
51 | ||
52 | make | |
53 | ||
54 | Install with | |
55 | ||
56 | make install | |
57 | ||
58 | ||
9a2efbd0 FM |
59 | |
60 | ||
b3695c67 FM |
61 | CONFIGURATION VARIABLES |
62 | ||
63 | These configuration variables are available on the first configuration run. | |
64 | ||
65 | CMAKE_INSTALL_PREFIX - The root of the installation. | |
9632855c | 66 | default: /usr/local |
b3695c67 | 67 | |
3cb25232 FM |
68 | SYSCONFDIR - The directory with the configuration files relative to the |
69 | installation prefix. | |
b3695c67 FM |
70 | default: etc/sarg |
71 | ||
72 | BINDIR - The directory to copy sarg executable to. | |
73 | default: bin | |
74 | ||
75 | MANDIR - The directory to install the man page. | |
76 | default: share/man | |
77 | ||
78 | LANGDIR - The directory to copy the languages files to. | |
79 | default: share/sarg/languages | |
80 | ||
81 | FONTDIR - The directory where the fonts for the reports are located. | |
82 | default: share/sarg/fonts | |
83 | ||
84 | IMAGEDIR - The directory containing the images to use in the reports. | |
85 | default: share/sarg/images | |
86 | ||
05b90947 FM |
87 | ENABLE_EXTRA_PROTECT - Compile sarg with some GCC options to increase the |
88 | security (tolerate no compilation warning, use the stack smashing | |
89 | protection, improved printf check, and so on). | |
90 | default: use standard warnings and no protection. | |
91 | ||
3cb25232 FM |
92 | These variables are initialized with the values of the above variables and are |
93 | available on the second run. | |
b3695c67 | 94 | |
3cb25232 FM |
95 | SYSCONFDIR_SOURCE - The full path to the configuration files to compile in |
96 | sarg. | |
b3695c67 FM |
97 | default: CMAKE_INSTALL_PREFIX/SYSCONFDIR |
98 | ||
99 | LANGDIR_SOURCE - The full path to the languages files to compile in sarg. | |
100 | default: CMAKE_INSTALL_PREFIX/LANGDIR | |
101 | ||
102 | FONTDIR_SOURCE - The full path to the fonts to compile in sarg. | |
103 | default: CMAKE_INSTALL_PREFIX/FONTDIR | |
104 | ||
105 | IMAGEDIR_SOURCE - The full path to the images to compile in sarg. | |
106 | default: CMAKE_INSTALL_PREFIX/IMAGEDIR | |
107 | ||
3cb25232 FM |
108 | They are other configuration variables whose documentation is visible during the |
109 | configuration with ccmake. | |
b3695c67 | 110 | |
9a2efbd0 FM |
111 | |
112 | ||
113 | ||
114 | COMPILATION WITH MSYS+MINGW | |
115 | ||
116 | The autotools don't compile sarg with msys. You have to use cmake in an msys | |
117 | terminal. | |
118 | ||
119 | If cmake is not already installed on your system, download and uncompress the | |
120 | cmake sources in your home directory then run the following commands in an msys | |
121 | terminal: | |
122 | ||
123 | configure | |
124 | make | |
125 | make install | |
126 | ||
127 | Permanently add the path to cmake.exe by appending this line at the end of your | |
128 | profile file (c:/msys/1.0/etc/profile): | |
129 | ||
130 | export PATH="$PATH:/c/Program files/CMake/bin" | |
131 | ||
132 | Reopen the msys terminal or run the above command in the same terminal to | |
133 | register the new path. | |
134 | ||
135 | Get the sources of sarg and uncompress them in your home directory. Let's assume | |
136 | they are in a directory named "sarg". | |
137 | ||
138 | Create a separate directory at the same level as the sources of sarg and change | |
139 | to that directory. For instance, assuming your prompt is in the sarg directory, | |
140 | run the following commands: | |
141 | ||
142 | mkdir ../bin | |
143 | cd ../bin | |
144 | ||
145 | Configure, compile and install sarg: | |
146 | ||
147 | cmake ../sarg -G "MSYS Makefiles" | |
148 | make | |
149 | make install | |
150 | ||
151 | This will compile sarg outside of the sources and install it in c:\Program | |
152 | Files\sarg. | |
153 | ||
154 | If the compilation fails because mkstemp cannot be found, ensure that the LIB | |
155 | and INCLUDE environment variables are set properly to the lib and include | |
156 | directories of mingw. For instance, type the following two commands and run make | |
157 | again: | |
158 | ||
159 | export LIB=c:/mingw/lib | |
160 | export INCLUDE=c:/mingw/include | |
161 | ||
162 | You can make them permanent by appending those two commands at the end of the | |
163 | profile file in c:/msys/1.0/etc/profile. | |
164 | ||
165 | ||
166 | ||
167 | ||
168 | CONFIGURING SARG TO RUN ON WINDOWS | |
169 | ||
170 | Cmake install a sample configuration file in c:/Program | |
171 | Files/sarg/etc/sarg/sarg.conf.exemple. Rename it as sarg.conf and edit it. | |
172 | ||
173 | You 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 | ||
179 | Adjust and create the directories according to your configuration. | |
180 | ||
181 | You may have to adjust other options to suit your needs. | |
182 | ||
183 | If sarg complains about a missing rm or sort command, then you have to install | |
184 | the unxtools or run sarg from msys. | |
185 | ||
186 | If you want to run sarg from a regular dos prompt, download UnxUtils.zip from | |
187 | http://unxutils.sourceforge.net/ and uncompress it somewhere. Change the system | |
188 | path to include the usr\local\wbin directory before the Windows system | |
189 | directory. | |
190 | ||
191 | You must be sure that the unxutils are found before the windows native commands. | |
192 | To check this, open a dos prompt and type | |
193 | ||
194 | ls | |
195 | ||
196 | If it list the content of the directory, then the unxutils are found. Then type | |
197 | ||
198 | sort --help | |
199 | ||
200 | It should display the help of the sort command if the unxutils command is found | |
201 | first. If the windows command is found first, it will complain that the --help | |
202 | file cannot be found. | |
203 | ||
204 | Finally, if sort complains that it cannot write in the /tmp directory, either | |
205 | create that directory or set TMPDIR like this: | |
206 | ||
207 | set TMPDIR=c:/Program Files/sarg/tmp | |
208 | ||
209 | It may be set to your TMP or TEMP directory or the temporary directory you named | |
210 | in your sarg.conf file. |