1 |
|
2 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
3 |
% |
4 |
% Copyright (c) 2003-2008 by University of Queensland |
5 |
% Earth Systems Science Computational Center (ESSCC) |
6 |
% http://www.uq.edu.au/esscc |
7 |
% |
8 |
% Primary Business: Queensland, Australia |
9 |
% Licensed under the Open Software License version 3.0 |
10 |
% http://www.opensource.org/licenses/osl-3.0.php |
11 |
% |
12 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
13 |
|
14 |
\section{Installing from source for \macosx} |
15 |
\label{sec:srcmac} |
16 |
|
17 |
The following instructions assume you are running the \filename{bash} shell. |
18 |
Comments are indicated with \# characters. |
19 |
|
20 |
Make sure you have the following installed: |
21 |
\begin{itemize} |
22 |
\item \filename{g++} and associated tools. |
23 |
\item \filename{make} |
24 |
\end{itemize} |
25 |
|
26 |
You will also need a copy of the \esfinley source code. |
27 |
If you retrieved the source using subversion, don't forget that one can use the export command instead of checkout to get a smaller copy. |
28 |
For additional visualisation functionality see Section~\ref{sec:linaddfunc}. |
29 |
|
30 |
These instructions will produce the following structure: |
31 |
\begin{itemize} |
32 |
\item \filename{stand}: \begin{itemize} |
33 |
\item \filename{escript.d} |
34 |
\item \filename{packages} |
35 |
\item \filename{package_src} |
36 |
\item \filename{build} |
37 |
\item \filename{doc} |
38 |
\end{itemize} |
39 |
\end{itemize} |
40 |
|
41 |
The build directory can be removed when you are finished. |
42 |
|
43 |
\begin{shellCode} |
44 |
mkdir stand |
45 |
cd stand |
46 |
export PKG_ROOT=`pwd`/packages |
47 |
\end{shellCode} |
48 |
|
49 |
Copy compressed source bundles into \filename{stand/package_src}. |
50 |
Copy documentation files into \filename{doc}. |
51 |
|
52 |
\begin{shellCode} |
53 |
mkdir packages |
54 |
mkdir build |
55 |
cd build |
56 |
tar -jxf ../package_src/Python-2.6.1.tar.bz2 |
57 |
tar -jxf ../package_src/boost_1_38_0.tar.bz2 |
58 |
tar -jxf ../package_src/MesaLib-7.2.tar.bz2 |
59 |
tar -zxf ../package_src/netcdf-4.0.tar.gz |
60 |
tar -zxf ../package_src/vtk-5.2.1.tar.gz |
61 |
tar -zxf ../package_src/vtkdata-5.2.1.tar.gz |
62 |
tar -zxf ../package_src/numarray-1.5.2.tar.gz |
63 |
tar -zxf ../package_src/cmake-2.6.3.tar.gz |
64 |
tar -zxf ../package_src/scons-1.2.0.tar.gz |
65 |
\end{shellCode} |
66 |
|
67 |
Build python. |
68 |
\begin{shellCode} |
69 |
cd Python* |
70 |
|
71 |
./configure --prefix=\$PKG_ROOT/python-2.6.1 \ |
72 |
--exec-prefix=\$PKG_ROOT/python-2.6.1 --enable-shared \ |
73 |
--enable-framework=\$PKG_ROOT/python-2.6.1 2>&1 | tee tt.configure.out |
74 |
|
75 |
make -j2 |
76 |
|
77 |
make install 2>&1 | tee tt.make.out |
78 |
|
79 |
cp ../../packages/python-2.6.1/Python.framework/Versions/2.6/Python \ |
80 |
../../packages/python-2.6.1/lib/libpython2.6.dylib |
81 |
|
82 |
cp ../../packages/python-2.6.1/Python.framework/Versions/2.6/Python \ |
83 |
../../packages/python-2.6.1/lib/libpython.dylib |
84 |
|
85 |
cp ../../packages/python-2.6.1/include/python2.6/pyconfig.h \ |
86 |
../../packages/python-2.6.1/Python.framework/Headers/ |
87 |
|
88 |
cd .. |
89 |
|
90 |
export PATH=\$PKG_ROOT/python/bin:\$PATH |
91 |
export PYTHONHOME=\$PKG_ROOT/python |
92 |
export LD_LIBRARY_PATH=\$PKG_ROOT/python/lib:\$LD_LIBRARY_PATH |
93 |
|
94 |
pushd ../packages |
95 |
ln -s python-2.6.1/ python |
96 |
popd |
97 |
|
98 |
\end{shellCode} |
99 |
|
100 |
Run python to make sure~(check the version number) it works. |
101 |
Now build numarray. |
102 |
|
103 |
\begin{shellCode} |
104 |
cd numarray-1.5.2 |
105 |
|
106 |
python setup.py install \ |
107 |
--gencode --install-lib=\$PKG_ROOT/numarray-1.5.2/lib \ |
108 |
--install-headers=\$PKG_ROOT=\$PKG_ROOT/numarray-1.5.2/include/numarray \ |
109 |
2>&1 | tee tt.install.out |
110 |
|
111 |
|
112 |
export PYTHONPATH=\$PKG_ROOT/numarray/lib:\$PYTHONPATH |
113 |
cd .. |
114 |
pushd ../packages |
115 |
ln -s numarray-1.5.2 numarray |
116 |
popd |
117 |
\end{shellCode} |
118 |
|
119 |
Now we build scons. |
120 |
\begin{shellCode} |
121 |
cd scons-1.2.0 |
122 |
python setup.py install --prefix=\$PKG_ROOT/scons-1.2.0 |
123 |
|
124 |
export PATH=\$PKG_ROOT/scons/bin:\$PATH |
125 |
cd .. |
126 |
pushd ../packages |
127 |
ln -s scons-1.2.0 scons |
128 |
popd |
129 |
\end{shellCode} |
130 |
|
131 |
...Boost libraries ... |
132 |
\begin{shellCode} |
133 |
cd boost_1_38_0 |
134 |
|
135 |
./configure --prefix=\$PKG_ROOT/boost_1_38_0 --with-python-root=\$PKG_ROOT/python \ |
136 |
--with-python-version=2.6 --with-libraries=python |
137 |
|
138 |
make -j2 |
139 |
make install |
140 |
ln -s \$PKG_ROOT/boost_1_38_0 \$PKG_ROOT/boost |
141 |
export LD_LIBRARY_PATH=\$PKG_ROOT/boost/lib:\$LD_LIBRARY_PATH |
142 |
cd .. |
143 |
pushd ../packages |
144 |
ln -s boost_1_38_0 boost |
145 |
popd |
146 |
\end{shellCode} |
147 |
|
148 |
... and netcdf. |
149 |
\begin{shellCode} |
150 |
cd netcdf-4.0 |
151 |
CFLAGS="-O2 fPIC -Df2cFortran" CXXFLAGS="-O2 fPIC -Df2cFortran" \ |
152 |
FFLAGS="-O2 fPIC -Df2cFortran" FCFLAGS="-O2 fPIC -Df2cFortran" \ |
153 |
./configure --prefix=\$PKG_ROOT/netcdf-4.0 |
154 |
|
155 |
make -j2 |
156 |
make install |
157 |
|
158 |
export LD_LIBRARY_PATH=\$PKG_ROOT/netcdf/lib:\$LD_LIBRARY_PATH |
159 |
cd .. |
160 |
pushd ../packages |
161 |
ln -s netcdf-4.0 netcdf |
162 |
popd |
163 |
\end{shellCode} |
164 |
|
165 |
CMake and Mesa are required for VTK. |
166 |
\begin{shellCode} |
167 |
cd cmake-2.6.3 |
168 |
./configure --prefix=\$PKG_ROOT/cmake-2.6.3 2>&1 | tee tt.configure |
169 |
make -j 4 |
170 |
make install |
171 |
|
172 |
export PATH=\$PKG_ROOT/cmake/bin:\$PATH |
173 |
cd .. |
174 |
pushd ../packages |
175 |
ln -s cmake-2.6.3 cmake |
176 |
popd |
177 |
\end{shellCode} |
178 |
|
179 |
These instructions do not compile MesaDemos or GLUT. |
180 |
If you need to check if Mesa compiled correctly, then the demos are a good test. |
181 |
\begin{shellCode} |
182 |
cd Mesa-7.2 |
183 |
./configure --prefix=\$PKG_ROOT/mesa-7.2 --enable-gl-osmesa |
184 |
|
185 |
make -j 4 |
186 |
make install |
187 |
|
188 |
export LD_LIBRARY_PATH=\$PKG_ROOT/mesa:\$LD_LIBRARY_PATH |
189 |
cd .. |
190 |
pushd ../packages |
191 |
ln -s mesa-7.2 mesa |
192 |
popd |
193 |
\end{shellCode} |
194 |
|
195 |
\begin{shellCode} |
196 |
cd VTK |
197 |
cmake . |
198 |
|
199 |
#Edit the CMakeCache and make the following changes: |
200 |
#(Please replace .... with an absolute path to the stand directory) |
201 |
|
202 |
#----------------- |
203 |
|
204 |
BUILD_EXAMPLES should be OFF |
205 |
BUILD_SHARED_LIBS should be ON |
206 |
|
207 |
CMAKE_INSTALL_PREFIX ..../stand/packages/vtk-5.2.1 |
208 |
CMAKE_VERBOSE_MAKEFILE TRUE |
209 |
|
210 |
#check PYTHON_EXECUTABLE is correct. |
211 |
#but it seems to be when I went through these steps |
212 |
|
213 |
VTK_OPENGL_HAS_OSMESA TRUE |
214 |
VTK_USE_64BIT_IDS ON |
215 |
# That last one is marked as "May cause some bugs" in the original instructions |
216 |
|
217 |
VTK_WRAP_PYTHON ON |
218 |
VTK_USE_MANGLED_MESA OFF |
219 |
|
220 |
#-------------------- |
221 |
|
222 |
cmake . |
223 |
#It won't work but it will put some variables in that you need. |
224 |
|
225 |
#Edit CMakeCache again and make the following changes |
226 |
|
227 |
#---------------- |
228 |
|
229 |
VTK_USE_TK OFF |
230 |
|
231 |
OSMESA_INCLUDE_DIR ..../stand/packages/mesa/include |
232 |
|
233 |
OSMESA_LIBRARY ..../stand/packages/mesa/lib/libOSMesa.dylib |
234 |
|
235 |
PYTHON_INCLUDE_PATH ..../stand/packages/python/include/python2.6 |
236 |
|
237 |
PYTHON_LIBRARY ..../stand/packages/python/lib/libpython2.6.dylib |
238 |
|
239 |
OPENGL_INCLUDE_DIR ..../stand/packages/mesa/include |
240 |
|
241 |
OPENGL_gl_LIBRARY ..../stand/packages/mesa/lib/libGL.dylib |
242 |
|
243 |
#---------------- |
244 |
|
245 |
cmake . |
246 |
make |
247 |
make install |
248 |
|
249 |
|
250 |
cd ../../packages |
251 |
ln -s vtk-5.2.1 vtk |
252 |
cd .. |
253 |
\end{shellCode} |
254 |
|
255 |
Now copy the \esfinley source into an \filename{escript.d} directory in \filename{stand}. |
256 |
|
257 |
\begin{shellCode} |
258 |
cd scons |
259 |
cp mac_options_example.py YourMachineName_options.py |
260 |
|
261 |
#edit the options file and make the following changes: |
262 |
#----------------------------------------------------------------- |
263 |
declare a PKG_ROOT variable at the top of the file eg: |
264 |
PKG_ROOT='/Users/artak/stand/packages' |
265 |
|
266 |
python_path = PKG_ROOT+'python/include/python2.6' |
267 |
python_lib_path = PKG_ROOT+'python/lib' |
268 |
python_libs = 'python2.6' |
269 |
|
270 |
boost_path = PKG_ROOT+'boost/include/boost-1_38' |
271 |
boost_lib_path = PKG_ROOT+'boost/lib' |
272 |
boost_libs = ['boost_python-gcc43-mt'] |
273 |
# You could simlink the boost python library to give a shorter |
274 |
# name but it's not worth it |
275 |
|
276 |
usevtk = 'yes' |
277 |
#------------------------------------------------------------------- |
278 |
|
279 |
ln -s \$PKG_ROOT/vtk-5.2.1 \$PKG_ROOT/vtk |
280 |
|
281 |
Modify /scripts/finley_wrapper_template |
282 |
|
283 |
STANDALONE=1 |
284 |
|
285 |
#Check to make sure the paths in the if [ \$STANDALONE == 1 ] |
286 |
# Section are correct |
287 |
|
288 |
#----------------------------------------------------------------- |
289 |
|
290 |
scons bin/escript |
291 |
|
292 |
#start a new terminal |
293 |
cd stand |
294 |
export PATH=`pwd`/packages/scons/bin:\$PATH |
295 |
cd escript.d |
296 |
eval `bin/escript -e` |
297 |
scons |
298 |
\end{shellCode} |
299 |
|
300 |
If you wish to test your build, then you can do the following. |
301 |
Note this may take a while if you have a slow processor and/or less than 1Gb of RAM. |
302 |
\begin{shellCode} |
303 |
scons all_tests |
304 |
\end{shellCode} |
305 |
|
306 |
Once you are satisfied, the \filename{build} and \filename{\$PKG_ROOT/build} directories can be removed. |
307 |
Within the \filename{packages} directory, the \filename{scons}, \filename{scons-1.2.0}, \filename{cmake-2.6.3} and \filename{cmake} entries can also be removed. |
308 |
If you are not redistributing this bundle you can remove \filename{\$PKG_ROOT/package_src}. |
309 |
|
310 |
If you do not plan to edit or recompile the source you can remove it. |
311 |
The only entries which are required in \filename{escript.d} are: |
312 |
\begin{itemize} |
313 |
\item \filename{bin} |
314 |
\item \filename{esys} |
315 |
\item \filename{include} |
316 |
\item \filename{lib} |
317 |
\item \filename{README_LICENSE} |
318 |
\end{itemize} |
319 |
|
320 |
Hidden files can be removed with |
321 |
\begin{shellCode} |
322 |
find . -name .?* | xargs rm -rf |
323 |
\end{shellCode} |
324 |
|
325 |
\section{Additional Functionality}\label{sec:macddfunc} |
326 |
To perform visualisations you will need some additional tools. |
327 |
Since these do not need to be linked with any of the packages above, you can install versions available for your |
328 |
system, or build them from source. |
329 |
\begin{itemize} |
330 |
\item \filename{ppmtompeg} and \filename{jpegtopnm} from the \filename{netpbm} suite. - To build from source |
331 |
you would also need \filename{libjpeg} and its headers as well as \filename{libpng}\footnote{libpng requires zlib to build} and its headers. |
332 |
\item A tool to visualise VTK files. For example Mayavi or Visit. |
333 |
\end{itemize} |