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