]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install.sh
*** empty log message ***
[creaToolsTools.git] / Linux / scripts / ThirdParty-install.sh
1 #!/bin/sh
2  if [ ! -f $PWD/scripts/CreaTools-configure.sh ]
3  then 
4    echo
5    echo "..ERROR.."
6    echo "==================================================="
7    echo "REMEMBER !"
8    echo ""
9    echo "YOU NEED TO RUN 'Configure' (0) First !"
10    echo "==================================================="
11    echo
12    echo
13    exit 0
14 fi 
15
16 source $PWD/scripts/CreaTools-configure.sh
17
18    echo "------"
19    echo $PWD/scripts/CreaTools-configure.sh
20    echo --generationdir--
21    echo $generationdir
22    echo --docgeneration--
23    echo $docgeneration
24    echo --installPrefix--
25    echo $installPrefix
26    echo --installPrefixThird--
27    echo $installPrefixThird
28    echo --buildType--
29    echo $buildType
30    echo --gdcmVersion--
31    echo $gdcmVersion
32 #   echo --sourcesFrom--
33 #   echo $sourcesFrom
34 #   echo --scriptDir--
35 #   echo $scriptDir
36 #   echo --start_point--
37 #   echo $start_point
38    echo "------"
39
40
41 scriptDir=$PWD
42 sourcesDir=$generationdir/thirdparty_sources
43 binDir=$generationdir/thirdparty_bin
44
45 if [ ! -e $generationdir ]
46 then
47    mkdir $generationdir
48    chown $loginUserName:$loginGroupName $generationdir
49    mkdir $sourcesDir
50    mkdir $binDir
51 fi
52
53
54 # the following stupid test is used at debug time; Please don't remove!
55 if [ true = true ]
56 #if [ true = false ]
57 then
58
59   case "$OperatingSystem" in
60   Fedora)
61      yum install cmake -y 
62      yum install cmake-gui -y 
63      yum install doxygen -y
64      yum install graphviz -y
65      yum install texlive -y
66      yum install latex2html -y
67      yum install wxGTK-devel wxBase -y
68      yum install boost-devel -y
69      yum install sqlite-devel -y
70      yum install qt-devel -y
71      yum install mesa-libOSMesa-devel -y
72      ;;
73   Ubuntu)  
74      apt-get --yes install build-essential  # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
75      apt-get --yes install cmake
76      apt-get --yes install cmake-gui
77      apt-get --yes install cmake-curses-gui
78      apt-get --yes install doxygen
79      apt-get --yes install graphviz
80      apt-get --yes install texlive
81      apt-get --yes install latex2html
82      apt-get --yes install libgtk2.0-dev #GTK
83      apt-get --yes install libwxgtk2.8-dev #Wx GTK
84      apt-get --yes install libwxbase2.8-dev #Wx solito
85      apt-get --yes install libboost-dev  #Boost
86      apt-get --yes install libboost-all-dev #Boost
87      apt-get --yes install libqt4-dev #QT4
88      apt-get --yes install sqlite
89      apt-get --yes install libsqlite0-dev
90      apt-get --yes install libosmesa6-dev #Mesa6
91      apt-get --yes install uuid-dev # uuid para la instalacion de itk
92      apt-get --yes install libxaw7-dev # X11
93      ;;
94   MacOS)
95 # QUESTION : is -y  mandatory?
96
97      port install cmake -y 
98      port install cmake-gui -y 
99      port install doxygen -y
100      port install graphviz -y
101      port install texlive -y
102      port install latex2html -y
103      port install wxGTK-devel wxBase -y
104      port install boost-devel -y
105      port install sqlite-devel -y
106      port install qt-devel -y
107      port install mesa-libOSMesa-devel -y
108      ;;
109   *)
110      #echo " '$OperatingSystem' : Unknown (for us...) Operating Sytem "
111      echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
112      exit 0
113      ;;
114   esac             
115 fi
116
117
118
119 # the following stupid test is used at debug time; Please don't remove!
120 #if [ true = false ]
121 if [ true = true ]
122 then
123   rm -rf $sourcesDir/VTK*
124   rm -rf $sourcesDir/vtk*
125   rm -rf $sourcesDir/InsightToolkit*
126   rm -rf $sourcesDir/gdcm*
127   rm -rf $sourcesDir/tth*
128
129   rm -rf $binDir/gdcm*
130   rm -rf $binDir/InsightToolkit*
131   rm -rf $binDir/VTK*
132
133   cd $sourcesDir
134   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/vtk-5.6.1.tar.gz
135   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
136   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
137   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_Developer_Tools/All_Versions/tth/tth_linux/tth
138
139   tar -xvzf vtk-5.6.1.tar.gz
140   tar -xvzf gdcm_08_Dic_2009.tar.gz
141   tar -xvzf InsightToolkit-3.20.0.tar.gz
142 fi
143
144
145 if [ $buildType = "Debug" ]
146 then
147    debug="ON"
148 else
149    debug="OFF"
150 fi
151
152
153 if [ true = true ]
154 then
155   libname=VTK
156   dirInstall=$binDir/$libname-Bin
157   dirInstallVTK=$dirInstall
158   export VTK_DIR=$installPrefixThird/lib/vtk-5.6/
159   mkdir $dirInstall
160   cd $dirInstall
161  
162   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
163   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
164   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
165   cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D VTK_USE_QT:BOOL=ON CMakeCache.txt
166   make -j 2
167   make install
168   cd ..
169 fi
170
171
172 if [ true = true ]
173 then
174   libname=gdcm
175   dirInstall=$binDir/$libname-Bin
176   export GDCM_DIR=$installPrefixThird/lib/gdcm/
177   mkdir $dirInstall
178   cd $dirInstall
179   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
180   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
181   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
182   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
183   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
184   make -j 2
185   make install
186   cd ..
187 fi
188
189 if [ true = true ]
190 then
191   libname=InsightToolkit-3.20.0
192   dirInstall=$binDir/$libname-Bin
193   export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
194   mkdir $dirInstall
195   cd $dirInstall
196   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
197   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
198   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
199   cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
200   cmake CMakeCache.txt
201   make -j 2
202   make install
203   cd ..
204 fi
205
206
207 if [ true = true ]
208 then
209   cd $sourcesDir
210   cp tth $installPrefixThird/bin
211 fi
212
213
214 #deal with create creatools_third_party_libraries_config.sh
215
216 if [ -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
217 then
218    rm $installPrefixThird/share/creatools_third_party_library_config.sh
219 fi
220
221 if [ ! -e $installPrefixThird/share ]
222 then
223    mkdir $installPrefixThird/share
224 fi
225 touch     $installPrefixThird/share/creatools_third_party_library_config.sh
226 chmod 755 $installPrefixThird/share/creatools_third_party_library_config.sh
227
228 echo export PATH='$'PATH:$installPrefixThird/bin                >> $installPrefixThird/share/creatools_third_party_library_config.sh
229 echo export VTK_DIR=$installPrefixThird/lib/vtk-5.6             >> $installPrefixThird/share/creatools_third_party_library_config.sh
230 echo export ITK_DIR=$installPrefixThird/lib/InsightToolkit      >> $installPrefixThird/share/creatools_third_party_library_config.sh
231 echo export GDCM_DIR=$installPrefixThird/lib/gdcm               >> $installPrefixThird/share/creatools_third_party_library_config.sh
232 echo export TTH=$installPrefixThird/bin/tth                     >> $installPrefixThird/share/creatools_third_party_library_config.sh
233 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR        >> $installPrefixThird/share/creatools_third_party_library_config.sh
234 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR         >> $installPrefixThird/share/creatools_third_party_library_config.sh
235 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR         >> $installPrefixThird/share/creatools_third_party_library_config.sh
236
237 #  modify .bashrc
238 # - remove line 'sh $installPrefixThird/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
239 sed -i -e '/.*installPrefixThird*/ d' /etc/bashrc
240 sed -i -e '/.*creatools_third_party_library_config.*/ d' /etc/bashrc
241
242 # - add line 'sh $installPrefixThird/share/creatools_third_party_library_config.sh' (with accurate value for ???)
243 echo installPrefixThird=$installPrefixThird >> /etc/bashrc
244 echo '[ -f "$installPrefixThird/share/creatools_third_party_library_config.sh" ] &&  source $installPrefixThird/share/creatools_third_party_library_config.sh' >> /etc/bashrc 
245
246
247