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