]> 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 sudo 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 $sources/VTK*
126   rm -rf $sources/vtk*
127   rm -rf $sources/InsightToolkit*
128   rm -rf $sources/gdcm*
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   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
140 if [ $buildType = "Debug" ]
141 then
142 debug="ON"
143 else
144 debug="OFF"
145 fi
146
147
148 if [ true = true ]
149 then
150   libname=VTK
151   dirInstall=$binDir/$libname-Bin
152   dirInstallVTK=$dirInstall
153   mkdir $dirInstall
154   cd $dirInstall
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=$installPrefix 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   sudo make install
161   cd ..
162 fi
163
164 if [ true = true ]
165 then
166   libname=gdcm
167   dirInstall=$binDir/$libname-Bin
168   mkdir $dirInstall
169   cd $dirInstall
170   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
171   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
172   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
173   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
174   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
175   make -j 2
176   sudo make install
177   cd ..
178 fi
179
180 if [ true = true ]
181 then
182   libname=InsightToolkit-3.20.0
183   dirInstall=$binDir/$libname-Bin
184   mkdir $dirInstall
185   cd $dirInstall
186   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
187   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
188   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
189   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
190   cmake CMakeCache.txt
191   make -j 2
192   sudo make install
193   cd ..
194 fi
195
196 #deal with create creatools_third_party_libraries_config.sh
197
198 touch     $installPrefix/share/creatools_third_party_library_config.sh
199 chmod 666 $installPrefix/share/creatools_third_party_library_config.sh
200
201 echo export PATH='$'PATH:$installPrefix/bin             >> $installPrefix/share/creatools_third_party_library_config.sh
202 echo export VTK_DIR=$installPrefix/lib/vtk-5.6          >> $installPrefix/share/creatools_third_party_library_config.sh
203 echo export ITK_DIR=$installPrefix/lib/InsightToolkit   >> $installPrefix/share/creatools_third_party_library_config.sh
204 echo export GDCM_DIR=$installPrefix/lib/gdcm                    >> $installPrefix/share/creatools_third_party_library_config.sh
205 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR        >> $installPrefix/share/creatools_third_party_library_config.sh
206 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR         >> $installPrefix/share/creatools_third_party_library_config.sh
207 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR         >> $installPrefix/share/creatools_third_party_library_config.sh
208
209 #  modify .bashrc
210 # - remove line 'sh $installPrefix/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
211 sed -i -e '/.*creatools_third_party_library_config.*/ d' ~/.bashrc
212
213 # - add line 'sh $installPrefix/share/creatools_third_party_library_config.sh' (with accurate value for ???)
214 source $installPrefix/share/creatools_third_party_library_config.sh >> ~/.bashrc 
215
216