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