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