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