]> 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 generationdir=$1
39 installPrefix=$2
40 buildType=$3
41 OS=$4
42
43 scriptDir=$PWD
44 sourcesDir=$generationdir/thirdparty_sources
45 binDir=$generationdir/thirdparty_bin
46
47
48 mkdir $generationdir
49 mkdir $sourcesDir
50 mkdir $binDir
51
52 rm $installPrefix/share/creatools_third_party_library_config.sh
53
54
55
56
57 # the following stupid test is used at debug time; Please don't remove!
58 if [ true = true ]
59 then
60
61   case "$OS" in
62   Fedora)
63      yum install cmake -y 
64      yum install cmake-gui -y 
65      yum install doxygen -y
66      yum install graphviz -y
67      yum install texlive -y
68      yum install latex2html -y
69      yum install wxGTK-devel wxBase -y
70      yum install boost-devel -y
71      yum install sqlite-devel -y
72      yum install qt-devel -y
73      yum install mesa-libOSMesa-devel -y
74      ;;
75   Ubuntu)  
76      apt-get --yes install build-essential  # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
77      apt-get --yes install cmake
78      apt-get --yes install cmake-gui
79      apt-get --yes install cmake-curses-gui
80      apt-get --yes install doxygen
81      apt-get --yes install graphviz
82      apt-get --yes install texlive
83      apt-get --yes install latex2html
84      apt-get --yes install libgtk2.0-dev #GTK
85      apt-get --yes install libwxgtk2.8-dev #Wx GTK
86      apt-get --yes install libwxbase2.8-dev #Wx solito
87      apt-get --yes install libboost-dev  #Boost
88      apt-get --yes install libboost-all-dev #Boost
89      apt-get --yes install libqt4-dev #QT4
90      apt-get --yes install sqlite
91      apt-get --yes install libsqlite0-dev
92      apt-get --yes install libosmesa6-dev #Mesa6
93      apt-get --yes install uuid-dev # uuid para la instalacion de itk
94      apt-get --yes install libxaw7-dev # X11
95      ;;
96   MacOS)
97 # QUESTION : is -y  mandatory?
98
99      port install cmake -y 
100      port install cmake-gui -y 
101      port install doxygen -y
102      port install graphviz -y
103      port install texlive -y
104      port install latex2html -y
105      port install wxGTK-devel wxBase -y
106      port install boost-devel -y
107      port install sqlite-devel -y
108      port install qt-devel -y
109      port install mesa-libOSMesa-devel -y
110      ;;
111   *)
112      #echo " '$OS' : Unknown (for us...) Operating Sytem "
113      echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
114      exit 0
115      ;;
116   esac             
117 fi
118
119
120
121 # the following stupid test is used at debug time; Please don't remove!
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
142 if [ $buildType = "Debug" ]
143 then
144 debug="ON"
145 else
146 debug="OFF"
147 fi
148
149
150 if [ true = true ]
151 then
152   libname=VTK
153   dirInstall=$binDir/$libname-Bin
154   dirInstallVTK=$dirInstall
155   mkdir $dirInstall
156   cd $dirInstall
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   mkdir $dirInstall
171   cd $dirInstall
172   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
173   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
174   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
175   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
176   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
177   make -j 2
178   make install
179   cd ..
180 fi
181
182 if [ true = true ]
183 then
184   libname=InsightToolkit-3.20.0
185   dirInstall=$binDir/$libname-Bin
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=$installPrefix 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 $installPrefix/bin
203 fi
204
205 #deal with create creatools_third_party_libraries_config.sh
206
207 touch     $installPrefix/share/creatools_third_party_library_config.sh
208 chmod 666 $installPrefix/share/creatools_third_party_library_config.sh
209
210 echo export PATH='$'PATH:$installPrefix/bin                     >> $installPrefix/share/creatools_third_party_library_config.sh
211 echo export VTK_DIR=$installPrefix/lib/vtk-5.6                  >> $installPrefix/share/creatools_third_party_library_config.sh
212 echo export ITK_DIR=$installPrefix/lib/InsightToolkit           >> $installPrefix/share/creatools_third_party_library_config.sh
213 echo export GDCM_DIR=$installPrefix/lib/gdcm                    >> $installPrefix/share/creatools_third_party_library_config.sh
214 echo export TTH=$installPrefix/bin/tth                              >> $installPrefix/share/creatools_third_party_library_config.sh
215 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR        >> $installPrefix/share/creatools_third_party_library_config.sh
216 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR         >> $installPrefix/share/creatools_third_party_library_config.sh
217 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR         >> $installPrefix/share/creatools_third_party_library_config.sh
218
219 #  modify .bashrc
220 # - remove line 'sh $installPrefix/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
221 sed -i -e '/.*creatools_third_party_library_config.*/ d' /etc/bashrc
222
223 # - add line 'sh $installPrefix/share/creatools_third_party_library_config.sh' (with accurate value for ???)
224 echo source $installPrefix/share/creatools_third_party_library_config.sh >> /etc/bashrc 
225
226